Numbers & Dates
When using the lemon.markets Trading and Market Data API, you will need to specify numbers and dates at a variety of different endpoints. This page gives you a concise overview of all things to consider when working with numbers and dates.
In the Trading API, we offer all numbers in the Integer format only. However, we still need to distinguish between two different cases.
If you want to enter a quantity (e.g. when you place an order and want to specify how many stocks you want to buy), you can simply enter the "normal" quantity you want to buy or sell --> "quantity" = 1 will result in you buying 1 stock.
The Integer format for all places where an amount of currency is specified works differently. In general, you need to specify the price as a hundreths of a cent.
|Endpoint||Endpoint Parameters with Integer Specification|
|Account||- balance |
|Orders||- stop_price |
|Positions||- buy_price_avg |
If you use our Market Data API, you will eventually need to define a specific date or a specific time range, e.g. to get the OHLC data for your favourite stock . You can do so by specifying the from and to query parameters in the Quotes, OHLC, Prices, and Trades endpoint (see a more detailed description below at the Market Data API section.
In general, you have two options to do so.
- By specifying an epoch timestamp
- By specifying an ISO Date
Please note that you need to specify the epoch timestamp in milliseconds. So, if you wanted to define the epoch timestamp for January 1st 2022, 10:00 am, you would do that through:
If you prefer to use the ISO date format, you could specify your desired date in the format "YYYY-MM-DD", like so:
Additionally, you can also specifiy the ISO date format in milliseconds:
You can also define the date format you want the API to return using the query parameter ?epoch, which is a Boolean value. By default, the API returns a timestamp in the ISO format (?epoch=false). To receive the timestamp in epoch format, set ?epoch=true
Similarly as with the date format, you can easily specify the numbers format you want the API to return.
For that, use the Query Parameter decimals and set true if you want the API to return everything in decimals or false if you want it to return Integers. See an example for using the query parameter below.