Using the lemon.markets Postman workspace đŽ
An easy way to test out the lemon.markets API is by using Postman, a platform that allows you to make API calls right within your browser or desktop app. This way, before you get to building your brokerage product, youâll know exactly whatâs possible. Weâve set up a lemon.markets Postman workspace that can be used to familiarise yourself with the endpoints that we offer in our Market Data and Trading APIs. Youâll see just how simple it is to, for example, place a trade with lemon.markets (hint: itâs just one API call).
Why Postman? đŻ
Postman is an easy-to-use application that allows you to test out an API without having to manually set up a testing environment. Itâs as simple as filling in a request URL, providing the proper authorisation and inputting the relevant query/request body parameters. Luckily for you, weâve already set up a lemon.markets Postman workspace with all requests included, all you need to do is fork it, fill in your API key and start sending requests.
Using Postman đ¨Â
The lemon.markets Postman workspace can be found here. For personal use, you need to import the workspace into your own Postman account. Letâs see how thatâs done!
Forking the workspace đ´
Weâre assuming you already have a Postman account, but if you donât, you can easily set one up, here. Because the workspace is public, you need to fork it into your own workspace to be able to send requests
To fork our workspace, click the ââŚâ next to the collection of your choice and select âCreate a forkâ.
Youâll be prompted to give the fork a name and select a workspace to copy it into. You can choose to create a separate lemon.markets workspace, or simply copy it into the default âMy Workspaceâ.Â
To make requests, youâll need to set up several environment variablesâââweâve also set up a template for this (which you can also fork in the same way).
The environment templates can be found under the conveniently named âEnvironmentsâ tab on the left-hand side.
Youâll notice that weâve provided a template for Paper Money Trading and Real Money Trading, select the one that suits your needs. Make sure that you fork the environment into the same workspace as your forked collection.Â
Configuring the environment đłÂ
To set-up your environment, youâll want to fill in your lemon.markets API key(this can be found on your dashboard). Because your workspace is only accessible to you, it doesnât matter whether you fill it in under âInitial Valueâ or âCurrent Valueâ, but as a best practice, you should always fill in sensitive information under âCurrent Valueâ. This prevents the information from being synced with the Postman workspace (especially important if youâre working in a (semi-)public workspace).
Youâll know youâre in your forked workspace due to the Ψ next to the environment nameââânotice Iâve called my fork âlemon_tutorialâ.
Make sure you save any changes (upper right-hand corner) and set the environment active, you can do this by hovering over its name and clicking the check-mark, which should become grey upon success.Â
If youâve properly set up your API key and environment, the environment should appear in the upper right-hand corner (as can be seen in the screenshot below). Additionally, if you navigate to the authorisation tab for either Collection, hovering over {{API-KEY}} should display the key youâve filled in.Â
If you canât see your API key upon hovering, ensure that your environment has been saved and set active (you might need to manually select it in the upper right-hand corner if you have more than one environment).
Making your first request â
Letâs begin by searching for a stock â for example, Coinbase. Navigate to the âInstrumentsâ folder in the Historical Market Data API collection. Here, you have the option to retrieve an instrument with its ISIN, MIC or simply with its title.
The API response can be found in the console below after clicking the blue âSendâ button. In the screenshot, we can see that, on the Munich Stock Exchange, the ticker for Coinbase is 1QZ.
You can also specify other query parameters in your request. In this case, you can choose to retrieve an instrument based on its type, what currency it is listed in and/or whether it is currently tradable. All you need to do is toggle the parameter key, fill in a value and run the request again. More on that in the next section. đ
Other important considerations đ¤
To get the most of the lemon.markets workspace, we recommend you read the following tips:
Some endpoints, for example the /ohlc/ endpoint in our Historical Market Data API, have mandatory query parameters. For all query parameters that are required, weâve configured the workspace to automatically toggle that parameter (indicated by the checked box). But, whether it is optional or required can also be found in the key-value description. In addition, some requests also require path variables as input â these are listed below any query parameters (they can also be recognised in the request URL by a â:â). If specified, these are always required.
Note that âisinâ is the only required query parameter for this endpoint, we also need to specify the path variable âx1â in order to send this request.
Other endpoints require a request body, youâll recognise this by the green dots next to the headers underneath the request URL. For example, for the /orders/ endpoint in our Trading API, youâll notice the green dot next to âBodyâ, this means that we need to fill in information here. Notice that thereâs a lot of required variables here! Iâve filled in some example values below.
In the above screenshot, youâll see I placed a buy order for 2 shares of Coinbase.
All other requests follow a similar formatâââsome require you to fill in both âParamsâ and âBodyâ variables. Keep an eye out for those green dots!
Youâre ready to explore on your own! How about you try placing and activating a trade? And then having a look at your position? Have a look at our documentation to see whatâs possible.Â
Over to you! đ¤
We want to know how we can make this collection better! If thereâs any improvements that come to mind, do not hesitate to reach out to us through Twitter, Instagram or Slack. And remember, if you havenât signed up to lemon.markets yet, do that now to kickstart your automated trading journey.Â
Joanne from lemon.marketsđ
You might also be interested in
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.
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.
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.
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 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.
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.