Getting started on lemon.markets — the API infrastructure powering algorithmic trading

Marius Sprenger
5 min readNov 5, 2020

Hi, we are lemon.markets, a startup that is building an API for stock trading. In this blog post we’d like to elaborate on why we think that our approach can help start a new generation of trading in Europe.

Why we like our idea of an automated trading infrastructure

Think about the way you as a private person are investing in the stock market right now. We think we assume correctly if we say that in most cases there is almost no automation involved. You might have a brokerage account at your local bank or use one of the many available trading apps. Sometimes you win, sometimes you lose, but in all cases a lot of time goes into choosing the right stock, reading financial news, monitoring all developments in the world. Or (even worse) you buy stocks based on vague assumptions or completely uninformed. All of the scenarios above led us to the following question:

Wouldn’t it be great if there was an infrastructure in place that enables automated and algorithmic trading so you can regularly execute your orders based on predefined rules that save you time and make your decision process better?

We think so.

Hundreds of thousands of developers in Europe have the technological abilities to build something great, and the number is increasing every day. However, there is no infrastructure in place that would allow them to automate their trading strategies in a pleasant and convenient way.

And that was pretty much the starting point and idea for lemon.markets: creating an infrastructure that allows all of these things — from developers for developers. Simple to use, accompanied by an easy-to-understand documentation, a vivid exchange between us and the users, a platform that is shaped by the developer’s needs and thereby adjusted along the way. While our initial product focuses on trading algorithms developed by individual developers, the long-term vision of lemon.markets is to create an infrastructure that allows to build all kinds of things: your own trading app for your phone, a transparent robo advisor that anyone can use, an educational web app, with which young students can learn to understand the stock market, a trading tool for your favourite messaging app, you name it.

After months of work, we are now one step closer to our goal, as we launched our open beta last month and are now excited about every new user. The goal of our beta is easily explained: find out if other people agree with our idea and generate as much feedback as possible.

What do I have to do to use lemon.markets?

The answer might surprise you: sign up 💡😃

After you activate your account, we create your demo account and transfer 10,000 € to it (Sadly, this is only paper money. Disappointing, we know). You then are pretty much ready to go.

To access our API endpoints, you need an access token. You can create one on our Auth & Strategies page. As we are very keen to learn about what you do, what works and what doesn’t, we attach a strategy to every access token, so we can measure how it performs. Don’t worry, we cannot see what your code looks like, we simply calculate the performance in- or decrease since the beginning (and might contact you if your strategy performs like crazy to share your secret with the rest of us 😉).

Using the newly-generated access token, you can now start using our API. If you’re a Python fan, check out our recently released Python SDK. It makes things a lot easier, as you can now access API functionalities more conveniently.

So, what is the most important feature of a trading infrastructure? Correct, placing an order. With our SDK, this should be fast and straightforward. Import the Token and Order class and define a function create_order(). Simply paste your access token into the placeholder in line 9 and access the account related to it. You can then very easily define an order and authenticate it using your account. Assign an ISIN of your choice (here, we used Tesla, but you can obviously set any ISIN you want) to the “instrument” variable within the Order bracket, specify how many instances you want to buy or sell and how long you want the order to be valid. Execute the order by calling order.create().

You can do a lot more things with our Python SDK specifically and our API in general. Find out more about the SDK here and see our documentation for an in-depth description of the current API functionalities. If you prefer to use JavaScript: go to our dashboard and click “create new order” in the top-left corner to generate code for placing an order with JavaScript (we use axios, as we think that it is one of the most reliable clients to perform requests). However, as our API uses the REST standard, you can use any programming language you like. Please tell us about the language of your choice so we can continue to develop SDKs based on user preferences. If you need a little inspiration for your first trading strategy: check out this blog post where we implement a mean reversion strategy in Python.

For now, there is not much left to say, other than the fact that lemon.markets is supposed to be based on a vivid community and active feedback, no matter how cruel it might be. We are learning every day and would like you to be a part of that. Send us a message to info@lemon.markets, fill out a short survey or join our growing Slack community. Let us know what you think, what you would improve, ideas on new features, experiences you’ve had, tell us about a successful (or not successful) strategy that you built or a bug that you found.

See you on lemon.markets soon.

Max, Marcel & Marius 🍋

--

--

Marius Sprenger

Half building lemon.markets, half PhD student focusing on the intersection between sports and technology. Interested in movies, sports and (surprise) technology