Esempio n. 1
0
def get_market_finder_order_info(order_info):
    limit = OrderInfo(Worker.DIRECT, OrderType.LIMIT, OrderRes.NONE, OrderMod.NONE,
                      Tif.GTD, Side.BUY, ProductType.FUTURE)
    market = OrderInfo(Worker.DIRECT, OrderType.MARKET, OrderRes.NONE, OrderMod.NONE,
                       Tif.GTD, Side.BUY, ProductType.FUTURE)
    if order_info.mod == OrderMod.STOP:
        if order_info.otype == OrderType.MARKET:
            return market.clone(order_info.primary_worker, order_info.mod, order_info.prod_type)
        if order_info.otype == OrderType.LIMIT:
            return limit.clone(order_info.primary_worker, order_info.mod, order_info.prod_type)
    if order_info.mod == OrderMod.IF_TOUCHED:
        if order_info.otype == OrderType.MARKET:
            return market.clone(order_info.primary_worker, order_info.mod, order_info.prod_type)
        if order_info.otype == OrderType.LIMIT:
            return limit.clone(order_info.primary_worker, order_info.mod, order_info.prod_type)
    if order_info.otype == OrderType.MARKET:
        return market.clone(order_info.primary_worker, order_info.prod_type)
    return limit.clone(order_info.primary_worker, order_info.prod_type)
Esempio n. 2
0
def get_reject_order_info(field):
    limit = OrderInfo(Worker.DIRECT, OrderType.LIMIT, OrderRes.NONE,
                      OrderMod.NONE, Tif.GTD, Side.BUY, ProductType.FUTURE)
    return limit.clone(field)