Conditional order question about ib_insync (API) in python

Discussion in 'Interactive Brokers' started by orangelam, Feb 13, 2019.

  1. Hi,
    I have two questions about placing order using python API

    1)
    what's the time format of goodtilldate?
    i tried to use something like
    order.goodTillDate="20190213 23:55:00"
    but it won't work...
    and also, how can we also tell the timezone of this time?

    2)
    Given that a market long order has already been filled in the morning. I want to send out a stop loss order and if this stop order has not been filled 1min before market close, i want to settle my position and cancel this stop order. If the stop loss order has been filled in intraday, then no additional action is needed.

    one of the ideas is to create a stop loss order with goodtilldate (say, 1min before market close), and if this order is cancelled by the system (meaning not filled until 1min before market close) then trigger a market order to settle my position.

    i guess there is something like conditional order... can anyone show me a simple example on how to do that?

    many thanks!!
     
  2. as i use ib_insync API instead of the official API.
    can you give me an example?
     
  3. I'm not familiar with ib_insync.