How Trading Strategy Built a Data Stack for Crypto Quant Trading

How Trading Strategy Built a Data Stack for Crypto Quant Trading

This is an installment of our “Community Member Spotlight” series, where we invite TimescaleDB community members to share their work, shining a light on their success and inspiring others with new ways to use technology to solve problems.


In this edition, Mikko Ohtamaa, CEO at Trading Strategy, joins us to share how they give traders and investors direct access to high-quality trading strategies and real-time control over their assets by integrating market data about thousands of crypto assets, algorithms, profitability simulation, and more into one solution. Thanks to TimescaleDB, they can focus on solving business problems without a need to build the infrastructure layer.

Trading Strategy is a protocol for algorithmic trading of crypto-assets in decentralized markets. Cryptocurrency traders and strategy developers can utilize the protocol to easily access and trade on next-generation markets with sophisticated tools that have been traditionally available only for hedge funds.

Users don’t need to have a deep understanding of blockchain technology, as the Trading Strategy protocol is designed to make a complex topic easier to understand and approach. This is accomplished by integrating market data feeds for thousands of crypto assets, algorithm development, profitability simulation, trade execution, and smart contract-based treasury management tools into one vertically integrated package.

About the team


My name is Mikko Ohtamaa. I am the CEO of Trading Strategy. I have been a software developer for 25 years. For the last decade, I have been CTO of various cryptocurrency and fintech companies. I am also one of the first Ethereum Dapp developers and Solidity smart contract auditors.

Trading Strategy is a remote-first company with five people. We have offices in London and Gibraltar. We use a combination of remote working tools (Discord, Github, Google Workspace) and more intense get-together sprint weeks to manage the software development.

As our work is highly technical, all team members have backgrounds in software development, quantitative finance, or blockchain technologies.

About the project

Trading Strategy operates on market data feeds, for which raw data is collected directly from the blockchains. Most market data is heavily time-series, though there are also elements of product catalog features like different trading pairs, tokens, and exchanges. Because of the powerful combination of PostgreSQL and TimescaleDB, we can store the data in a single database, making it simple for software developers to build on top of this and this, in turn, saves us a lot of software development costs.

We have two kinds of workloads: historical datasets, that are challenging sizewise, and real-time data feeds for algorithms that are challenging latency-wise. TimescaleDB offers vertical scaling as a data lake,  but also offers continuous real-time aggregations for time-series data, making it a good fit for real-time needs.

Editor’s Note: We’ve put together resources about TimescaleDB’s continuous aggregates to help you get started.


Data from TimescaleDB is feeding both on our market information website and feeds, but also on the trading algorithms themselves, which make the trading decisions based on the data input. Our applications include OHLCV, or so-called candle charts, market summaries information like daily top trades and liquidity, and risk information for technical trade analysis.

Collage of screenshots of candle charts, market summaries information like top trades, trades with the most loss, liquidity chart and more
Collage of charts from Trading Strategy website

Choosing (and using!) TimescaleDB

PostgreSQL has been the open-source workhorse of databases for the last three decades and offers the most well-known, solid, foundation to build your business on.

We chose TimescaleDB over other time-series databases because of its solid PostgreSQL foundation, easy, out-of-the-box functionality, and true open-source nature with an active TimescaleDB community.

Moreover, TimescaleDB comes with well-documented code examples on how to use it for stock-market chart data, allowing us to take these examples and build our first MVP based on TimescaleDB example code.

Editor’s Note: Check out our three-step tutorial to learn how to collect, store, and analyze intraday stock data.

For example, we heavily utilize the continuous aggregate view feature of TimescaleDB, to upsample our 1-minute candle data to 15 minutes, 1 hour, and daily candles. We can fully offload this work to TimescaleDB, with only a minimal 10-20 lines of SQL code describing how to upsample different columns.

Current deployment & future plans

Besides TimescaleDB, our other major components in the software development stack are Svelte/SvelteKit web frontend framework and Python, Pyramid, and SQLAlchemy backend.

I invite everyone evaluating TimescaleDB to read our blog post about our software architecture.

The architecture diagram of Trading Strategy solution.
The current architecture diagram

At the moment, we have trading data from 1000 decentralised exchanges (aka dexes), from three blockchains (Ethereum, Polygon and Binance Smart Chain), featuring 800k trading pairs. For reference, NASDAQ has only 3000 trading pairs, giving a reference point for the massive diversity of blockchain and cryptocurrency markets! Currently, we are fitting everything on one 1 TB database, but we are still early on what kind of data points we collect. We expect the database to grow dozens of terabytes over the next year.

The architecture diagram of Trading Strategy solution.
Architecture diagram of trading data sources

Trading Strategy is completing its seed round. So far, the team has been lean. We expect to start growing as a business now, as our business is finding a product-market fit. We are looking to launch user-accessible trading strategies later this year, as soon as we are confident the software stack is well-behaving and related smart contracts are secure.

We are at the bleeding edge of blockchain technology. Many of the components we built and many of the problems we solve we do as the first in the world. TimescaleDB allows us to focus on solving these business problems without us needing to build the infrastructure layer ourselves.

🗯️
If you are interested in crypto trading strategies, please come to ask any questions in our public Discord chat.

Advice & resources

If you are generally interested in algorithmic trading and machine-based solutions on financial markets, please read our announcement blog post to learn about our vision for decentralised finance and decentralised protocol.

Trading Strategy contributes heavily to open source. You can study our Trading Strategy Python client and our 100% open source SvelteKit frontend.

If you have software development questions or questions about trading strategies, please come to ask any questions in our public Discord chat.

We also love coffee brewing tips shared by the TimescaleDB. Due to increased brewing activity, our team is now 150% caffeinated.

We’d like to thank Mikko and the entire Trading Strategy team for sharing their story! We applaud your effort to give access to high-quality trading strategies to users around the world.

We’re always keen to feature new community projects and stories on our blog. If you have a story or project you’d like to share, reach out on Slack (@Lucie Šimečková), and we’ll go from there.

The open-source relational database for time-series and analytics.
Try Timescale for free
This post was written by
5 min read
Blog
Contributors

Related posts