Orders

This is where the magic happens. Create an order in order to buy or sell stocks, ETFs, bonds or derivates (all are so called instruments)

Let's start by creating your order. You can create a order using one of those types:

Type

Description

market

Market Order: The order will be executed on the next possible price.

stop_market

Stop Market Order: once the stop price is hit, the order will be converted to a market order. Then, the order will be executed immediately on the next price.

limit

Limit Order: The order will be executed once the limit price is reached.

stop_limit

Stop Limit Order: once the stop price is hit, the order will be converted to a limit order. Then, the order will be executed once the limit price is reached.

You do not have to specify an order type. For instance, if you provide only a stop_price, the order is a stop_market order. If you provide both a stop_price and a limit_price, the order will be a stop_limit order. If you only provide the limit_price, the order will be a limit order. If you provide nothing, the order will be executed as a market order on the next available price.

post
CREATE an Order

https://api.lemon.markets/rest/v1/accounts/{account_uuid}/orders/
In order to create an order pass the body parameters as a JSON object to the API. After your order was executed, you will find a corresponding cash transaction in your account (accounts/{account_uuid}/transactions/ endpoint)
Request
Response
Request
Path Parameters
account_uuid
required
string
UUID of your account (see accounts section)
Headers
Authorization
required
string
Token {TOKEN_KEY}
Body Parameters
instrument
required
string
ISIN of an instrument
side
required
string
"buy" or "sell"
quantity
required
integer
amount of shares you want to buy
valid_until
required
number
Standard UTC UNIX Timestamp. Can be any date in the future
type
optional
string
(see table above)
limit_price
optional
number
(see table above)
stop_price
optional
number
(see table above)
Response
201: Created
{
"limit_price": 399.12,
"type": "limit",
"instrument": "US88160R1014",
"valid_until": 1601510400,
"quantity": 10,
"side": "buy",
"status": "open",
"uuid": "1ab5f64-5678-2221-b3fc-2c963f26afa6",
}

If you create an order, the cash_to_invest (queryable on the /accounts/{account_uuid}/state/ endpoint or on the dashboard) will decrease. For instance, if you create an order for 6x Daimler with limit price 40€, your cash_to_invest will decrease by 240€. If you create a market order, a risk premium of 10% will always be put on top of the latest price for the instrument. E.g. if Tesla is at 400€ and you want to buy it using a market order, your cash_to_invest would decrease by 440€ (10% risk premium).

delete
DELETE an Order

https://api.lemon.markets/rest/v1/accounts/{account_uuid}/orders/{order_uuid}/
Delete an order based on its uuid (the uuid can be retrieved e.g. via the LIST Orders call (down below)
Request
Response
Request
Path Parameters
account_uuid
required
string
UUID of your account (see accounts section)
order_uuid
required
string
The uuid can be retrieved via the LIST Orders call (down below)
Headers
Authorization
required
string
Token {TOKEN_KEY}
Response
204: No Content

get
LIST all Orders

https://api.lemon.markets/rest/v1/accounts/{account_uuid}/orders/
You can get all orders over here. You can filter for specific orders using the filters as query parameters (e.g. filtering only for open orders).
Request
Response
Request
Path Parameters
account_uuid
required
string
UUID of your account (see account section)
Headers
Authorization
required
string
Token {TOKEN_KEY}
Query Parameters
limit
optional
integer
Needed for pagination; default is 200
offset
optional
integer
Needed for pagination
side
optional
string
Filter for side: buy | sell
type
optional
string
Filter for the order type: limit | market | stop_limit | stop_market
status
optional
string
Filter for one of those: executed | open | deleted | in_process | expired
created_at_until
optional
number
UTC UNIX Timestamp. Optional, you can filter with this
created_at_from
optional
number
UTC UNIX Timestamp. Optional, you can filter with this
Response
200: OK
{
"count": 1,
"next": "null",
"previous": "null",
"results": [
{
"quantity": 5,
"limit_price": 42.42,
"type": "limit",
"side": "buy",
"status": "executed",
"instrument": {
"title": "Daimler AG",
"isin": "DE0007100000",
"wkn": "710000"
},
"created_at": 1598958661,
"processed_at": 1599213600,
"processed_quantity": 5,
"uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"average_price": 42.42,
"valid_until": 1599746400
}
]
}

get
RETRIEVE an Order

https://api.lemon.markets/rest/v1/accounts/{account_uuid}/orders/{order_uuid}/
Get details about a single order.
Request
Response
Request
Path Parameters
order_uuid
required
string
UUID of the order (see step above or get the UUID after creating your order)
account_uuid
required
string
UUID of your account (see accounts section)
Headers
Authorization
required
string
Token {TOKEN_KEY}
Response
200: OK
There are more fields on the GET endpoint: - processed_quantity (can be less than "quantity" e.g. due to a partial execution) - processed_at (date on which the order was executed) - average_price (due to partial execution, the execution price might vary; e.g. buy 3 stocks for 43€ and 3 stocks for 42€, the execution price would be 42.50€)
{
"quantity": 5,
"limit_price": 42.42,
"type": "limit",
"side": "buy",
"status": "executed",
"instrument": {
"title": "Daimler AG",
"isin": "DE0007100000",
"wkn": "710000"
},
"created_at": 1598958661,
"processed_at": 1599213600,
"processed_quantity": 5,
"uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"average_price": 42.42,
"valid_until": 1599746400
}