Exploring the lemon.markets instruments endpoint


blog photo
Joanne SnelJanuary 13, 2022
Trading


At lemon.markets, we’re empowering developers to take brokerage into their own hands by building Europe’s first trading API. In today’s article, we want to showcase one of the useful endpoints we provide: /instruments. It can be used to identify the various financial instruments that can be traded on lemon.markets, such as stocks and ETFs. 

Title Card for "Exploring the lemon.markets instruments endpoint"

The lemon.markets API currently offers 8250+ popular stocks and ETFs — we’ve got (most 😉) big-name instruments. Not sure if we carry a particular listing? You can easily use the /instruments endpoint to search for specific financial instruments. Want to see how it’s done? Let’s jump right in.

Why search for my financial instrument? 🔎

If you already know the name of the financial instrument you wish to trade, why should you use the /instruments endpoint? Our API identifies financial instruments through an ISIN (International Securities Identification Number). If you know the ISIN of the instrument you wish to trade, you’re ready to place your order! But, if you don’t, you can use this endpoint to find the ISIN associated with that instrument.

Besides the ISIN, the /instruments endpoint also provides information about:

  • the exchange the instrument is listed on,
  • the symbol, WKN and title associated with the instrument, 
  • the type of instrument you’re dealing with (stock/ETF/etc.),
  • in which currency the instrument is traded and
  • whether it’s currently tradable.

This information allows you to double-check that you’re referring to the correct instrument, on the correct exchange, in the correct currency. Additionally, only placing orders if the instrument is currently tradable (and the exchange on which it’s traded is open), will ensure that you have no surprise unexecuted orders. 

The /instruments endpoint🎺

To access the /instruments endpoint, you’ll need to use the following URL:

1https://data.lemon.markets/v1/instruments/

In Python, a GET request using this URL looks as follows (note: we have sample code snippets in JavaScript in our docs):

1import requests
2response = requests.get("https://data.lemon.markets/v1/instruments/", 
3                        headers={"Authorization": f"Bearer YOUR-API-KEY"})
4print(response.json())

If you’d like to use this code snippet, you’ll have to insert your own API key.

Without any search specifications, this endpoint will return all of the instruments that can be traded with the lemon.markets API (only a very short portion of the response is listed). Perhaps this is useful if you’re simply browsing what we have on offer. But, what if you’re looking for something specific?

Specifying your search ➡️

Imagine you’re looking for the ISIN that belongs to Coinbase. How do we alter the search? There’s a number of query parameters that can be added to the end of the URL. These are:

  • search, search query for a name, title, ISIN, WKN or symbol (note: your query must be longer than 4 characters),
  • isin, if you know the ISIN of the instrument you’re looking for (you can specify up to 10 different ISINs if you’re looking for more than one),
  • mic, the Market Identifier Code of the exchange you wish to trade on, 
  • currency, ISO currency code for the currency in which you’d like to trade and
  • tradable, a boolean value to filter for tradable and non-tradable instruments.

Besides that, if your API result contains several entries, you can paginate through the response using the pagination parameters limit and page. If you’d like to learn more, you can find the details here

In our case, we’re interested in specifying search because we know the title of the instrument we’re looking for. And let’s specify tradable because we only wish to return instruments that can be traded. This means the URL against which we place the request turns into:

1https://data.lemon.markets/v1/instruments/?search=coinbase&tradable=true

The request is placed in the same way as in the above code sample. The API outputs the following response:

1{
2    "results": [
3        {
4            "isin": "US19260Q1076",
5            "wkn": "A2QP7J",
6            "name": "COINBASE GLB.CL.A -,00001",
7            "title": "COINBASE GLOBAL INC.",
8            "symbol": "1QZ",
9            "type": "stock",
10            "venues": [
11                {
12                    "name": "Börse München - Gettex",
13                    "title": "Gettex",
14                    "mic": "XMUN",
15                    "is_open": true,
16                    "tradable": true,
17                    "currency": "EUR"
18                }
19            ]
20        }
21    ],
22    "previous": null,
23    "next": null,
24    "total": 1,
25    "page": 1,
26    "pages": 1
27}

Note that the results list now only contains one instrument because we specified our query with enough detail to narrow down the search. We can now use this ISIN to place trades with the Trading API

That’s all there is to know about the /instruments endpoint! We hope it was helpful in exploring what can be done with lemon.markets. If you’re not yet signed-up, join us today! 

Joanne 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.

Engage

Join lemon.markets community

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

Contribute

Interested in building lemon.markets 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
© lemon.markets 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), lemon.markets 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.