Code Monkey home page Code Monkey logo

itrader's People

Contributors

hayyyyyyden avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

itrader's Issues

scan_open_orders 没有遍历完订单池就返回了,导致部分挂单没有成交

在 execution handler 中,scan_open_orders 这个函数用来扫描所有挂单和止损止盈单,�但之前的实现会在找到第一个需要处理的订单时就返回,导致其他订单没有机会处理。

应该把

for order in self.all_orders:
    if xxxx:
        fill_event = xxx
        return fill_event

改成:

fill_events = []
for order in self.all_orders:
    if xxxx:
        fill_event = xxx
        fill_events.append(fill_event)

增加多张同方向的限价订单的控制

如图所示,如果同时满足条件 scan_open_orders 现在会导致同时进场多张订单,可能会导致资金不够。�
image

还没想好怎么 Fix,这个在现实中应该是开限价单的时候broker限制你开不成呢?还是开多少随便,只要单个订单现金足够,然后进场后,其他限价单无法成交呢?需要先搞清楚这个问题。

Moving the close working order logic into api in action event.

Now the logic in execution handler takes too much presumption that when strategy opening new limit/stop order, it will close all the previous ones. While in practice, this should be the responsibility of strategy itself (e.g. calling related API in broker to cancel if needed), not execution handler.

        elif event.type == 'ORDER' and \
                (event.order_type == 'LMT' or event.order_type == 'STP'):
            self._close_sametype_pending_orders_for(event)
            self.all_orders.append(event)

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.