Пример #1
0
    def MidpointMatch(action: str, quantity: float):

        #! [midpoint_match]
        order = Order()
        order.action = action
        order.orderType = "MKT"
        order.totalQuantity = quantity
        #! [midpoint_match]
        return order
Пример #2
0
 def create_order(sAction, iTotalQuantity, sOrderType, sLmtPrice):
     order = Order()
     order.action = sAction
     order.totalQuantity = iTotalQuantity
     order.orderType = sOrderType
     order.lmtPrice = sLmtPrice
     order.faGroup = GROUP_NAME
     order.faMethod = "NetLiq"
     return order
Пример #3
0
    def MarketOnClose(action: str, quantity: float):

        #! [market_on_close]
        order = Order()
        order.action = action
        order.orderType = "MOC"
        order.totalQuantity = quantity
        #! [market_on_close]
        return order
Пример #4
0
 def LimitOrder(action, quantity, limit_price):
     # ! [limitorder]
     order = Order()
     order.action = action
     order.orderType = "LMT"
     order.totalQuantity = quantity
     order.lmtPrice = limit_price
     # ! [limitorder]
     return order
Пример #5
0
 def sell_limit_price(volume, price, tp='OG'):
     order = Order()
     order.action = 'SELL'
     order.orderType = 'LMT'
     order.totalQuantity = volume
     order.lmtPrice = price
     order.transmit = True
     order.tif = 'DAY' if tp == 'OG' else 'GTC'
     return order
def create_adaptive_order(action, order_type, quantity):
    order = Order()
    order.action = action
    order.orderType = order_type
    order.totalQuantity = quantity
    order.algoStrategy = "Adaptive"
    order.algoParams = []
    order.algoParams.append(TagValue("adaptivePriority", "Normal"))
    return order
Пример #7
0
def stop_order(order_id, action, size, stopPrice):
    app.reqIds(-1)
    order = Order()
    order.action = action
    order.orderType = "STP"
    order.auxPrice = stopPrice
    order.totalQuantity = size
    app.placeOrder(order_id, contract(), order)
    log(f'stop order placed {order_id, action, size, stopPrice}')
Пример #8
0
 def LimitOrder(action: str, quantity: float, limitPrice: float):
     # ! [limitorder]
     order = Order()
     order.action = action
     order.orderType = "LMT"
     order.totalQuantity = quantity
     order.lmtPrice = limitPrice
     # ! [limitorder]
     return order