Events call (callback) methods
In CloudQuant, the simulator takes in several different types of events that a script can use in its trading strategy.
Market Data Events
Under Market Data, we have the trade w/NBBO event. This is a simulation of all of our Level 1 attributes and the NBBO (National Best Bid Offer) at the time of each trade. Every time a trade is made, the system takes a snapshot of this information and uses it in the simulation. Typically, the main thread of a backtest is driven off of a trade, and there are roughly 30 million trades in any given day. Also of note is the NBBO price change: every time the NBBO price changes, there is a Market Data event that CloudQuant takes note of. The system is then able to precisely evaluate when these events occur.
Another important piece of Market Data is the imbalance event. The imbalance data comes in 3 forms: the NYSE, the ARCA, and the NASDAQ. NYSE includes the NYSE Market, previously known as the American Stock Exchange. In NYSE, there is a morning imbalance and an afternoon imbalance. The same is true for NASDAQ, which distributes imbalances for all symbols, whether there are actually imbalances or not.
- Mariner Backtesting - Strategy.on_minute_bar()
- Mariner Backtesting - Strategy.on_nbbo_price()
- Mariner Backtesting - Strategy.on_news()
- Mariner Backtesting - Strategy.on_trade()
- Mariner Backtesting - Strategy.on_arca_imbalance()
- Mariner Backtesting - Strategy.on_amer_imbalance()
- Mariner Backtesting - Strategy.on_nyse_imbalance()
- Mariner Backtesting - Strategy.on_nasdaq_imbalance()
Order Processing Events
Every time your script sends an order, there is a process that an order goes through. In this process, the order undergoes internal and external risk checks, and then it gives an acknowledgment. The system can call a script for any of these order-related events: an acknowledgment, fill, cancel, or cancel reject.
- Mariner Backtesting - Strategy.on_ack()
- Mariner Backtesting - Strategy.on_fill()
- Mariner Backtesting - Strategy.on_cancel()
- Mariner Backtesting - Strategy.on_cancel_reject()
- Mariner Backtesting - Strategy.on_reject()
Timer Events
Finally, we have Timer Events. In CloudQuant, a script can schedule a timer for events to go off. For example, you can specify that the script goes off at exactly 9:45 or any other time of the day. When you schedule the timer, you can give it a piece of information so that you know what to do when it is being evaluated. This means that you could call this timer 5 times during the day if you choose: 2 minutes into the trading day, 30 minutes in, at noon, an hour before close, and 15 minutes before close for example. You can also give the script a timer ID and a functionality that is specific to that timer ID.
Strategy Events
- Mariner Backtesting - Strategy.on_start()
- Mariner Backtesting - Strategy.on_strategy_start()
- Mariner Backtesting - Strategy.on_finish()
- Mariner Backtesting - Strategy.on_strategy_finish()
- Mariner Backtesting - Strategy.on_save()
- Mariner Backtesting - Strategy.on_restore()