Giter VIP home page Giter VIP logo

Comments (6)

quant2008 avatar quant2008 commented on July 17, 2024

米筐成交机制更加有问题的是,如果限价单暂时没有成交,在后续若出现了open价满足成交条件的bar,会以bar的开盘价成交,这会高估成交,实际应该以限价单的限价成交。

from rqalpha.

quant2008 avatar quant2008 commented on July 17, 2024

我对源码做了修订如下:
image
image

from rqalpha.

quant2008 avatar quant2008 commented on July 17, 2024

经过以上修订,一个原来盈利的策略变成了亏损的策略。说明成交机制影响极大

from rqalpha.

Cuizi7 avatar Cuizi7 commented on July 17, 2024
  1. 限价单的含义并不是要求订单以发单价成交,而是要求成交价必须优于发单价;
  2. rqalpha 提供的 current_bar_close 和 next_bar_open 都是一种简化,由于数据不足,无法预测订单在实盘中会以什么价格在什么时间成交,回测引擎只能用一种简化的模型大致给出一个撮合结果。

from rqalpha.

quant2008 avatar quant2008 commented on July 17, 2024

“限价单的含义并不是要求订单以发单价成交,而是要求成交价必须优于发单价;”。更加合理的处理应该是成交价不应优于发单价。

我也理解撮合是近似的,但应该尽量接近实际。比如
假设发限价卖单价格为10元,
下一个bar的ohlc分别为:9,11,8,9,按理应该以10元成交,因为bar中最高为11元,满足成交条件。
但是米筐不看bar中最高价,只看开盘价,这样就无法成交,这明显偏离实际太大,聚宽采用的就是我描述的逻辑,更加合理。

from rqalpha.

HereticSK avatar HereticSK commented on July 17, 2024

更加合理的处理应该是成交价不应优于发单价。

限价单以发单价成交,是假设了本方订单先挂了在盘口上,后续再被对手方主动吃单;以更优价成交,是假设了本方主动吃掉盘口上的对手方。

两种假设都是实际会发生的,并没有绝对谁比谁更合理。对于挂钓鱼单的策略,可能成交场景更多是前者;对于抢单策略,可能更多是后者。作为回测框架来说,目前最理想当然是提供接口,同时支持两种场景。

假设发限价卖单价格为10元,
下一个bar的ohlc分别为:9,11,8,9,按理应该以10元成交,因为bar中最高为11元,满足成交条件。
但是米筐不看bar中最高价,只看开盘价,这样就无法成交

这种情况,我不知道框架里认为订单是哪个时点到达matching engine的。如果认为订单在当前bar到达盘口,那么next bar应该要成交(假设high和low之间的价格都可以成交)。如果认为订单在next bar才到达盘口,10元的SELL不成交,也勉强可以解释为它是在最高价11发生了之后才到达的。这时可能以next bar close来判断更合理?

from rqalpha.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.