Skip to main content

Non-blocking Orders

First, let's begin by understanding blocking and non-blocking operations. They are two ways of describing events, operations, or communication. Their basic concepts and differences are as follows:

Blocking

Blocking operations occur in a predetermined sequence: one operation must complete before the next can begin. They are typically used in queue processing, where a task must wait for another to finish before proceeding.

block

Non-blocking

Non-blocking operations do not have to occur in a fixed sequence and can run in parallel. One operation does not need to wait for another to complete. Non-blocking processing is typically used in multitasking environments to improve efficiency and performance.

unblock

Place an order using a blocking operation

After placing the order, the Order Response received will contain the complete data, including fields such as the order number.

#Create Order Object
order = FutOptOrder(
buy_sell = BSAction.Buy,
symbol = "TXFD4",
price = "20000",
lot = 1,
market_type = FutOptMarketType.Future,
price_type = FutOptPriceType.Limit,
time_in_force = TimeInForce.ROD,
order_type = FutOptOrderType.Auto,
user_def = "FromPy" # optional field
)

sdk.stock.place_order(accounts.data[0], order) #Place Order

#Or Using
#sdk.stock.place_order(accounts.data[0], order, False)

Using Unblock

After placing the order, the Order Response received will not contain the complete data, such as the order number.

#Create Order Object
order = FutOptOrder(
buy_sell = BSAction.Buy,
symbol = "TXFD4",
price = "20000",
lot = 1,
market_type = FutOptMarketType.Future,
price_type = FutOptPriceType.Limit,
time_in_force = TimeInForce.ROD,
order_type = FutOptOrderType.Auto,
user_def = "FromPy" # optional field
)

sdk.futopt.place_order(accounts.data[0], order, True) #Place Order

The following are functions that support Unblock orders:

  • PlaceOrder - Plcae Order
  • ModifyPrice - Modify Order Price
  • ModifyQuantity - Modify Order Quantity
  • CancelOrder - Cancel Order