Introduction to Algodab
Even though there are many tools to do algorithmic trading, I was looking for a single platform that would let me do it all: ingest asset data, visually display that data, analyze it with my code, mark up or annotate areas of interest, and finally make trading decisions. Algodab is an integrated development environment (IDE) designed from ground up to simplify the process of trading stocks and crypto with the help of algorithms. It is a scalable and extensible platform capable of supporting multiple brokers, with multiple data streams, and running multiple algorithms simultenaously.
On one end, the software connects to and manages your data provider’s services for real time quotes and potentially other financial data, and on the other end, you edit your code, design your algorithms, backtest, live test - all in one place: your own server. Your Algodab software stack installs and runs on your own machine at your from home or office.
#
Why Algodab?Like many other software engineers, I eventually took an interest in trading stock market. Crypto came in later. But I quickly realized the benefits an automated setup can provide - even if it only meant helping me with manual trading decisions. At first, I’ve created Algodab only for my own personal use. The software was very archaic and very specific to my style of trading, to my algorithms. However, over the years, it evolved into something that not only fits my needs, but I believe may fit the needs of others.
There is a number of reasons why I wanted a self-hosted system. Third-party hosted platforms already out there require uploading your secret sauce to third party servers. Yes, chances are the companies are not out to get my secret recipe, but it is about being in my own comfort zone, being in control, and not worrying about that other company’s pro-verbial rogue employee might or might not do.
Additionally, there could be limits on resources made available to you by host providers. Algodab trading platform infrastructure runs on your own servers. It is fully configurable, and gives you ability to give your hardware as much power as you want, while keeping your secrets safe.
#
Benefits of using Algodab#
Fully integrated IDEAlgoDab is a complete integrated development environment (IDE) dedicated to creating and running trading algos. There server runs independently of the UI. Once up and running, you edit, test, and run your strategies in one user interface (GUI).
#
Self-hostedBy running your own server you are not limited by resource limits established by a third party. Also, your secret sauce is safe. You may run Algodab at home or at the office, behind a firewall, off of public networks, or use a dedicated server to which only you have access.
#
Run multiple strategies off of a single data feedAlpaca is the first broker of choice for algorithmic trading. Their API is straightforward, easily managable so they are the first broker Algodab supports straight out of the box. However, like many other providers, they only allow a single websocket connection to their data feed. This often means that you are limited to a single strategy at any given time. Algodab abstracts that stream of data, allowing any number of strategies to run on a single websocket connection.
#
Build for extensibility and redundancyYou can simultaneously connect to multiple data providers (i.e. Alpaca, Etrade, IEX, etc.) and aggregate their data into a single feed powering all your algos. Such architecture allows for a good degree of fail-over redundancy should one of the providers go off line. Also, it provides a way to go around limits imposed by any single data provider. Algodab seperates the concepts of a brokers and a data providers, so you can work with data from one provider and place your trades elsewhere.
#
Mix and run Python and JavaScript simultaneouslyYour strategies can be a mixure of Python and Javascript code. Are you all about Javascript but found a neat Python code? No worries, just drop it in and run it along side your Javascript code. Additional languages are being considered - your feedback pending :)
#
Web basedEdit your code and monitor your server from anywhere.
#
Extensible architectureMultiple brokers, multiple data providers, muliple algorigthms - all running simultaneously providing aggregated views of your data.
#
Automated live tradingThe system is fully capable of running on autopilot with as much or as little supervision as required b your comfort levels. You can switch between autopilot and manual operations at will.
#
Fully Automated or manual tradesYour choice, do fire-and-forget strategies or simply use Algodab server as a support tool for your manual trading decisions.
#
Alerting and system monitoringYou get a deep insight into your server's health and performance with built-in metrics monitoring. See how long your code takes to run, cpu and memory usage, incoming data rates, and more.
#
Source available on GitHubGitHub repo coming soon. I plan on making the source available once MVP (minimaly viable product) is ready and some maintenance chores are finished: remove some dead code, some interface fixes, etc etc
#
So how does it work?#
Server-sideThe server side software stack will run on your server on your own machine. Any Windows or Linux workstation will do, although, of course, the more memory the better. Once set up, the server will maintain a connection to your data provider(s) and supply the platform with real-time quotes and trades information. The incoming data will be aggregated at the interval of your choosing. This means you can have candles of any magnitude you want. Several basic indicator will be computed and made ready for display. It's all configurable.
#
Client-side: the gridEvery now and then, throughout the documentation, you will see me refering to something as “the grid”. The grid is simply a list of all assets that your platform is tracking at the moment. This could be a mix of stocks and crypto (although crypto support under development as of Feb 2022).
So, let's say you wish to trade TSLA algorithmically? Then you need to enter TSLA into the grid. It can be done through code (as part of a task) or manually via the UI (see: “ADD SYMBOL” at the bottom of the grid), and symbols can be added and removed from the grid as needed throughout the day. (see: Positions.add()).
Adding and removing symbols in the grid will also update the real-time quotes streams from data providers. As far as data providers, only Alpaca is available for now (as of Feb.2022) but more will be added soon. (Polgon.io, or IEX).
Each row in the grid can be exapnded to reveal additional information about a symbol: real-time chart with your annotations, company basic information, current signals, orders, etc. etc.
The above screenshot is showing Algodab UI connected to Alpaca’s Paper Trading account.
#
Built-in editorThe server provides a web based IDE front-end with built-in editor where you can write your code. Any code changes are immediately applied to your strategy when saved - unless the task you are editing is disabled. You may have noticed a red or green dot next to each task name. It signified whether or not a task is currently enabled (green) or disabled (red). To toggle the enable state of a task just click the red/green dot. Tasks can also be toggled in real-time via code by using Tasks.enable()
or Tasks.disable()
methods.
Any new task (or function) you create is disabled be default, which is signified by the red dot next to the task name. It must be explicitly enabled to take effect. To enable it simple click the red dot, which will turn green indicating the task will now run. Tasks can be disabled/enabled either manually via the UI (as I just explained), or programmatically via Javascript or Python Tasks.enable
or Task.disable
call. After a task has completed it's run, the duration of that run will be displayed next to the task name (in milliseconds).
Any compile or runtime issues are flagged right away. Syntax errors are flagged in the editor. Runtime errors are displayed on the status bar.
#
Real-time metricsThroughout its operations, the server will continuously collect a series of metrics allowing you to monitor the health status of the server: from simple things such as CPU load, to messaging or task execution durations. All metrics can be visually monitored with a Grafana dashboard (default choice here), however technically, there isn’t a reason why you couldn’t use a graphing package of your choice.
Monitor your server's health and algorithm performance with variety of real-time metrics: cpu usage, task execution times, holding durations, etc. Additionally, your algorithms can maintain their own metrics and measurements via Stats.push()
method, which can then be displayed on the dashboard.
#
LoggingTODO: Provide some more info where logs are kept. Explain the difference between the system log (Tomcat’s catalina.out) and the logs generated by user’s own algorithmic tasks.
#
Programming languagesTo code strategies, you can use languages you are already familiar with: standard JavaScript and Python. Those languages were extended with additional functionality to support interaction with your Algodab trading environment: querying symbols tracked in the grid, alerts, notifications, signals, etc. etc. That extended API is documented below.
#
Trading live or paperWith Algodab you can either trade live or paper trade on live data. You can either trade fully automated strategies, where your code submits and manages the orders, or use it to aid in your trading decision process. Even if you don’t intend to let a machine execute your trades, your own Algodab server can be a great tool assisting you in your decision process i.e., you can manage your own stop-loss orders, complex conditional orders, etc.
Your site starts at http://localhost:8080
.
Open docs/intro.md
and edit some lines: the site reloads automatically and display your changes.