Example #1
0
def set_aggressive_limit_price(data, broker_order_with_controls):
    limit_trade = broker_order_with_controls.order.order_type == "limit"
    if not limit_trade:
        # market trade, don't bother
        return broker_order_with_controls

    new_limit_price = check_current_limit_price_at_inside_spread(
        broker_order_with_controls)
    if new_limit_price is not None:
        broker_order_with_controls = set_limit_price(
            data, broker_order_with_controls, new_limit_price)

    return broker_order_with_controls
Example #2
0
def set_aggressive_limit_price(
        data: dataBlob,
        broker_order_with_controls: orderWithControls) -> orderWithControls:
    limit_trade = broker_order_with_controls.order.order_type == limit_order_type
    if not limit_trade:
        # market trade, don't bother
        return broker_order_with_controls

    new_limit_price = check_current_limit_price_at_inside_spread(
        broker_order_with_controls)
    if new_limit_price is limit_price_is_at_inside_spread:
        pass
    else:
        broker_order_with_controls = set_limit_price(
            data, broker_order_with_controls, new_limit_price)

    return broker_order_with_controls