Placing your first order with the Trading API

blog photo
Marius SprengerDecember 30, 2021
Trading offers a simple API that allows you to create your own brokerage experience at the stock market. An important part of that is the possibility to place orders with one simple API call. In this blog post, I will walk you through the steps you need to take to place and activate an order with the Trading API. Ready, set, go 🏃👩‍💻

Title Card for "Placing your first order with the Trading API"

Getting access

Start by signing up on our Dashboard. After you verified your account, you can log in and use the first API Key that we already created for you by default. After that, you are ready to place your first order.

Place your first order

To place an order with, you need to address the trading API by making a POST request against the base URL and add /orders/ to it:


Make sure to specify your order through your request body. 

Some of the parameters in there are required (isin to specify the instrument you want to buy, expires_at to define when the order expires, side to either buy or sell, quantity to specify how many shares you wish to buy, venue to address a specific trading venue). 

Others are optional (stop_price to place a stop market order, limit_price for a limit order, or both for a stop limit order, or notes if you want to add some notes with your order so you later know why you placed it in the first place). 

See an example request in Python below. You can check out our documentation for additional code snippets in JavaScript and more detailed explanations on different request parameters. 

1import requests
2import json
3request ="",
4          data=json.dumps({
5              "isin": "US19260Q1076",
6              "expires_at": "2021-11-25",
7              "side": "buy",
8              "stop_price": 5000000,
9              "limit_price": 5300000,
10              "quantity": 1,
11              "venue": "XMUN",
12              "notes": "I want to attach a note to this order"
13            }), headers={"Authorization": "Bearer YOUR-API-KEY"})

Place your order

Dealing with the API Response

When you successfully placed your order, the API responds with a 

2"status": "ok"

and outputs some additional response elements. For instance, you learn about the estimated_price or the regulatory information associated to your order. And you receive the order_id, which is crucial for the next (and final) step before your order can get executed. 

Activating an Order

Before we route your order to a trading venue, you first need to activate it. You can do this through the following endpoint:


See now why it is crucial that the POST request against the /orders/ endpoint returns the order_id? Using the ID, we can activate the order through:

1import requests
2import json
3request ="{order_id}/activate/",
4            headers={"Authorization": "Bearer YOUR-API-KEY"})

Activate an order through its order_id

On success, the order is activated and routed to the specified trading venue. You can now sit back and relax — your work here is done (for now). 

Retrieving your Orders

You can retrieve all your orders by posting a GET request against the /orders/ endpoint:


To specify your request, you can add Query Parameters to your request:

  • from & to: you can define a time range from which you want to retrieve orders
  • isin: add this query parameter to only see orders related to a specific isin
  • side: query parameter to see only buy or sell orders
  • status: filter for order status, e.g. inactive or executed
  • type: filter for different types of orders: market, stop, limit, stop_limit

See the example request below to learn how to use the query parameters in your request. In the example, we only want to see Tesla buy orders, therefore using the isin and side query parameters:

1import requests
2import json
3request ="{order_id}/activate/",
4            headers={"Authorization": "Bearer YOUR-API-KEY"})

Ideas for Inspiration

You now know how to place an order with the Trading API. Now: what to do with it? There are plenty of use cases. Think of the order placement as the final step in your awesome trading project. You have an automated trading strategies that buys stocks based on predefined criteria? Great, the order endpoint is triggered when a certain threshold in your algo is crossed. You built your own trading app to buy and sell stocks? Great, whenever you click the buy/sell button in your application, you will need the POST /orders/ endpoint. What are your additional ideas for how to use the /orders/ endpoint? Let us know 🙂

I hope you got a good understanding of one of our most crucial API endpoints. If you have any questions or want to get in touch with other liked-minded developers: join our growing Slack community and discuss your newest trading project idea. And for more inspiration: check out our other blog articles

Excited to see what you are building with us 😍

Marius from 🍋.markets

You might also be interested in

blog photo

Blog 38 - The market maker explained

Market Makers are crucial to provide liquidity to stock exchanges. In this blog post, we talk about what Market Makers do and why they are useful.

blog photo

5 (+1) YouTube channels for FinTech enthusiasts 

YouTube is a great way to learn about new things, including financial education or coding. Therefore, in this article we’d like to introduce you to 5 YouTube channels to level up your trading literacy.

blog photo

A short introduction to derivatives

In this article, we'd like to introduce you derivatives - they come up in finance and leave a lot of people scratching their heads, though it's totally worth it! Curious about hearing what's the difference between investing and trading, the coherence between finance and weather & why the Greeks even appear here? We'll discuss who’s using them, what they are and how they can be valued in the following.

Dive Deeper

Find more resources to get started easily

Check out our documentation to find out more about our API structure, different endpoints and specific use cases.


Join community

Join our Slack channel to actively participate in our community, ask questions to other users and stay up to date at all times.


Interested in building with us?

We are always looking for great additions to our team that help us build a brokerage infrastructure for the 21st century.

Need any help?
Ask a question in our CommunityAsk a question in our CommunityGet started with our DocumentationGet started with our DocumentationGet inspired on our BlogGet inspired on our Blog
© 2021Privacy PolicyImprint
All systems normal

As a tied agent under § 3 Sec. 2 WplG on the account and under the liability of DonauCapital Wertpapier GmbH, Passauer Str. 5, 94161 Ruderting (short: DonauCapital), GmbH offers you the receipt and transmission of orders for clients (§ 2 Sec. 2 Nr. 3 WpIG) of financial instruments according to § 3 Sec. 5 WpIG as well as brokerage of accounts.