This means that if no trades were made in a specific timeframe, there may be gaps in the data returned. This is probably more relevant for M1 data, but might also occur for H1 and D1 data if you request less frequently traded instruments.
Historic Market Data
Using our Market Data API, we allow you to conveniently retrieve historic quotes, Open-High-Low-Close (OHLC) data (M1/H1/D1) as well as trades for a specific instrument. Below, find an overview of different Market Data API use cases.
The base URL for the Market Data API is:
Latest Quotes
Quotes are an important indicator for instruments of all kinds. A quote gives you information about the price and trading volume of a specific instrument (how it is "quoted" on the stock exchange) and can therefore be a helpful tool, when it comes to designing your trading strategy. While dealing with quotes, you will inevitably stumble upon the following terms:
Term | Explanation |
---|---|
Bid Price | The maximum price the buyer is willing to pay for a specific instrument. |
Ask Price | The minimum price the seller is willing to sell the specific instrument for. |
Bid Volume | Number of instruments sold at bid price. |
Ask Volume | Number of instruments sold at ask price. |
GET /quotes/latest
We offer you one endpoint to retrieve the latest quote for a specific instrument, which can be accessed through following request URL:
Request
To retrieve the latest quote for an instrument, specify your request as follows:
Header Parameters
Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"
(see the example in the code snippet on the right)
Query Parameters
Use the International Securities Identification Number to filter for a specific instrument you want to get the quotes for. You can also specify multiple ISINs in the Query Parameters:
In the query parameter, write ?isin=US88160R1014&isin=US19260Q1076 or simply use commas, like isin=US88160R1014,US19260Q1076. Maximum 10 ISINs per request.
Use the Market Identifier Code to filter for a specific Trading Venue. Currently, only XMUN is supported.
Use this to query parameter to specify the numbers format you want to get your response in. This can be either decimals or int. Default is true.
Use this to query parameter to specify the date format you want to get your response in. The default value is false, meaning that the API will return ISO string dates.
Other Query Parameters
Sort your API response, either ascending (asc) or descending (desc)
This parameter is required to influence the Pagination. Use it to define the limit of displayed results on one page.
The default value is 100, the maximum number is 250.
This parameter is required to influence the Pagination. Use it to define the specific results page you wish to display.
Response
Response Parameters
This is the International Securities Identification Number of the instrument you requested the quotes for.
This is the Bid Volume for the Quote
This is the Ask Volume for the Quote
This is the Bid price for the Quote
This is the Ask price for the Quote
This is the timestamp the Quote occured at
This is the Market Identifier Code of the Trading Venue the Quote occured at
Pagination
Pagination attribute: this is a URL of the previous page
Pagination attribute: this is a URL of the next page
Pagination attribute: this is the total number of results
Pagination attribute: this is the current page number
Pagination attribute: this is the total number of pages
Other Attributes
Timestamp of your API request
Check our Error Handling Page for specific information on error types.
1import requests
2import json
3
4market_data_key = 'YOUR-MARKET-DATA-KEY'
5request = requests.get("https://data.lemon.markets/v1/quotes/latest?isin=US88160R1014",
6 headers={"Authorization": f"Bearer {market_data_key}"})
7print(request.json())
1{
2 "time": "2022-02-14T20:44:03.759+00:00",
3 "results":
4 [
5 {
6 "isin": "US88160R1014",
7 "b_v": 87,
8 "a_v": 87,
9 "b": 921.1,
10 "a": 921.1,
11 "t": "2021-10-28T08:51:03.669+00:00",
12 "mic": "XMUN"
13 }
14 ],
15 "previous": null,
16 "next": null,
17 "total": 1,
18 "page": 1,
19 "pages": 1
20}
21
Historic Quotes
Quotes are an important indicator for instruments of all kinds. A quote gives you information about the price and trading volume of a specific instrument (how it is "quoted" on the stock exchange) and can therefore be a helpful tool, when it comes to designing your trading strategy. While dealing with quotes, you will inevitably stumble upon the following terms:
Term | Explanation |
---|---|
Bid Price | The maximum price the buyer is willing to pay for a specific instrument. |
Ask Price | The minimum price the seller is willing to sell the specific instrument for. |
Bid Volume | Number of instruments sold at bid price. |
Ask Volume | Number of instruments sold at ask price. |
GET /quotes
We offer you one endpoint to retrieve the quotes for a specific instrument, which can be accessed through following request URL:
Request
To retrieve the latest quote for an instrument, specify your request as follows:
Header Parameters
Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"
(see the example in the code snippet on the right)
Query Parameters
Use the International Securities Identification Number to filter for a specific instrument you want to get the quotes for. You must specify exactly one ISIN.
Specify the beginning of the interval you want to request data for. Specify the point in time
using the ISO 8601 notation, like 2022-11-16T16:08:15.000+0100
(make sure to percent-encode the +
symbol: %2b
).
Incomplete dates like 2022-11-16
will be expanded to represent midnight UTC: 2022-11-16T00:00:00.000+0000
.
Specify the end of the interval you want to request data for. The data format matches the one in
from
. You can request up to one year of data: ?from=2022-01-01&to=2023-01-01
.
Use the Market Identifier Code to filter for a specific Trading Venue. Currently, only "XMUN"
is supported.
Use this to query parameter to specify the number format for your response.
This can be either floating point (via true
, default) or integer (via false
).
Use this to query parameter to specify the date format for your response.
This can be either string (ISO 8601, like "2022-11-16T15:34:53.000+0100"
, default)
or a number (milliseconds since the beginning of the Unix epoch, like 1641193610000
).
Other Query Parameters
Sort your API response, either ascending (asc) or descending (desc)
This parameter is required to influence the Pagination. Use it to define the limit of displayed results on one page.
The default value is 100, the maximum is 1000.
This parameter is required to influence the pagination. Use it to define the specific results page you wish to display.
Response
Response Parameters
This is the International Securities Identification Number of the instrument you requested the quotes for.
This is the Bid Volume for the Quote
This is the Ask Volume for the Quote
This is the Bid price for the Quote
This is the Ask price for the Quote
This is the timestamp the Quote occured at
This is the Market Identifier Code of the Trading Venue the Quote occured at
Pagination
Pagination attribute: this is a URL of the previous page
Pagination attribute: this is a URL of the next page
Pagination attribute: this is the total number of results
Pagination attribute: this is the current page number
Pagination attribute: this is the total number of pages
Other Attributes
Timestamp of your API request
Check our Error Handling Page for specific information on error types.
1import requests
2import json
3
4market_data_key = 'YOUR-MARKET-DATA-KEY'
5request = requests.get("https://data.lemon.markets/v1/quotes?isin=US88160R1014&from=2022-01-03",
6 headers={"Authorization": f"Bearer {market_data_key}"})
7print(request.json())
1{
2 "time": "2022-02-14T20:44:03.759+00:00",
3 "results": [
4 {
5 "isin": "US88160R1014",
6 "b_v": 87,
7 "a_v": 87,
8 "b": 921.1,
9 "a": 921.1,
10 "t": "2021-10-28T08:51:03.669+00:00",
11 "mic": "XMUN"
12 }
13 ],
14 "previous": null,
15 "next": null,
16 "total": 1,
17 "page": 1,
18 "pages": 1
19}
20
OHLC
We also offer an endpoint that returns historic market data in the Open High Low Close (OHLC) format - the typical candlestick charts. Even though the names are almost self-explanatory, we still want to give you some additionall information regarding OHLC data. In addition to the OHLC values, we also return the volume and aggregated price by volume for the specific time period.
Type | Explanation |
---|---|
Open | Price of instrument at the beginning of the respective time period. |
High | Highest instrument price within the respective time period. |
Low | Lowest instrument price within the respective time period. |
Close | Price of instrument at the end of the respective time period. |
Volume | Aggregated volume (Number of trades) of instrument for the respective time period. |
Price by Volume | The (Sum of (quantity * last price)) of instrument for the respective time period. |
Depending on what exactly you are building, there might be different needs for data granularity. For example, if you are interested in analysing price developments far back into the past, it might be sufficient for you if you get aggregated price data per day. However, if you are interested in short-time price developments, you might want to go as granular as possible.
Therefore, we offer historic OHLC data in the three following levels:
Type | Description |
---|---|
m1 | The data is aggregated on a per-minute basis. |
h1 | The data is aggregated on an hourly basis. |
d1 | The data is aggregated on a daily basis. |
The data is only available for timeframes in which trades have been passed
GET /ohlc/{x1}
For the historic OHLC data, we offer three endpoints whose logic works in an (almost) identical way. Depending on the type of OHLC data you wish to retrieve, use the following request URLs:
The API will then return historic M1, H1 or D1 market data.
Request
Specify your request as follows:
Path Parameters
Specify the type of data you wish to retrieve: m1 (per minute), h1 (per hour), or d1 (per day).
Header Parameters
Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"
(see the example in the code snippet on the right)
Query Parameters
Use the International Securities Identification Number (ISIN) to filter for the instrument you want to get the OHLC data for.
You can also specify multiple ISINs in the Query Parameters:
use ?isin=US88160R1014&isin=US19260Q1076 or simply use commas, like isin=US88160R1014,US19260Q1076.
Use the Market Identifier Code to filter for a specific Trading Venue. Currently, only XMUN is supported.
Start of time range you want to get OHLC data for. Use int/date-iso-string to define the start date of your timestamp range. Find out more about available time ranges below:
For D1 data, you can request 60 days of data with one request, therefore the time range between from and to cannot be longer than 60 days. If to is not defined, the API automatically returns data until the current day or up to 60 days, based on the from date.
For H1 and M1 data, you can request historical data for one day, therefore the time range between from and to cannot be longer than 1 day.
End of time range you want to get OHLC data for. Use int/date-iso-string to define the end date of your timestamp range. Find out more about available time ranges below:
For D1 data, you can request 60 days of data with one request, therefore the time range between from and to cannot be longer than 60 days. If to is not defined, the API automatically returns data until the current day or up to 60 days, based on the from date.
For H1 and M1 data, you can request historical data for one day, therefore the time range between from and to cannot be longer than 1 day.
Use this to specify the numbers format you want to get your response in, either decimals or int. The default value is true.
Use this to specify the date format you want to get your response in. The default value is false. By default, the API will return ISO string dates.
Other Query Parameters
Sort your API response, either ascending (asc) or descending (desc)
This parameter is required to influence the Pagination. Use it to define the limit of displayed results on one page.
The default value is 100, the maximum number is 250.
This parameter is required to influence the Pagination. Use it to define the specific results page you wish to display.
Response
Response Parameters
This is the International Securities Identification Number of the instrument you requested the OHLC data for.
This is the Open Price in the specific time period
This is the Highest Price in the specific time period
This is the Lowest Price in the specific time period
This is the Close Price in the specific time period
This is the aggegrated volume (Number of trades) of the instrument in the specific time period
This is the Price by Volume (Sum of (quantity * last price)) of the instrument in the specific time period
The timestamp of the beginning of the represented time interval.
This is the Market Identifier Code of the Trading Venue the OHLC data occured at
Pagination
Pagination attribute: this is a URL of the previous page
Pagination attribute: this is a URL of the next page
Pagination attribute: this is the total number of results
Pagination attribute: this is the current page number
Pagination attribute: this is the total number of pages
Other Attributes
Timestamp of your API request
Check our Error Handling Page for specific information on error types.
1import requests
2import json
3
4market_data_key = 'YOUR-MARKET-DATA-KEY'
5request = requests.get("https://data.lemon.markets/v1/ohlc/d1?isin=US88160R1014&from=2021-11-01&limit=10",
6 headers={"Authorization": f"Bearer {market_data_key}"})
7print(request.json())
1{
2 "time": "2022-02-14T20:44:03.759+00:00",
3 "results":
4 [
5 {
6 "isin": "US88160R1014",
7 "o": 777.9,
8 "h": 777.9,
9 "l": 762.5,
10 "c": 768.7,
11 "v": 433,
12 "pbv": 333645.1,
13 "t": "2021-09-02T00:00:00.000+00:00",
14 "mic": "XMUN"
15 },
16 {
17 "isin": "US88160R1014",
18 ...
19 },
20 {
21 ...
22 }
23 ],
24 "previous": "https://data.lemon.markets/v1/ohlc/d1?isin=US88160R1014&from=2021-11-01&limit=10&page=1",
25 "next": "https://data.lemon.markets/v1/ohlc/d1?isin=US88160R1014&from=2021-11-01&limit=10&page=3",
26 "total": 999,
27 "page": 2,
28 "pages": 10
29}
30
Latest Trades
We offer an endpoint that returns trades for instruments of your choice. The endpoint gives you information about the price and volume the instrument was traded at and the timestamp the trade occured at.
GET /trades/latest
To request the latest trade for a specific instrument, use the following request URL:
Request
To request the latest trade, specify your request as follows:
Header Parameters
Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"
(see the example in the code snippet on the right)
Query Parameters
The International Securities Identification Number of the instrument you want to get the trades for.
You can also specify multiple ISINs in the Query Parameters:
Simply specify ?isin=US88160R1014&isin=US19260Q1076 or use commas, like isin=US88160R1014,US19260Q1076
Enter a Market Identifier Code (MIC) in there. We currently offer data from the Munich Stock Exchange (XMUN).
Use this to specify the numbers format you want to get your response in, either decimals or int. The default value is true.
Use this to specify the date format you want to get your response in. The default value is false. By default, the API will return ISO string dates.
Other Query Parameters
Sort your API response, either ascending (asc) or descending (desc)
This parameter is required to influence the Pagination. Use it to define the limit of displayed results on one page.
The default value is 100, the maximum number is 250.
This parameter is required to influence the Pagination. Use it to define the specific results page you wish to display.
Response
Response Parameters
This is the International Securities Identification Number of the instrument you requested the trades for.
This is the Price the trade happened at
This is the Volume for the trade (quantity)
This is the Timestamp the trade occured at
This is the Market Identifier Code of the Trading Venue the trade occured at
Pagination
Pagination attribute: this is a URL of the previous page
Pagination attribute: this is a URL of the next page
Pagination attribute: this is the total number of results
Pagination attribute: this is the current page number
Pagination attribute: this is the total number of pages
Other Attributes
Timestamp of your API request
Check our Error Handling Page for specific information on error types.
1import requests
2import json
3
4market_data_key = 'YOUR-MARKET-DATA-KEY'
5request = requests.get("https://data.lemon.markets/v1/trades/latest?isin=US88160R1014",
6 headers={"Authorization": f"Bearer {market_data_key}"})
7print(request.json())
1{
2 "time": "2022-02-14T20:44:03.759+00:00",
3 "results":
4 [
5 {
6 "isin": "US19260Q1076",
7 "p": 274.0,
8 "v": 2,
9 "t": "2021-10-28T09:05:14.474+00:00",
10 "mic": "XMUN"
11 }
12 ],
13 "previous": null,
14 "next": null,
15 "total": 1,
16 "page": 1,
17 "pages": 1
18}
19
Historic Trades
We offer an endpoint that returns trades for instruments of your choice. The endpoint gives you information about the price and volume the instrument was traded at and the timestamp the trade occured at.
GET /trades
To request the trades for a specific instrument, use the following request URL:
Request
To request the trades, specify your request as follows:
Header Parameters
Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"
(see the example in the code snippet on the right)
Query Parameters
The International Securities Identification Number of the instrument you want to get the trades for. You must specify exactly one ISIN.
Specify the beginning of the interval you want to request data for. Specify the point in time
using the ISO 8601 notation, like 2022-11-16T16:08:15.000+0100
(make sure to percent-encode the +
symbol: %2b
).
Incomplete dates like 2022-11-16
will be expanded to represent midnight UTC: 2022-11-16T00:00:00.000+0000
.
Specify the end of the interval you want to request data for. The data format matches the one in
from
. You can request up to one year of data: ?from=2022-01-01&to=2023-01-01
.
Enter a Market Identifier Code (MIC) in there. We currently offer data from the Munich Stock Exchange ("XMUN"
).
Use this to specify the numbers format you want to get your response in, either decimals or int. The default value is true.
Use this to specify the date format you want to get your response in. The default value is false. By default, the API will return ISO string dates.
Other Query Parameters
Sort your API response, either ascending (asc
) or descending (desc
).
This parameter is required to influence the Pagination. Use it to define the limit of displayed results on one page.
The default value is 100, the maximum number is 1000.
This parameter is required to influence the Pagination. Use it to define the specific results page you wish to display.
Response
Response Parameters
This is the International Securities Identification Number of the instrument you requested the trades for.
This is the Price the trade happened at
This is the Volume for the trade (quantity)
This is the Timestamp the trade occured at
This is the Market Identifier Code of the Trading Venue the trade occured at
Pagination
Pagination attribute: this is a URL of the previous page
Pagination attribute: this is a URL of the next page
Pagination attribute: this is the total number of results
Pagination attribute: this is the current page number
Pagination attribute: this is the total number of pages
Other Attributes
Timestamp of your API request
Check our Error Handling Page for specific information on error types.
1import requests
2import json
3
4market_data_key = 'YOUR-MARKET-DATA-KEY'
5request = requests.get("https://data.lemon.markets/v1/trades?isin=US88160R1014&from=2022-01-03",
6 headers={"Authorization": f"Bearer {market_data_key}"})
7print(request.json())
1{
2 "time": "2022-02-14T20:44:03.759+00:00",
3 "results": [
4 {
5 "isin": "US19260Q1076",
6 "p": 956.2,
7 "pbv": 95620,
8 "v": 100,
9 "t": "2022-01-03T07:06:50.594+00:00",
10 "mic": "XMUN"
11 }
12 ],
13 "previous": null,
14 "next": null,
15 "total": 1,
16 "page": 1,
17 "pages": 1
18}
19