Error Handling
This page is concerned with providing you with specific information on error handling. In general, an error will be returned in the following format:
{
'time': '2001-02-03T04:05:06.789+00:00',
'mode': 'paper',
'status': 'error',
'error_code': 'order_total_price_limit_exceeded',
'error_message': 'cannot place/activate buy order if estimated total price is greater than 25k Euro'
}
Global Errors
These are global errors that can occur on both the Trading and the Market Data API
Error Code | Description |
---|---|
unauthorized | The API key is not provided in the HTTP header, cannot be decoded by the backend, or the API Key does not exist. |
token_invalid | The API key is revoked or user is deleted/suspended. |
rate_limit_exceeded | The API key has exceeded its rate limit. Please respect the value of the Retry-After header before performing another request. |
[xxx]_not_found | The required entity does not exist. |
internal_error | An error occurred in the backend. This is not your fault. We will investigate this. |
Trading API
These are all error codes that can occur while using the Trading API
Idempotency
When specifying an idempotency key in the request body, the following error code can be thrown (when the same idempotency key is used twice within a 7 day period)
Error Code | Description |
---|---|
order_idempotency_violation | Same idempotency has been used within current 7 day period |
Account Endpoint
Error Handling for the request URLs:
https://paper-trading.lemon.markets/v1/account
https://trading.lemon.markets/v1/account
Error Code | Description |
---|---|
pin_missing | Cannot withdraw money because the PIN is not provided in the request (money only) |
pin_not_set | Cannot withdraw money because the PIN is not set (money only) |
pin_invalid | Cannot withdraw money because the pin verification failed |
withdraw_insufficient_funds | Cannot withdraw money because there are insufficient funds on the account |
withdraw_limit_exceeded | Cannot withdraw money because the daily payout limit is exceeded |
withdraw_request_limit_exceeded | Cannot withdraw money because the maximal daily request limit is exceeded |
forbidden_in_current_state | Cannot update address_country when trading is enabled or user is onboarded |
plan_not_allowed | Cannot update trading plan to basic/pro |
Order Endpoint
Error Handling for the request URLs:
https://paper-trading.lemon.markets/v1/orders
https://trading.lemon.markets/v1/orders
Error Code | Description |
---|---|
insufficient_holdings | insufficient instrument holdings [on order sell] |
order_expiration_date_invalid | cannot place order if one expires before market opens again |
order_total_price_limit_exceeded | cannot place/activate buy order if estimated total price is greater than 25k Euro |
forbidden_for_venue | cannot place order in ALLDAY for MONEY env |
trading_disabled | cannot place order if trading is not enabled |
order_limit_exceeded | maximum daily amount of orders reached |
instrument_not_tradable | failed to place order if instrument is not tradable |
account_insufficient_funds | cannot place/activate buy order because of insufficient account funds |
trading_blocked | cannot place/activate order because trading is blocked globally |
pin_invalid | cannot activate order because pin validation failed |
order_not_inactive | cannot activate order if its status != inactive |
order_not_terminated | cannot delete order if its not in cancelling/cancelled/expired/executed/rejected state |
Market Data API
Trading Venues Endpoint
Error handling for the request URL:
https://data.lemon.markets/v1/venues
Error Code | Description |
---|---|
invalid_query | Invalid MIC, max 5 char. |
Instruments Endpoint
Error handling for the request URL:
https://data.lemon.markets/v1/instruments
Error Code | Description |
---|---|
invalid_query | Invalid mic, max 5 char. |
invalid_query | Invalid ISIN value |
invalid_query | Exceeded number of ISINs (more than 10) |
invalid_query | Invalid type value (not stock, bond, warrant, fund or etf). |
invalid_query | Search string too long, max 25char. |
Quotes, OHLC, and Trades Endpoints
Error handling for the request URLs:
https://data.lemon.markets/v1/quotes
https://data.lemon.markets/v1/ohlc/{x1}
https://data.lemon.markets/v1/trades
Error Code | Description |
---|---|
invalid_query | Invalid MIC, max 5 char. |
invalid_query | Invalid ISIN value. |
invalid_query | Exceeded number of ISINs (more than 10). |
invalid_query | Invalid from : Not a valid date. |
invalid_query | Invalid to : Not a valid date. |
invalid_query | Invalid from : The date is later than to . |
invalid_query | Invalid from/to : Specified dates are not valid. Maximum 7 days. |