Trading / Account

Your Account

We are in open beta

Everything related to lemon.markets is still very much work in progress. Please bear with us that some things are still a bit buggy or functionality is missing. We are really grateful if you share your feedback on Slack as this helps make lemon.markets a product we all want to use. Thank you :)

In your account, all important information about yourself are stored. Based on your account, you can, among others, deposit money to (new) spaces, withdraw money to your reference account or access all your tax-related information. Find more specific information below.

You can retrieve all your account information by using the following request URLs:

https://paper-trading.lemon.markets/v1/account/

or

https://trading.lemon.markets/v1/account

Request

Specify your request as follows:

Header Parameters

Authorization
string
required

Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"

Response

Response Parameters

time
string

Timestamp of your API request

status
string

API returns "ok" when account was successfully retrieved.

mode
string

Environment the request was placed in: "paper" or "money"

created_at
string

Timestamp for when you created your account

account_id
string

Internal Identification number for your account

firstname
string

Your first name

lastname
string

Your last name

email
string

Your email address

phone
string

Your phone number

address
string

Your address

billing_address
string

The billing address provided for the account

billing_email
string

The billing email address provided for the account

billing_name
string

The billing name provided for the account

billing_vat
string

The billing VAT number provided for the account

mode
string

The API mode you are currently in - paper or money

deposit_id
string

Identification Number of your securities account

client_id
string

The internal client identification number related to the account

account_number
string

The account reference number

iban_brokerage
string

IBAN of the brokerage account at our partner bank. This is the IBAN you can transfer money from your referrence account to.

iban_origin
string

IBAN of the reference account. You define your reference account as part of the onboarding. You can use your reference account to transfer money to your brokerage acount. You can also withdraw money from your brokerage account to your reference account.

bank_name_origin
string

Bank name your reference account is located at

balance
int

Your balance is the money you transferred to your account + the combined profits or losses from your orders.

cash_to_invest
int

How much cash you have left to invest. Your balance minus the sum of orders that were activated but not executed, yet.

cash_to_withdraw
int

How much cash you have in your account to withdraw to your reference account. Calculated through your last reported balance minus the current sum of buy orders. Please note that orders from the past 2 days cannot be considered for your cash to withdraw.

trading_plan
string

We offer (or will offer) different subscription plans for trading with lemon.markets. This endpoint tells you which plan you are currently on - free, basic or pro.

data_plan
string

We offer (or will offer) different subscription plans for retrieving market data with lemon.markets. This endpoint tells you which plan you are currently on - free, basic or pro.

tax_allowance
int

Your tax tax allowance - between 0 and 801 €, as specified in your onboarding process

tax_allowance_start
string

Relevant start date for your tax allowance (usually 01/01/ of respective year)

tax_allowance_end
string

Relevant end date for your tax allowance (usually 31/12/ of respective year)

Request

1import requests
2import json
3
4request = requests.get("https://paper-trading.lemon.markets/v1/account/", headers={"Authorization": "Bearer YOUR-API-KEY"})
5print(request.json())
6      

Response

1{
2  "time": "2021-11-22T15:37:56.520+00:00",
3  "status": "ok",
4  "mode":"paper",
5  "results": {
6    "created_at": "2021-10-12T10:29:49.769+00:00",
7    "account_id": "acc_pyNQNll99hQbXMCS0dRzHyKQCRKYHpy3zg",
8    "firstname": "Michael",
9    "lastname": "Burry",
10    "email": "m_burry@tradingapi.com",
11    "phone": "+491637876521",
12    "address": "Ritterstraße 2A 10969 Berlin",
13    "billing_address": "Ritterstraße 2A 10969 Berlin",
14    "billing_email": "m_burry@tradingapi.com",
15    "billing_name": "Michael Burry",
16    "billing_vat": "DE999999999",
17    "mode": "money",
18    "deposit_id": "K2057263187",
19    "client_id": "2057263",
20    "account_number": "2057263187",
21    "iban_brokerage": "DE12345678902057263",
22    "iban_origin": "DE123456789012345",
23    "bank_name_origin": "Test Bank",
24    "balance": 100000000,
25    "cash_to_invest": 80000000,
26    "cash_to_withdraw": 20000000,
27    "trading_plan": "basic",
28    "data_plan": "basic",
29    "tax_allowance": 8010000,
30    "tax_allowance_start": "2021-01-01",
31    "tax_allowance_end": "2021-01-01"
32  }
33}
34  

You can conveniently manage all withdrawals from your brokerage to your reference account with two simple API endpoints.

To withdraw money to your reference account, use the following request URLs:

https://paper-trading.lemon.markets/v1/account/withdrawals/

or

https://trading.lemon.markets/v1/account/withdrawals/

Withdrawing Paper Money

