How to access your Trading API Account with one API call

16. Dezember 2021

We at provide the infrastructure so everyone can build their own brokerage experience at the stock market. In this blog post, we show you how to easily access your trading account information with one simple API call. Additionally, we dive a little deeper into our /account endpoint. Let us begin!

Title Card for "How to access your Trading API Account with one API call"

Signing up

The first step to accessing your account is to make sure that you actually have one. So, sign up on our dashboard and verify your account through the email that we send you after registration. You can then sign into the dashboard, where we already provide you with your first API Key. 

Afterwards, we want to actually start using the API.

The easiest way to communicate with the API is to make use of the Python SDK, which can easily be installed through:

1pip install lemon

The initial step for using the SDK (and subsequently making requests to the API) is to instantiate a client, like this:

1def __init__(self):
2        self.client = api.create(
3            market_data_api_token=os.getenv("DATA_API_KEY"),
4            trading_api_token=os.getenv("TRADING_API_KEY"),
5            env="paper"
6    )

Note that in line 3 and 4 we are accessing environment variables, which you need to create and define before that step, typically in a .env file. Here, we are using separate API Keys for market data and trading, as required by the API. You can create your Trading and Market Data API Keys in the Dashboard.

Finding your way around our API

Using that API Key, you can go ahead and start testing our API. You can find everything you need to know in our documentation. We created several endpoints concerned with everything related to your account. Using these endpoints, you can find information about your name (in case you forgot), your current balance, how much cash you have left to invest, the IBAN of your brokerage account and many many more things.

To retrieve information about your account, place a GET request against the following request URL:


Using the SDK, we can very easily do so:

1def get_account():
3  print(response)

Placing this request will result in a response similar to this one:

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

As you can see, you get a lot of information on everything related to your account, like when it was created, what your current balance is, on which trading & data plan you are on and the IBAN of your brokerage account. Make sure to check out our documentation for in-depth information on all endpoint response parameters.

Withdrawing money

As you can see in the endpoint response above, you also have a response element called cash_to_withdraw. This is your current balance minus the current sum of your buy orders. Based on that number, you can very easily withdraw money into your reference account via:


Use the following code snippet to withdraw money into your reference account:

1response =
2    amount=100000,
3    pin="1234"

Define the amount you want to withdraw in your request body, along with your individual 4-digit PIN that you set during your onboarding process. After a successful API request, the specified amount is automatically withdrawn.

Retrieving your Bank statements

Obviously, as a user you are interested in staying up to date regarding all activity that is happening on your account. That is what the /bankstatements endpoint is there for. The endpoint 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. You can access your bank statements using the following request URL (in this example, we specify the request/what type of bankstatements we want to receive in the brackets):

1# get bank statements
2response =
3    type='eod_balance',
4    from_="beginning"

This will return a response similar to the following one:

1"time": "2021-12-20T12:48:06.199+00:00",
2"status": "ok",
3"mode": "paper",
4"results": [
5        {
6            "id": "bst_pyHLSwwFFd6r9fJsNbFhxrB3sl43xCP1GK",
7            "account_id": "acc_pyNQNll11hQbXMCS0dRzHyNKLZTYHpy3zg",
8            "type": "eod_balance",
9            "date": "2021-12-16",
10            "amount": 987033450,
11            "isin": null,
12            "isin_title": null
13        },
14        {
15            "id": "bst_pyQWCwwFFrBm9NhMYJ1yYDnhnMtMs64DNT",
16            "account_id": "acc_pyNQNll11nQbXMCS0dRzHyKQCRKYHpy3zg",
17            "type": "order_buy",
18            "date": "2021-12-16",
19            "amount": 8829000,
20            "isin": "US88160R1014",
21            "isin_title": "TESLA INC."
22        }
23    ],
24"previous": null,
25"next": null,
26"total": 2,
27"page": 1,
28"pages": 1

As you can see, the last thing I did was I placed a buy order in the paper environment and an end of day balance was created for me.

Seeing some documents

Lastly, you have the chance to very easily access all important documents related to your account via the following URL:


Use the following code snippet to retrieve a list of documents:

1# get documents
2response =

This will provide you with a list similar to this one:

2  "time": "2021-11-22T15:41:04.028+00:00"
3  "status": "ok",
4  "results": [
5    {
6      "id": "doc_pyNjNcc77ht3T3lH8dJa5fD8jhj2JHJ1xX",
7      "name": "account_opening.pdf",
8      "created_at": "2021-10-19T14:58:52.813Z",
9      "category": "kyc",
10      "public_url": "",
11      "link": "'",
12      "viewed_first_at": "2021-10-19T14:58:52.813Z",
13      "viewed_last_at": "2021-10-19T14:58:52.813Z"
14    }
15  ]

In there, you find all documents, along with a download link. By clicking the link, you are redirected to a .pdf version of the file.

Alright, that was all there is to say about account endpoints and what you can do with them. Make sure tosign up to our trading API to build your own brokerage experience at the stock market. Also, join ourSlack community, where we discuss all things trading and with more than 400 developers.

Looking forward to seeing you there 🍋 🚀

Marius from

Das könnte Dich auch interessieren

blog photo

Using Time Series Forecasting to predict stock prices 🔮

In this article you will learn what time series forecasting is and how its application in finance looks like. Then you'll also dive into Facebook's Prophet Model for Time Series Forecasting and use it together with the Market Data API to forecast the development of the Tesla Stock.

blog photo

Dummies Guide to Trading with Machine Learning

Ever wonder how a trader with decades of experience on thousands of stocks and lightning fast reaction times might perform in the market? With some machine learning knowledge, you might be able to automate such a trader yourself! 💻 📈

blog photo

4 reasons why YOU should automate your trading strategy

In the current volatile market conditions, everyone is trying to find ways to minimise portfolio loss. In that context, have you ever thought about automating your trading strategy? In this article, we will dive into 4 reasons for doing so. Expect to learn how it can save you time, make your trading more efficient and lead to data-based decisions.

Tiefer eintauchen

Finde weitere Ressourcen für einen einfachen Einstieg

In unserer Dokumentation erfahrt Ihr mehr über unsere API-Struktur, die verschiedenen Endpunkte und spezifische Anwendungsfälle.


Tritt der Community bei

Tritt unserem Slack-Channel bei, um Dich aktiv an unserer Community zu beteiligen, Fragen an andere Nutzer:innen zu stellen und immer auf dem Laufenden zu bleiben.

Team unterstützen

Lust mit uns zu bauen?

Wir sind immer auf der Suche nach großartigen Ergänzungen für unser Team, die uns beim Aufbau einer Brokerage Infrastruktur für das 21. Jahrhundert helfen.

Brauchst Du Hilfe?
Stell Deine Fragen in unserer CommunityStell Deine Fragen in unserer CommunityLeg mit unserer API Dokumentation losLeg mit unserer API Dokumentation losLass Dich von unserem Blog inspirierenLass Dich von unserem Blog inspirieren
© 2022DatenschutzImpressum
Systems are down

Als vertraglich gebundener Vermittler gemäß § 3 Abs. 2 WpIG für Rechnung und unter der Haftung der DonauCapital Wertpapier GmbH, Passauer Str. 5, 94161 Ruderting (kurz: DonauCapital), bietet Dir die GmbH, die Anlagevermittlung (§ 2 Abs. 2 Nr. 3 WpIG) von Finanzinstrumenten im Sinne des § 3 Abs. 5 WpIG sowie die Vermittlung von Konten an.