Skip to content

None Block & Block Mode

Block & Non Block Mode

Shioaji provides return the responsed using Block and Non Block mode, putting the paramter of timeout can change the mode. Timeout default value is 5000 is wait the response for 5 second, but some api for data like tick data will become too large to receive in five second that need to scale up timeout or use Non-Block mode set the timeout as 0. Using cb parameter for Non-Block mode as the callback function.

In

api.place_order?

Out

Signature:
    api.place_order(
        contract: shioaji.contracts.Contract,
        order: shioaji.order.Order,
        timeout: int = 5000,
        cb: Callable[[shioaji.order.Trade], NoneType] = None,
    ) -> shioaji.order.Trade
Docstring: placing order
Type:      method

Block

In

api.place_order(contract, order, timeout=5000)

Non Block

In

api.place_order(contract, order, timeout=0)

Support Function

  • Fuction:
    • ticks
    • place_order
    • update_order
    • cancel_order
    • update_status
    • list_positions
  • Parameter: timeout
  • Parameter type: int
  • Default Mode: Block