Algorithmic Intraday Stock Trading System – Stock Trading Bot
SaaS system for automated intraday stock trading, allowing investors to connect their brokerage account and configure a robot to trade stocks from their account automatically for a commission and subscription fee.
The client is wealth management company with 20 years of experience and their proprietary active stock trading strategy. The client wanted to digitize his business to increase the customer base, augment profits from trading and decrease the cost of operations by creating a SaaS system that would automate the trading strategy and operations.
The client contracted SoluLab for the system’s development because he was impressed by our expertise in the financial/stock markets domain, the ability to quickly grasp complicated financial requirements and readiness to commit to a very aggressive deadline (3 months to create and launch the MVP). A holistic approach to software architecture and experience with high-load real-time applications were other crucial factors to choose SoluLab as a development partner.
Fixed Price for the MVP stage, Agile/Scrum for other stages.
The system allows clients to register and connect their brokerage account, configure the trading strategy’s parameters such as buying power,
leverage, risk level, etc., run automated trading from their brokerage account, monitor trades in real-time and review the profit/loss reports.
For this, they pay a commission fee and percentage of the generated profit.
In background, the system uses technical analysis to generate forecasts for certain stocks for the next trading session, opens short and long
positions according to the forecasts, monitors real-time execution set by complex rules, closes the positions that don’t perform properly and fixes
profits at the end of each trading session.
The project started with a fixed scope/fixed price/waterfall phase with a very aggressive deadline. The system had to be live in 4 months because of the tight end-client constraint.
To meet the deadline the team had to work on the requirements specification in parallel with the implementation of the system.
When the system itself was implemented and stabilization phase started the Client advised that because
of heightened customer’s interest they would like to be ready to go live with onboarded customers a few weeks earlier the deadline – 1st trading session of the New Year (meaning 1st of January 2018). The team empathetically reacted to Client’s request and system stabilization and real funds testing was performed in New years eve. So 1st of January 2018 we were live for NYSE and NASDAQ.
Once the first version of the system was completed and live, the team switched to Kanban to support it and deliver new functionality and updates.
NYSE is a publicly traded company that provides a platform for its members to trade: buy and sell shares of companies. This product integrates orders and trades sequentially, providing a more deterministic and transparent view of the order book and related activities.
NASDAQ is a trading network that relies on multiple market makers – broker-dealers that are members of this exchange. Real-time data provided through the Nasdaq Information Interface Service includes price information and reference data from vendors, trading calendars for multiple markets, trade capture from multiple marketplaces, corporate action data from multiple vendors, etc.
Interactive Brokers is a direct market access broker that provides execution, clearing, settlement and prime brokerage for clients, including securities and commodities brokerage. Interactive Brokers allows trading stocks, options, futures and exchange-traded funds around the world through a single account, as well as real-time account balance and portfolio monitoring.
Technical Solution Highlights
The architecture of the system is defined by very high performance requirements.
Trading opportunities may appear and disappear in a fraction of a second, so the system has to process massive volumes of data simultaneously to react the market events in real-time.
Technology Stack and Components
Microsoft .NET, C# and Microsoft Azure and SQL Server were selected as a mature, well supported, enterprise-grade technology stack.
React.js and SignalR were chosen to implement a rich real-time web interface of the system. Open source QuantConnect/Lean Engine component is used to reduce the cost and time to market factors. It features powerful adapters and connectors, which provide for simple implementation of trading algorithms, backtesting, and connection to the broker API.
Interactive Brokers’ API and Gateway were used to process live trading data and send trading orders to the market.
Low Latency Data Processing
The system is experiencing its peak load in the first seconds of the trading session when large volumes of data have to be processed, all positions opened at the right price, and trading orders should arrive in the brokerage account before the price changes.
To ensure quasi-real-time performance, the system uses parallel computation in multiple threads with asynchronous event processing queues to fully utilize multi-core multi-processor server instances.
The system is able to automatically fire up additional server instances as the number of accounts and the volume of data increases.
The admin interface of the system has detailed real-time charts and alerts with current prices, statuses of trades, etc. which allows the administrator to monitor the trading session in real-time and manually close the position in case of an emergency.
The interface features the implemented SignalR library, which allows server code to send asynchronous notifications to client-side web applications.
Automated Testing and Broker API Emulation
To allow automated testing of the application, our team created a Broker API emulator that allowed us to record and playback the trading session for selected securities. This was done because of the Interactive Brokers’ paper trading account limitations: it allows to run app tests only once a day in parallel with the real trading session and has a number of other peculiarities, which would result in different system’s behavior in paper trading and in live accounts.
The first version of the platform was delivered in full compliance with the specifications and the client’s deadline. In 3 months after the project’s start, the system was live and available to real end-clients, trading with real money.
The system allowed to significantly lower the operational costs by reducing manual labor of expensive personnel and to scale the business to handle hundreds and potentially thousands of clients.
The project is still underway, and SoluLab provides support and maintenance services and is working
on future versions of the system which is evolving into an advanced wealth management and personal finance solution with the active intraday trading module as just one of its components.