WonderTrader
is a high-efficiency and highly available quantitative trading development framework based on the C++
core module that is suitable for all types of transactions in the entire market.
WonderTrader
relies on the high-speed C++
core framework and the efficient and easy-to-use application layer framework (wtpy), and is committed to creating a fully automated one-stop quantitative R&D trading scenario from R&D, trading, operations, and scheduling.
WonderTrader
launched a new UFT engine in 0.9
to meet the needs of ultra-low latency trading. After a series of optimizations, the system latency is within 175 nanoseconds .
WonderTrader
’s real trading architecture
WonderTrader
Rich trading engine
- CTA engine , also called synchronization strategy engine , is generally suitable for strategies with fewer targets, faster calculation logic, and is event + time driven. Typical application scenarios include single-bid timing, arbitrage below mid-frequency, etc. For the DualThrust strategy provided in the demo, the average time taken for a single recalculation is about 70 microseconds for the Python implementation version and about 4.5 microseconds for the C++ implementation version.
- SEL engine , also called asynchronous strategy engine , is generally suitable for time-driven strategies that have many targets and take a long time to calculate logic. Typical application scenarios include multi-factor stock selection strategies, cross-sectional long-short strategies, etc.
- HFT engine , also called high-frequency strategy engine , is mainly aimed at high-frequency or low-latency strategies. It is event-driven and the system delay is between 1-2 microseconds.
- The UFT engine , also called the ultra-fast strategy engine , is mainly aimed at ultra-high frequency or ultra-low latency strategies, event-driven, and the system delay is within 200 nanoseconds.
Complete development interface
- Efficient and easy-to-use data interface : Each strategy will have an independent context module. The context will automatically cache the data required by the strategy, and the strategy can be called directly.
- Simple signal interface : The strategy only needs to set the target position and it will be automatically executed in the background.
- Context-free policy logic : The policy does not need to record any data itself. It only needs to query the interface each time. All data is cached in memory, and access efficiency is guaranteed.
Professional strategic management
- Unified management of strategy combinations : The strategy combination approach is mainly used to coordinate with the product management of professional organizations. A combination plate corresponds to several targets of several strategies, and then sets a basic unit fund amount. This is the basic combination plate of product management, which is convenient for expansion.
- Target position merger execution : After the target position is merged, the risk of self-transaction is avoided, while margin occupation and commission expenses are reduced.
- Independent storage of theoretical positions : The theoretical positions of the strategy are stored independently, and the overall performance of the combined disk is also independently calculated, making it easy to manage internally.
- Concurrent execution of multiple accounts : After the target position of the combination is determined, it is executed simultaneously through multiple trading channels, which can effectively ensure the consistency of the performance of different accounts.
Full type of backtest support
- Full language support : Whether it is a strategy developed in
C++
, apython
strategy developed underwtpy
, or a strategy developed under other language sub-frameworks, all are backtested in a unified backtesting engine .- High backtesting efficiency : The backtesting engine is developed in
C++
, and the backtesting efficiency is high and the speed is fast. Whether it is aC++
strategy or aPython
strategy, it can be quickly verified.- Complete strategy support : In addition to CTA strategies and SEL strategies , HFT strategies , UFT strategies and execution units can also be backtested.
Efficient data servo
- Local data server :
WonderTrader
's built-in storage engine uses local storage, establishes data server locally, and broadcasts real-time market data through theudp
port to achieve a1+N
service structure, which can provide undifferentiated data services to multiple combination disks at the same time. The professional data provider-level architecture supports the establishment of a multi-level distribution system to easily cope with various demand scenarios.- Caching historical data : During the transaction process, all historical data is cached in the memory. At the same time, the mechanism of directly referencing the memory data slices is adopted to fundamentally avoid data copying and improve access efficiency.
- Efficient storage engine : Real-time data uses
mmap
files, which can read and write at high speeds without losing data. At the same time, it supports the mysql database to store historical data, making it more convenient to build your own investment research database on this basis.
Flexible risk control
- Combination disk fund risk control : The combination disk has a preset fund scale, and the combination disk's fund risk control can be carried out based on the virtual funds of the combination disk. The biggest advantage is that if the combination is in the downward stage, after risk control is triggered, even if the capital account does not reach the risk control line, it will not continue to decline.
- Channel traffic risk control : Mainly aimed at compliance risks , controlling indicators such as the total number of canceled orders, the number of orders placed in a short period of time, and the number of canceled orders.
- Account fund risk control : It is consistent with fund risk control in the general sense, mainly controlling the withdrawal of account funds, etc.
- Emergency manual intervention : Provide an entrance for emergency manual intervention, and achieve control purposes by uploading a configuration file. It is mainly suitable for risks in a single product. If there is a risk in the entire market, the system can be stopped manually.
- Clutch mechanism : The clutch mechanism relies on the mechanism of separation of signals and execution. It is mainly used to directly disconnect the signal execution through the clutch mechanism if there is a risk in the strategy or combination. The advantage is that it does not affect the logic of the strategy and only disconnects the execution of the signal. You can continue to observe the performance of the strategy in a specific market stage and confirm it with theoretical research.
Powerful console (wtpy monitoring service)
- Combination disk operation monitoring : You can view real-time operation logs, strategy theoretical data, trading channel data, etc., and provide an entrance for manual start and stop.
- Automatic scheduling service : fully automatically schedules scheduled tasks (start, stop, restart), supports setting task repetitions on a weekly basis, and supports process guardianship.
- Real-time event notification : The monitoring service receives events pushed by the combination disk, and then forwards them to the monitoring terminal to prompt the user.
- Backtest viewer : Using the WtBtSnooper module, you can view and analyze backtest data.
- Fully automatic remote deployment (under construction) : Fully automatic online remote deployment, providing automated deployment services for various application scenarios such as backtest environment and real disk environment.
Team internal control The strategic portfolio management method provides a perfect solution for internal team management.
C++
level code can provide maximum policy confidentiality, and investment researchers do not have to worry about the leakage of policies; Multi-account trading ( multi-product configuration ) For strategy combinations under different market cycles, the average team will have a strategy combination that is most suitable for the moment. However, during the same period, the team may manage many accounts at the same time, but in fact, the strategy combinations used by these accounts are the same. At this time, the M+1+N execution architecture provided by the WonderTrader
platform can perfectly meet this demand.
Suppose the basic capital size of a certain combination P is 5 million, the expected return is 30%, the maximum drawdown is 10%, and the return-to-risk ratio is 3:1; Account A uses this combination P to trade, and the amount of funds in account A is 10 million, and the maximum acceptable amount is The retracement is also 10%; Account B also uses this combination to trade P, and the amount of funds is also 10 million, but it can The maximum retracement accepted is 20%; at this time, because the risk parameters of account A are consistent with the basic market, the lot size magnification of account A is the capital size/fund size of the basic market = 1000w/500w = 2 times; account B can tolerate it The maximum drawdown is 20%, so the lot size ratio needs to be doubled, that is, account B can be allocated 4 times.
Multi-target tracking Some quantitative trading platforms that use interpreted languages (such as Python
) to develop core modules are capable of various application scenarios when there are only a few targets. But when the number of targets that need to be tracked reaches more than 100, or even more than 50, it cannot meet the demand. On the one hand, it takes up a lot of resources. Using multiprocess
and other mechanisms, although each target runs independently, hundreds of new processes will be created for hundreds of targets, which consumes a lot of memory and CPU. On the other hand, the strategy is inefficient and there is serious competition for resources. Under certain circumstances, the strategic response will also be slower. The core of WonderTrader
is developed in C++
, and the data servo is designed from the beginning to provide services to multiple combinations at the same time. At the same time, strategy and execution are separated, and signal execution and strategy calculation run completely independently in two different threads. Under such an architecture, the needs of multi-standard tracking can be well met.
Computationally intensive strategy The amount of calculations required for some strategies is staggering. A typical one is the stock selection strategy. Whether it is using multiple factors or fundamentals, it will gradually screen thousands of stocks to obtain the final target stock pool. In addition, some multi-standard multi-factor frameworks also have a large amount of calculation. Such a strategy requires a huge amount of calculation and takes a long time. WonderTrader
's SEL
engine is customized to meet this need. The SEL
engine adopts an asynchronous time-driven model. By registering the recalculation time schedule with the engine (supporting multiple cycles such as intraday, daily, weekly, and monthly), it triggers recalculation regularly, and then adjusts the target positions of multiple targets, thereby output signal.
Speed trading WonderTrader
uses C++
as the underlying core development language. One of the most important purposes is to pursue ultimate performance , so high-frequency trading or speed trading accounts for a very large proportion in WonderTrader
's usage scenarios. WonderTrader
has opened a new UFTEngine in version v0.9
, which is specially designed for extremely fast trading scenarios. Different from the original HFTEngine
, HFTEngine
targets general high frequencies and focuses on providing high-performance underlying components to the application layer . It will consider more compatibility issues and application layer docking issues. The system delay is within 1-2 microseconds. between . UFTEngine
is completely separated from the WtCore
project and does not provide interfaces to the application layer. It is all developed and implemented in C++
, and the system delay is within 200ns .
Algorithmic trading WonderTrader
has an independent executor entry module WtExecMon
, on which users can implement algorithmic trading. In WonderTrader
's M+1+N execution architecture, the 1+N execution part is stripped out and can be used as an independent algorithmic trading executor . When users use it, by setting the target position of the specified target, the algorithm execution unit can place trading orders according to the preset algorithm. Users can add more algorithm execution units by implementing their own WtExecFact
module. The efficient C++
bottom layer can provide a strong guarantee for the execution effect of the algorithm execution unit.
wtpy
WonderTrader
, a Python3
sub-framework of WonderTrader
developed using Python3
Python
has many very popular and powerful third-party libraries for time series data processing.Python
is very convenient for code writing and debugging. It can be run directly without compilation.Python
’s cross-platform attributes also enable Python
to be applied to more scenarioswtpy
is as an extension of WonderTrader
in the Python
languagewtpy
also has a built-in powerful monitoring service component WtMonSvr
. This component provides a remote webui
monitoring interface, which can monitor the operation of the strategy combination in real time. It also provides a 24×7
automatic scheduling service to protect your transactions. WonderTrader
WonderTrader
github
address: https://github.com/wondertrader/wondertradergitee
address: https://gitee.com/wondertrader/wondertraderwtpy
github
address: https://github.com/wondertrader/wtpygitee
address: https://gitee.com/wondertrader/wtpywtpy
acquisition address: https://pypi.org/project/wtpy/ wtpy
can be installed directly in python3.8
or above. pip install wtpy --upgrade
WonderTrader
extension projectWt4ElegantRL
using wtpy
as the underlying backtest engine https://github.com/drlgistics/Wt4ElegantRL wondertrader
to receive real-time information from WonderTrader
610730738
(full) Group 2 367916500
(please star
before joining, and then provide your github
username)WonderTrader
documentation, please see https://docs.wondertrader.com/WonderTrader
semi-official documentation https://dumengru.github.io/docs_wondertrader/WonderTrader
learning notes https://zzzzhej.github.io/WonderTrader-Learning-Notes/