The Wayback Machine - https://web.archive.org/web/20240325081936/https://github.com/wondertrader
Skip to content
View wondertrader's full-sized avatar
💭
I may be slow to respond.
💭
I may be slow to respond.
  • SH, China
Block or Report

Block or report wondertrader

Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
wondertrader/README.md

WonderTrader2.png

WonderTrader是什么

  • WonderTrader是一个基于C++核心模块的,适应全市场全品种交易的,高效率高可用的量化交易开发框架。

    • 面向于专业机构的整体架构
    • 数十亿级的实盘管理规模
    • 从数据落地清洗、到回测分析、再到实盘交易、运营调度,量化交易所有环节全覆盖
  • WonderTrader依托于高速的C++核心框架,高效易用的应用层框架(wtpy),致力于打造一个从研发、交易、到运营、调度,全部环节全自动一站式的量化研发交易场景。

  • WonderTrader0.9开启了一个新的UFT引擎,针对超低延时交易的需求进行实现,经过一系列的优化以后,系统延迟在175纳秒之内。

  • WonderTrader的实盘运行架构 WonderTrader实盘运行架构.png

WonderTrader的优势

  • 丰富的交易引擎

    • CTA引擎,也叫同步策略引擎,一般适用于标的较少,计算逻辑较快的策略,事件+时间驱动。典型的应用场景包括单标的择时、中频以下的套利等。Demo中提供的DualThrust策略,单次重算平均耗时,Python实现版本约70多微秒,C++实现版本约4.5微秒。 CTA.jpg
    • SEL引擎,也叫异步策略引擎,一般适用于标的较多,计算逻辑耗时较长的策略,时间驱动。典型应用场景包括多因子选股策略、截面多空策略等。
    • HFT引擎,也叫高频策略引擎,主要针对高频或者低延时策略,事件驱动,系统延迟在1-2微秒之间
    • UFT引擎,也叫极速策略引擎,主要针对超高频或者超低延时策略,事件驱动,系统延迟在200纳秒之内 CTA.jpg
  • 完善的开发接口

    • 高效易用的数据接口:每个策略都会有独立的上下文模块,上下文会自动缓存策略所需要的数据,策略直接调用即可。
    • 简洁的信号接口:策略只需要设置目标仓位,后台自动执行。
    • 上下文无关的策略逻辑:策略不需要自己记录任何数据,每次只需要向接口查询即可,数据全部缓存在内存中,访问效率有保障。
  • 专业的策略管理

    • 策略组合统一管理:采用策略组合的方式,主要为了配合专业机构的产品管理。一个组合盘,对应若干个策略的若干个标的,再设置一个基本的单位资金量,这就是产品管理的基本组合盘,方便扩展。
    • 目标仓位合并执行:目标仓位合并以后,避免了自成交的风险,同时降低了保证金占用和佣金开销。
    • 理论部位独立存储:策略的理论部位是独立存储的,组合盘的整体绩效也是独立核算的,轻松胜任内部管理。
    • 多账户并发执行:组合的目标头寸确定以后,就通过多个交易通道同步执行,可以有效的保障不同的账户的绩效的一致性。
  • 全类型的回测支持

    • 语言支持全:不论是C++开发的策略还是wtpy下开发的python策略,或者其他语言子框架下开发的策略,都在统一的回测引擎中统一回测。
    • 回测效率高:回测引擎采用C++开发,回测效率高,速度快。不管是C++策略还是Python策略,都能快速验证。
    • 策略支持完备:除了CTA策略SEL策略可以回测,HFT策略UFT策略执行单元也能回测 backtest.jpg
  • 高效的数据伺服

    • 本地数据伺服WonderTrader内置的存储引擎采用本地存储,在本地建立数据伺服,通过udp端口广播实时行情,实现1+N的服务结构,可以同时向多个组合盘提供无差别数据服务。专业数据供应商级别的架构,支持搭建多级分发体系,轻松应对各种需求场景。
    • 缓存历史数据:交易过程中,历史数据全部缓存到内存中,同时采用内存直接引用内存数据切片的机制,从根本上避免数据拷贝,提高访问效率。
    • 高效存储引擎:实时数据采用mmap文件,读写高速并且不会丢失数据。同时支持mysql数据库存储历史数据,更方便在此基础上搭建自有的投研数据库。
  • 灵活的风险控制

    • 组合盘资金风控:组合盘有预设的资金规模,可以针对组合盘的虚拟资金,进行组合盘的资金风控。最大的优点是,如果组合盘处于下行阶段,触发风控以后,即使资金账户没有打到风控线,也不会再继续下行了。
    • 通道流量风控:主要针对合规风险,控制的是总撤单笔数、短时间内下单次数和撤单次数等指标。
    • 账户资金风控:和一般意义上的资金风控一致,主要控制账户资金的回撤等。
    • 紧急人工介入:提供一个紧急的人工介入的入口,通过上传一个配置文件,达到控制的目的。主要适用于单品种出现风险,如果全市场风险,人工停止系统即可。
    • 离合器机制:离合器机制依托于信号和执行分离的机制的,主要是如果策略或组合发生风险,通过离合器机制,直接断开信号执行。优点是不影响策略的逻辑,只断开信号的执行,可以继续观察策略在特定行情阶段的表现,和理论研究相互印证。 risk.jpg
  • 强大的控制台wtpy的监控服务)

    • 组合盘运行监控:可以查看实时运行日志、策略理论数据、交易通道数据等,并提供手动启停的入口。 monitor.jpg
    • 自动调度服务:全自动调度定时任务(启动、停止、重启),支持按周设置任务重复,支持进程守护。 schedule.jpg
    • 实时事件通知:监控服务接收组合盘推送的事件,然后转发给监控端,提示给用户。
    • 回测查看器:使用WtBtSnooper模块,可以进行回测数据的查看分析。 bt_summary.jpg bt_details.jpg bt_signals.jpg
    • 全自动远程部署(在建):全自动在线远程部署,提供回测环境、实盘环境等多种应用场景的自动化部署服务。

