Get Started

Start by signing up on https://app.lemon.markets/. Then, you will get an e-mail in order to activate your account. lemon.markets is completely free, no credit card details or whatsoever are required.

Once you activated your account, you will be able to sign in on our dashboard. Each account has a balance at the beginning of 10.000€ (paper money).

Prerequisites

You do not need much to get started on lemon.markets. Grab your preferred IDE and execute the first request with a request package of a programming language you like the most.

If you want to use Python install the requests package (via pip install requests). You will need three functions in total - the requests.get(), the requests.post() and requests.delete() function - that's it! E.g. if you want to get all your orders, here is the code in Python:

requests.get('https://api.lemon.markets/rest/v1/accounts/{YOUR_ACCOUNT_UUID}/orders/', headers={'Authorization': 'Token {YOUR_AUTH_TOKEN}'})

In a few weeks' time we will release SDKs for Python and JavaScript which will make interacting with the API even easier. Feel free to contribute to the SDKs or even create your own open-sourced version. For now, you should have a look at the pure Python and JavaScript tutorials.

Domain

Each request has to be performed against the domain https://api.lemon.markets/. Most requests will be REST-ful, so the API root is https://api.lemon.markets/rest/v1/.

Access Tokens

The first thing you should do is visiting the "Auth & Strategy" page on the dashboard and create an Access Token. An Access Token is needed for every request you will execute on our API. You can (but you do not have to) link your Access Token to a strategy. It is highly recommended to use a strategy - a strategy can be your algorithmic/ automated strategy (for instance the "Trump2Cash Bot"). Using a strategy, you will be able to measure each strategy independently and - most importantly - you will be able to participate in our trading competition.

Your freshly created Access Token will look like this 77dc1ff0d09784b72199ab4782e0160c84876fce. To use the Access Token with each API call, use the Authorization Header of the request and provide the value as follows: Token {TOKEN_KEY} e.g. Token 77dc1ff0d09784b72199ab4782e0160c84876fce.

Execute your first requests

We will start with getting information about our demo account. The account was automatically created during the registration.

get
List all Accounts

https://api.lemon.markets/rest/v1/accounts/
Request
Response
Request
Headers
Authorization
required
string
Token {TOKEN_KEY}
Response
200: OK
All LIST requests can be paginated and the result will always be in the results list.
{
"count": 1,
"next": null,
"previous": null,
"results":[
{
"name": "Marcels Demo Account",
"type": "demo",
"currency": "EUR",
"uuid": "2e9f2347-5f14-4614-a9d7-314f7e27eef2"
}
]
}

Take a look at the response. Over there you will find the account uuid. Having this uuid in mind, we are able to execute further requests. As we are highly interested in trading, we would like to execute our first order!

post
Create an Order

https://api.lemon.markets/rest/v1/accounts/{account_uuid}/orders/
Request
Response
Request
Path Parameters
account_uuid
required
string
Use the UUID of the /rest/v1/orders/ request
Headers
Authorization
required
string
Token {TOKEN_KEY}
Body Parameters
stop_price
optional
number
Stop price to be reached before order can be executed
limit_price
optional
number
Limit price of order
type
optional
string
Types can be market | stop_market | limit | stop_limit
valid_until
optional
number
Put a UNIX timestamp in here (microseconds can be included using a dot as separator, e.g. 1598961600.100). If you don't provide a date, the order will be intraday
side
required
string
either sell or buy a security, so put this in here
instrument
required
string
all instruments are described by their ISIN, so put an ISIN in here, e.g. US88160R1014
quantity
required
integer
desired order quantity, e.g. 10 stocks
Response
200: OK
{
"stop_price": null,
"limit_price": 350.0,
"type": "limit",
"instrument": "US88160R1014",
"valid_until": 1598961600.1,
"quantity": 5,
"side": "buy",
"status": "open",
"uuid": "b0900b14-67b1-46eb-843c-f5bd52dbf212"
}

This is it. You have to fill in for {account_uuid} the uuid of the account we retrieved in the previous step. Hopefully we can grab some Tesla stocks at the price of 350.00€ ;-)

Have a look at the tutorials, you will find the steps above over there in Python and JavaScript.

Alrighty! You are good to go.