One of our core principles is to have an identical structure for the Real Money and Paper Money API. Therefore, this endpoint also works in Paper Money (does not throw an error message), but obviously does not transfer any actual money to your reference account. 😉


Request

Specify your request as follows:

Header Parameters

Authorization
string
required

Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"

Request Body

You can send your request using the following content-types:

  • application/json
  • application/x-www-form-urlencoded

Request Body Parameters

amount
int
required

Amount you wish to withdraw.
Please see here for information on the numbers format in the Trading API.

pin
int
required

The personal verification PIN you set during the onboarding

idempotency
string

Your own unique idempotency key that prevents duplicate operations

Response

Response Parameters

time
string

Timestamp of your request

status
string

API returns "ok" when money was successfully withdrawn.

mode
string

Environment the request was placed in: "paper" or "money"

Request

1import requests
2import json
3
4request = requests.post("https://paper-trading.lemon.markets/v1/account/withdrawals/",
5          data=json.dumps({
6               amount: 5000000,
7               pin: 1234
8            }), headers={"Authorization": "Bearer YOUR-API-KEY"})
9print(request.json())
10      

Response

1{
2  "time": "2021-11-22T15:37:56.520+00:00",
3  "mode":"paper",
4  "status": "ok"
5}
6  

Additionally, you can retrieve a list of all your withdrawals. Use the following request URLs to do so:

https://paper-trading.lemon.markets/v1/account/withdrawals/

or

https://trading.lemon.markets/v1/account/withdrawals/

Request

Specify your request as follows:

Header Parameters

Authorization
string
required

Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"

Query Parameters

limit
int
optional

Required for Pagination. Limit of displayed results on one page

page
int
optional

Required for Pagination. Results page you wish to display

Response

Response Parameters

time
string

Timestamp of your response

status
string

Shows status "ok" when withdrawals were successfully retrieved

mode
string

Environment the request was placed in: "paper" or "money"

id
string

Identification Number of withdrawlas

amount
string

Amount of withdrawal

created_at
string

Timestamp at which you created the withdrawal

data
string

Timestamp at which withdrawal was processed by partner bank

idempotency
string

Your own unique idempotency key that prevents duplicate operations

previous
string

Pagination: previous page

next
string

Pagination: next page

total
int

Pagination: total number of results

page
int

Pagination: current page

pages
int

Pagination: total number of pages

Request

1import requests
2import json
3
4request = requests.get("https://paper-trading.lemon.markets/v1/account/withdrawals/", headers={"Authorization": "Bearer YOUR-API-KEY"})
5print(request.json())
6      

Response

1{
2  "time": "2021-12-15T11:21:21.023+00:00"
3  "status": "ok",
4  "mode":"paper",
5  "results": [
6    {
7      "id": "wtd_pyQTPbbLLMNBQTM0mzkK7Ygb8kH60Ff10X",
8      "amount": 1000000,
9      "created_at": "2021-12-15T11:21:05.853+00:00",
10      "date": "2021-12-15T25:12:02.765+00:00",
11      "idempotency": "1234abcd"
12    },
13    {
14      ...
15    }
16  ]
17  "previous": "https://paper-trading.lemon.markets/v1/account/withdrawals/?limit=20&page=1",
18  "next": "https://paper-trading.lemon.markets/v1/account/withdrawals/?limit=2&page=3",
19  "total": 80,
20  "page": 2,
21  "pages": 4
22}
23  

Through our /bankstatements endpoint you can conveniently retrieve all activities on your brokerage account. The endpoint returns each bank statement in a separate object. A bank statement can be, for example, when you transferred money from/into your reference account, bought or sold a stock or when you got paid a dividend. Additionally, you always get an end of day balance that informs you about your account balance. Find out how to use the endpoint below.

Per default, the API returns a list of objects containing all activities from your last “active day” (in the paper money environment) and all activities from the last working day (in the real money environment), where, by default, an end of day balance is created for you. Using query parameters "from" and "to", you can retrieve bank statements for a custom set period.

https://paper-trading.lemon.markets/v1/account/bankstatements/

or

https://trading.lemon.markets/v1/account/bankstatements/

Request

Specify your request as follows:

Header Parameters

Authorization
string
required

Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"

Query Parameters

type
string
optional

Filter for different types of bank statements: pay_in, pay_out, order_buy, order_sell, eod_balance, dividend

from
string
optional

Filter for bank statements after a specific date. Format: "YYYY-MM-DD".

to
string
optional

Filter for bank statements until a specific date. Format: "YYYY-MM-DD".

limit
int
optional

Required for Pagination. Limit of displayed results on one page

page
int
optional

Required for Pagination. Results page you wish to display

Response

Response Parameters

time
string

Timestamp of your response

status
string

Shows status "ok" when bank statements were successfully retrieved

mode
string

Environment the request was placed in: "paper" or "money"

id
string
required

Identification Number of bank statement