常见应用场景

  • 团队内控 策略组合管理的方式,给团队内部管理提供了完美的解决方案。

    • 一方面,不同投研人员,不同的策略可以组合成一个组合运行,而且每个策略都有自己的理论部位,即使交易相同标的也不会互相干扰;
    • 另一方面,C++级别的代码可以提供最大的策略保密性,投研人员不用担心策略的泄露;
    • 策略的绩效是独立核算的,团队内部的考核指标可以很容易实现。
  • 多账户交易多产品配置) 对于不同行情周期下的策略组合,一般团队都会有一个当下最适应的策略组合。但是同一时期,团队可能会同时管理很多个账户,而其实这些账户用到的策略组合都是相同的。这个时候WonderTrader平台提供的M+1+N执行架构就能够完美的满足这个需求。 WonderTrader基本架构.jpg

    • 首先,策略组合有自己的单位资金容量和对应的风险参数,以及各个策略的单位交易数量;
    • 其次,不同的账户有不同的资金规模和风险偏好,这个时候只需要根据这些要求配置不同的手数倍率即可;

      假如某组合盘P基本资金规模为500w,预期收益30%,最大回撤10%,收益风险比3:1;A账户使用该组合盘P交易,A账户的资金量为1000w,可以接受的最大回撤也是10%;B账户也使用该组合盘P交易,资金量也是1000w,但是可以接受的最大回撤为20%;这个时候因为A账户风险参数和基本盘一致,所以A账户的手数放大倍数为资金规模/基本盘的资金规模=1000w/500w=2倍;B账户因为可以忍受最大回撤20%,所以手数比例还要再放大一倍,即B账户可以配置4倍。

    • 第三,不同的账户可以配置独立的风控逻辑,账户之间不会互相影响。
  • 多标的跟踪 一些用解释型语言(如Python)开发核心模块的量化交易平台,在标的数不多的情况下,能够胜任各种不同的应用场景。但是当需要跟踪的标的数达到100个以上,甚至是50个以上时,就无法满足需求了。一方面资源占用大,利用multiprocess等机制,虽然各个标的独立运行,但是上百个标的就要新建上百个进程,内存和CPU开销都非常大;另一方面策略效率低,资源争强严重的情况下,策略反应也会变慢。 WonderTrader核心采用C++开发,数据伺服更是一开始就设计成向多个组合同时提供服务的架构,同时策略和执行剥离,信号执行和策略计算完全在两个不同的线程中独立运行。在这样的架构下,就能够很好的满足多标的跟踪的需求。

  • 大计算量策略 一些策略计算量会非常惊人,比较典型的就是选股策略,不管是用多因子也好,还是基本面也好,都会从数千只股票中,逐步筛选,从而得到最后的目标股池。另外,一些多标的的多因子框架也具有较大的计算量。这样的策略,计算量非常庞大,耗时也长。 WonderTraderSEL引擎就是为了满足这方面的需求而定制的。SEL引擎采用异步时间驱动的模式,通过向引擎注册重算时间调度(支持日内,每日、每周、每月的等多种周期),定时触发重算,然后调整多标的的目标仓位,从而输出信号。

  • 极速交易 WonderTrader使用C++作为底层核心开发语言,一个最重要的目的就是追求极致性能,所以WonderTrader的使用场景中高频交易或者极速交易有一个非常大的占比。WonderTraderv0.9版本开设了一个新的UFTEngine,专门针对极速交易的场景。 和原来的HFTEngine不同,HFTEngine针对的是一般高频,侧重于向应用层提供高性能的底层组件,会考虑更多的兼容性问题以及应用层对接的问题,系统延迟在1-2微秒之间。而UFTEngine则完全从WtCore项目剥离,不向应用层提供接口,全部在C++进行开发实现,系统延迟在200ns以内

  • 算法交易 WonderTrader有一个独立的执行器入口模块WtExecMon,用户可以在此基础上实现算法交易。WonderTraderM+1+N执行架构中,1+N执行部分剥离出来,就可以作为一个独立算法交易执行器来使用。用户在使用的时候,通过设置指定标的的目标头寸,算法执行单元就可以按照预设的算法进行交易下单。 用户可以通过实现自己的WtExecFact模块,来添加更多的算法执行单元。高效的C++底层,可以给算法执行单元的执行效果提供有力的保障。

