Market Data / Historical Market Data

Historical Market Data

Using our Market Data API, we allow you to conveniently retrieve historical 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:

https://data.lemon.markets/v1/

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:

TermExplanation
Bid PriceThe maximum price the buyer is willing to pay for a specific instrument.
Ask PriceThe minimum price the seller is willing to sell the specific instrument for.
Bid VolumeNumber of instruments sold at bid price.
Ask VolumeNumber 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:

https://data.lemon.markets/v1/quotes/latest

Request

To retrieve the latest quote for an instrument, specify your request as follows:

Header Parameters

Authorization
string
required

Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"
(see the example in the code snippet on the right)


Query Parameters

isin
string
required

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.

Read more ↘
mic
string
optional

Use the Market Identifier Code to filter for a specific Trading Venue. Currently, only XMUN is supported.

decimals
boolean
optional

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.

epoch
boolean
optional

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

sorting
string
optional

Sort your API response, either ascending (asc) or descending (desc)

limit
int
optional

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.

page
int
optional

This parameter is required to influence the Pagination. Use it to define the specific results page you wish to display.

Response

Response Parameters

isin
string

This is the International Securities Identification Number of the instrument you requested the quotes for.

b_v
int/decimal

This is the Bid Volume for the Quote

a_v
int/decimal

This is the Ask Volume for the Quote

b
int/decimal

This is the Bid price for the Quote

a
int/decimal

This is the Ask price for the Quote

t
string

This is the timestamp the Quote occured at

mic
string

This is the Market Identifier Code of the Trading Venue the Quote occured at

Other Attributes

time
string

Timestamp of your API request

Pagination

previous
string

Pagination attribute: this is a URL of the previous page

next
string

Pagination attribute: this is a URL of the next page

total
int

Pagination attribute: this is the total number of results

page
int

Pagination attribute: this is the current page number

pages
int

Pagination attribute: this is the total number of pages

Check our Error Handling Page for specific information on error types.

GET/quotes/latest/?isin=US88160R1014
1import requests
2import json
3
4request = requests.get("https://data.lemon.markets/v1/quotes/latest/?isin=US88160R1014",
5          headers={"Authorization": "Bearer YOUR-API-KEY"})
6print(request.json())
Response
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

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.

TypeExplanation
OpenPrice of instrument at the beginning of the respective time period.
HighHighest instrument price within the respective time period.
LowLowest instrument price within the respective time period.
ClosePrice of instrument at the end of the respective time period.
VolumeAggregated volume (Number of trades) of instrument for the respective time period.
Price by VolumeThe (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:

TypeDescription
m1The data is aggregated on a per-minute basis.
h1The data is aggregated on an hourly basis.
d1The data is aggregated on a daily basis.

The data is only available for timeframes in which trades have been passed

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.


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:

https://data.lemon.markets/v1/ohlc/m1/

https://data.lemon.markets/v1/ohlc/h1/

https://data.lemon.markets/v1/ohlc/d1/

The API will then return historic M1, H1 or D1 market data.

Request

Specify your request as follows:

Path Parameters

x1
string
required

Specify the type of data you wish to retrieve: m1 (per minute), h1 (per hour), or d1 (per day).

Header Parameters

Authorization
string
required

Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"
(see the example in the code snippet on the right)

Query Parameters

isin
string
required

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.

Read more ↘
Maximum 10 ISINs per request
mic
string
optional

Use the Market Identifier Code to filter for a specific Trading Venue. Currently, only XMUN is supported.

from
int/string
optional

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.

Read more ↘
to
int/string
optional

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.

Read more ↘
decimals
boolean
optional

Use this to specify the numbers format you want to get your response in, either decimals or int. The default value is true.

epoch
boolean
optional

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

sorting
string
optional

Sort your API response, either ascending (asc) or descending (desc)

limit
int
optional

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.

page
int
optional

This parameter is required to influence the Pagination. Use it to define the specific results page you wish to display.

Response

Response Parameters

isin
string

This is the International Securities Identification Number of the instrument you requested the OHLC data for.

o
int/decimal

This is the Open Price in the specific time period

h
int/decimal

This is the Highest Price in the specific time period

l
int/decimal

This is the Lowest Price in the specific time period

c
int/decimal

This is the Close Price in the specific time period

v
int/decimal

This is the aggegrated volume (Number of trades) of the instrument in the specific time period

pbv
int/decimal

This is the Price by Volume (Sum of (quantity * last price)) of the instrument in the specific time period

t
string

This is the Timestamp of the time period the OHLC data is based on

mic
string

This is the Market Identifier Code of the Trading Venue the OHLC data occured at

Other Attributes

time
string

Timestamp of your API request

Pagination

previous
string

Pagination attribute: this is a URL of the previous page

next
string

Pagination attribute: this is a URL of the next page

total
int

Pagination attribute: this is the total number of results

page
int

Pagination attribute: this is the current page number

pages
int

Pagination attribute: this is the total number of pages

Check our Error Handling Page for specific information on error types.

GET/ohlc/{x1}
1import requests
2import json
3
4request = requests.get("https://data.lemon.markets/v1/ohlc/x1",
5          headers={"Authorization": "Bearer YOUR-API-KEY"})
6print(request.json())
Response
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

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:

https://data.lemon.markets/v1/trades/latest

Request

To request the latest trade, specify your request as follows:

Header Parameters

Authorization
string
required

Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"
(see the example in the code snippet on the right)

Query Parameters

isin
string
required

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

Read more ↘
Maximum 10 ISINs per request
mic
string
optional

Enter a Market Identifier Code (MIC) in there. We currently offer data from the Munich Stock Exchange (XMUN).

decimals
boolean
optional

Use this to specify the numbers format you want to get your response in, either decimals or int. The default value is true.

epoch
boolean
optional

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

sorting
string
optional

Sort your API response, either ascending (asc) or descending (desc)

limit
int
optional

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.

page
int
optional

This parameter is required to influence the Pagination. Use it to define the specific results page you wish to display.

Response

Response Parameters

isin
string

This is the International Securities Identification Number of the instrument you requested the trades for.

p
int/decimal

This is the Price the trade happened at

v
int/decimal

This is the Volume for the trade (quantity)

t
string

This is the Timestamp the trade occured at

mic
string

This is the Market Identifier Code of the Trading Venue the trade occured at

Other Attributes

time
string

Timestamp of your API request

Pagination

previous
string

Pagination attribute: this is a URL of the previous page

next
string

Pagination attribute: this is a URL of the next page

total
int

Pagination attribute: this is the total number of results

page
int

Pagination attribute: this is the current page number

pages
int

Pagination attribute: this is the total number of pages

Check our Error Handling Page for specific information on error types.

GET/trades/latest/?isin=US88160R1014
1import requests
2import json
3
4request = requests.get("https://data.lemon.markets/v1/trades/latest/?isin=US88160R1014",
5          headers={"Authorization": "Bearer YOUR-API-KEY"})
6print(request.json())
Response
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