account_id
string
required

Identification Number of account the bank statement is related to

type
string
required

Type of bank statement: pay_in, pay_out, order_buy, order_sell, eod_balance, dividend

date
string
required

Date of bank statement (YYYY-MM-DD)

amount
int
required

The amount associated to the bank statement

isin
string
required

Related International Securities Identification Number (ISIN). Only for type order_buy and order_sell, otherwise null

isin_title
string
required

Title of related International Securities Identification Number (ISIN). Only for type order_buy and order_sell, otherwise null

created_at
string
required

Exact timestamp the bank statement was created

previous
string

Pagination: previous page

next
string

Pagination: next page

total
int

Pagination: total number of results

page
int

Pagination: current page

pages
int

Pagination: total number of pages

Request

1import requests
2import json
3
4request = requests.get("https://paper-trading.lemon.markets/v1/account/bankstatements/?type=order_buy", headers={"Authorization": "Bearer YOUR-API-KEY"})
5print(request.json())
6      

Response

1{
2  "time": "2021-11-22T15:41:04.028+00:00"
3  "status": "ok",
4  "mode":"paper"
5  "results": [
6    {
7      "id": "bst_pyQKKTTSS0Q2drg2J7yRhTwBkMPd1JgZzZ",
8      "account_id": "acc_pyNQNll99hQbXMCS0dRzHyKQCRKYHpy3zg",
9      "type": "order_buy",
10      "date": "2021-12-16",
11      "amount": 100000,
12      "isin": "US19260Q1076",
13      "isin_title": "COINBASE GLOBAL INC.",
14      "created_at": "2021-12-17T01:37:03.362+00:00"
15    },
16    {
17      ...
18    }
19  ]
20  "previous": "https://paper-trading.lemon.markets/v1/account/bankstatements/?limit=20&page=1",
21  "next": "https://paper-trading.lemon.markets/v1/account/bankstatements/?limit=2&page=3",
22  "total": 80,
23  "page": 2,
24  "pages": 4
25}
26  

Not all available documents are included, yet

We currently offer you the possibility to retrieve a number of documents related to your account, like:

  • Account Opening Document
  • Tax Exemption

However, there are some additional documents that are not included, yet, but that we will provide in the future (probabaly sometime in Q1 2022), like account statements and securities settlement. Stay tuned and thank you for your patience :)

Use these endpoints to retrieve your available documents and receive them via API response:

https://paper-trading.lemon.markets/v1/account/documents/

or

https://trading.lemon.markets/v1/account/documents/

Request

Specify your request as follows:

Header Parameters

Authorization
string
required

Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"

Response

Response Parameters

time
string

Timestamp of request

mode
string

Environment the request was placed in: "paper" or "money"

status
string

API returns "ok" when documents were successfully retrieved

id
string

Document ID

name
string

Document Name

created_at
string

Timestamp at which Document was created

category
string

Document Category

public_url
string

Public URL of Document

link
string

Link to Document PDF Download

viewed_first_at
string

Timestamp at which Document was first viewed (downloaded)

viewed_last_at
string

Timestamp at which Document was last viewed (downloaded)

Request

1import requests
2import json
3
4request = requests.get("https://paper-trading.lemon.markets/v1/account/documents/", headers={"Authorization": "Bearer YOUR-API-KEY"})
5print(request.json())
6      

Response

1{
2  "time": "2021-11-22T15:41:04.028+00:00",
3  "mode":"paper",
4  "status": "ok",
5  "results": [
6    {
7      "id": "doc_pyNjNcc77ht3T3lH8dJa5fD8jhj2JHJ1xX",
8      "name": "account_opening.pdf",
9      "created_at": "2021-10-19T14:58:52.813Z",
10      "category": "kyc",
11      "public_url": "http://testpublicurl.de/",
12      "link": "'https://trading.lemon.markets/v1/account/documents/doc_pyNjNcc77ht3T3lH8dJa5fD8jhj2JHJ1xX",
13      "viewed_first_at": "2021-10-19T14:58:52.813Z",
14      "viewed_last_at": "2021-10-19T14:58:52.813Z"
15    }
16  ]
17}
18  

This endpoint is a Download redirect

If you call this endpoint, you are being redirected to a PDF download that contains the document you specified in the request URL.

Using these endpoints you can initiate a PDF download of a specific document:

https://paper-trading.lemon.markets/v1/account/documents/{document_id}/

or

https://trading.lemon.markets/v1/account/documents/{document_id}/

Request

Specify your request as follows:

Path Parameters

document_id
string
required

ID of document you want to download

Header Parameters

Authorization
string
required

Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"

Request

1import requests
2import json
3
4request = requests.get("https://paper-trading.lemon.markets/v1/account/documents/{document_id}/", headers={"Authorization": "Bearer YOUR-API-KEY"})
5print(request.json())
6