支持的交易接口

  • 期货
    • CTP
    • CTPMini
    • 飞马Femas
    • 艾克朗科(仅组播行情)
    • 易达
  • 期权
    • CTPOpt
    • 金证期权maOpt
    • QWIN二开
  • 股票
    • 中泰XTP
    • 中泰XTPXAlgo
    • 华鑫奇点
    • 华锐ATP
    • 宽睿OES

wtpy简介

  • wtpy是构建在WonderTrader核心模块之上的,使用Python3开发的WonderTraderPython3子框架
  • Python作为量化领域最流行的语言,在时序数据处理上有许多非常受欢迎的强大的第三方库
  • Python作为一种解释型语言,代码编写和调试都非常方便,不需要编译就可以直接运行
  • Python的跨平台属性也使Python可以应用到更多的场景中
  • wtpy主要功能是作为WonderTraderPython语言的外延
  • 同时wtpy还内置了一个强大的监控服务组件WtMonSvr。该组件提供了远程的webui的监控界面,可以实时监控策略组合的运行情况,还提供全天24×7的自动调度服务,为你的交易保驾护航。

WonderTrader怎么获取

WonderTrader延伸项目

写在最后


Pinned

  1. wondertrader wondertrader Public

    WonderTrader——量化研发交易一站式框架

    C++ 3.3k 656

360 contributions in the last year

