Place Order Operations
Operations are mini automations that can be set to efficiently execute orders. By setting order operations, it allows the system to monitor your order closely and cancel and modify it as per the set rules.
We'll be adding more such order operations in the futures, currently we only have operations feature available for Limit
order.
Limit Order Operations
To utilize the operations you need to use operations
variable.
Default Operations :
# {"timeLimit": 0,"shouldExecute": False,"priceBuffer": 0}
spk.placeorder(strategyName='test1',
orderType='Market',
productType='Intraday',
token = 'NSE:212',
qty = 1,
operations= {
"timeLimit": 0,
"shouldExecute": False,
"priceBuffer": 0
},
transType = 'Buy',
limitPrice=0,
splitby = 0)
shouldExecute
:
Action to be taken on a order if timeLimit
or priceBuffer
is exceeded.
It takes a boolean value which is eithe True
or False
. If True
, order will be modified to the best available price (every second) till the order is executed. If False
, order will be cancelled.
timeLimit
:
This is the time to wait for an order to execute. If order is not executed in the given time, it will take action on the order as per shouldExecute
field.
priceBuffer
:
Price range to wait from the limit price to execute an order. If you select Buy
as transaction type and an order is sent with a limitPrice
of 100 Rs with priceBuffer
of 2 Rs., when the price goes beyond 102 (100 (limitPrice
) + 2 (priceBuffer
)), action will be taken on the order as per shouldExecute
field.
Example :
Let's say current price of an instrument is 101.5 Rs and I placed an order (as per my strategy) to get at 101. Now using the operations, if I set timeLimit
(maximum time to wait) to 60 seconds and priceBuffer
to 2 Rs. and shouldExecute
to True, the order will wait either for price to cross 103 or it will wait for 60 seconds after the order is placed for a fill to happen. If order is not filled, it will start modifying the order to best bid price every second till the order is filled.
(Since we support multibroker trading, this will happen in all the accounts to which the strategy is linked.)
spk.placeorder(strategyName='test1',
orderType='Market',
productType='Intraday',
token = 'NSE:212',
qty = 1,
operations= {
"timeLimit": 60,
"shouldExecute": True,
"priceBuffer": 2
},
transType = 'Buy',
limitPrice=0,
splitby = 0)