No contributions on March 26th.No contributions on April 2nd.1 contribution on April 9th.No contributions on April 16th.No contributions on April 23rd.No contributions on April 30th.No contributions on May 7th.No contributions on May 14th.No contributions on May 21st.No contributions on May 28th.No contributions on June 4th.No contributions on June 11th.No contributions on June 18th.1 contribution on June 25th.No contributions on July 2nd.No contributions on July 9th.1 contribution on July 16th.No contributions on July 23rd.No contributions on July 30th.No contributions on August 6th.No contributions on August 13th.No contributions on August 20th.6 contributions on August 27th.No contributions on September 3rd.No contributions on September 10th.No contributions on September 17th.No contributions on September 24th.No contributions on October 1st.No contributions on October 8th.No contributions on October 15th.No contributions on October 22nd.No contributions on October 29th.No contributions on November 5th.No contributions on November 12th.No contributions on November 19th.No contributions on November 26th.No contributions on December 3rd.No contributions on December 10th.No contributions on December 17th.No contributions on December 24th.1 contribution on December 31st.No contributions on January 7th.No contributions on January 14th.No contributions on January 21st.No contributions on January 28th.No contributions on February 4th.No contributions on February 11th.No contributions on February 18th.No contributions on February 25th.No contributions on March 3rd.No contributions on March 10th.No contributions on March 17th.No contributions on March 24th.No contributions on March 27th.1 contribution on April 3rd.1 contribution on April 10th.6 contributions on April 17th.No contributions on April 24th.No contributions on May 1st.3 contributions on May 8th.No contributions on May 15th.No contributions on May 22nd.2 contributions on May 29th.1 contribution on June 5th.No contributions on June 12th.2 contributions on June 19th.1 contribution on June 26th.1 contribution on July 3rd.3 contributions on July 10th.No contributions on July 17th.No contributions on July 24th.No contributions on July 31st.No contributions on August 7th.1 contribution on August 14th.No contributions on August 21st.2 contributions on August 28th.No contributions on September 4th.7 contributions on September 11th.4 contributions on September 18th.No contributions on September 25th.No contributions on October 2nd.2 contributions on October 9th.1 contribution on October 16th.4 contributions on October 23rd.2 contributions on October 30th.6 contributions on November 6th.1 contribution on November 13th.2 contributions on November 20th.9 contributions on November 27th.2 contributions on December 4th.No contributions on December 11th.No contributions on December 18th.3 contributions on December 25th.No contributions on January 1st.No contributions on January 8th.No contributions on January 15th.No contributions on January 22nd.No contributions on January 29th.No contributions on February 5th.No contributions on February 12th.No contributions on February 19th.No contributions on February 26th.No contributions on March 4th.No contributions on March 11th.No contributions on March 18th.No contributions on March 25th.No contributions on March 28th.No contributions on April 4th.No contributions on April 11th.No contributions on April 18th.3 contributions on April 25th.No contributions on May 2nd.2 contributions on May 9th.No contributions on May 16th.1 contribution on May 23rd.1 contribution on May 30th.1 contribution on June 6th.No contributions on June 13th.1 contribution on June 20th.3 contributions on June 27th.1 contribution on July 4th.1 contribution on July 11th.1 contribution on July 18th.No contributions on July 25th.2 contributions on August 1st.3 contributions on August 8th.6 contributions on August 15th.1 contribution on August 22nd.12 contributions on August 29th.3 contributions on September 5th.2 contributions on September 12th.4 contributions on September 19th.3 contributions on September 26th.No contributions on October 3rd.No contributions on October 10th.3 contributions on October 17th.4 contributions on October 24th.8 contributions on October 31st.1 contribution on November 7th.No contributions on November 14th.2 contributions on November 21st.No contributions on November 28th.2 contributions on December 5th.No contributions on December 12th.No contributions on December 19th.No contributions on December 26th.No contributions on January 2nd.No contributions on January 9th.No contributions on January 16th.No contributions on January 23rd.No contributions on January 30th.No contributions on February 6th.No contributions on February 13th.No contributions on February 20th.No contributions on February 27th.No contributions on March 5th.No contributions on March 12th.No contributions on March 19th.No contributions on March 29th.No contributions on April 5th.2 contributions on April 12th.No contributions on April 19th.2 contributions on April 26th.No contributions on May 3rd.1 contribution on May 10th.3 contributions on May 17th.4 contributions on May 24th.1 contribution on May 31st.1 contribution on June 7th.No contributions on June 14th.2 contributions on June 21st.1 contribution on June 28th.2 contributions on July 5th.No contributions on July 12th.1 contribution on July 19th.No contributions on July 26th.No contributions on August 2nd.6 contributions on August 9th.5 contributions on August 16th.1 contribution on August 23rd.1 contribution on August 30th.3 contributions on September 6th.No contributions on September 13th.1 contribution on September 20th.No contributions on September 27th.No contributions on October 4th.7 contributions on October 11th.5 contributions on October 18th.2 contributions on October 25th.6 contributions on November 1st.No contributions on November 8th.No contributions on November 15th.1 contribution on November 22nd.3 contributions on November 29th.No contributions on December 6th.No contributions on December 13th.No contributions on December 20th.No contributions on December 27th.No contributions on January 3rd.No contributions on January 10th.No contributions on January 17th.No contributions on January 24th.No contributions on January 31st.No contributions on February 7th.No contributions on February 14th.No contributions on February 21st.No contributions on February 28th.No contributions on March 6th.No contributions on March 13th.No contributions on March 20th.No contributions on March 30th.2 contributions on April 6th.No contributions on April 13th.No contributions on April 20th.No contributions on April 27th.8 contributions on May 4th.2 contributions on May 11th.1 contribution on May 18th.No contributions on May 25th.No contributions on June 1st.1 contribution on June 8th.No contributions on June 15th.No contributions on June 22nd.No contributions on June 29th.No contributions on July 6th.1 contribution on July 13th.1 contribution on July 20th.No contributions on July 27th.No contributions on August 3rd.No contributions on August 10th.4 contributions on August 17th.No contributions on August 24th.3 contributions on August 31st.1 contribution on September 7th.1 contribution on September 14th.4 contributions on September 21st.1 contribution on September 28th.No contributions on October 5th.No contributions on October 12th.2 contributions on October 19th.No contributions on October 26th.No contributions on November 2nd.No contributions on November 9th.No contributions on November 16th.1 contribution on November 23rd.4 contributions on November 30th.No contributions on December 7th.No contributions on December 14th.No contributions on December 21st.No contributions on December 28th.No contributions on January 4th.No contributions on January 11th.No contributions on January 18th.No contributions on January 25th.1 contribution on February 1st.No contributions on February 8th.No contributions on February 15th.No contributions on February 22nd.1 contribution on February 29th.No contributions on March 7th.No contributions on March 14th.No contributions on March 21st.2 contributions on March 31st.3 contributions on April 7th.No contributions on April 14th.No contributions on April 21st.No contributions on April 28th.15 contributions on May 5th.4 contributions on May 12th.No contributions on May 19th.3 contributions on May 26th.5 contributions on June 2nd.No contributions on June 9th.No contributions on June 16th.No contributions on June 23rd.No contributions on June 30th.No contributions on July 7th.3 contributions on July 14th.2 contributions on July 21st.No contributions on July 28th.1 contribution on August 4th.No contributions on August 11th.15 contributions on August 18th.5 contributions on August 25th.2 contributions on September 1st.10 contributions on September 8th.2 contributions on September 15th.No contributions on September 22nd.No contributions on September 29th.No contributions on October 6th.No contributions on October 13th.No contributions on October 20th.1 contribution on October 27th.No contributions on November 3rd.No contributions on November 10th.1 contribution on November 17th.4 contributions on November 24th.No contributions on December 1st.No contributions on December 8th.No contributions on December 15th.No contributions on December 22nd.No contributions on December 29th.No contributions on January 5th.No contributions on January 12th.No contributions on January 19th.No contributions on January 26th.1 contribution on February 2nd.No contributions on February 9th.No contributions on February 16th.No contributions on February 23rd.No contributions on March 1st.No contributions on March 8th.No contributions on March 15th.No contributions on March 22nd.No contributions on April 1st.No contributions on April 8th.No contributions on April 15th.No contributions on April 22nd.No contributions on April 29th.No contributions on May 6th.No contributions on May 13th.No contributions on May 20th.No contributions on May 27th.No contributions on June 3rd.No contributions on June 10th.No contributions on June 17th.No contributions on June 24th.No contributions on July 1st.No contributions on July 8th.3 contributions on July 15th.No contributions on July 22nd.No contributions on July 29th.No contributions on August 5th.2 contributions on August 12th.3 contributions on August 19th.7 contributions on August 26th.1 contribution on September 2nd.No contributions on September 9th.No contributions on September 16th.No contributions on September 23rd.No contributions on September 30th.No contributions on October 7th.No contributions on October 14th.No contributions on October 21st.No contributions on October 28th.No contributions on November 4th.No contributions on November 11th.No contributions on November 18th.No contributions on November 25th.No contributions on December 2nd.No contributions on December 9th.No contributions on December 16th.No contributions on December 23rd.No contributions on December 30th.No contributions on January 6th.No contributions on January 13th.No contributions on January 20th.No contributions on January 27th.No contributions on February 3rd.No contributions on February 10th.No contributions on February 17th.No contributions on February 24th.No contributions on March 2nd.No contributions on March 9th.No contributions on March 16th.No contributions on March 23rd.
Contribution Graph
Day of Week April May June July August September October November December January February March
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Less
No contributions.
Low contributions.
Medium-low contributions.
Medium-high contributions.
High contributions.
More

Contribution activity

March 2024

wondertrader has no activity yet for this period.