Order Execution

Hi, 

Can you help me with a code for the following order exceution strategy:

 

The model would calculate the target price every min. The price calculaated by model to be rounded off to two decimal
digits. The price so calculated becomes the Target Price (TP)
First Trade Order: If the New TP is more than Current price, BUY. If the New TP is less than Current Price than Sell
If the New TP=Current Price, then we don’t trade
Target Price order shall be placed as well along with Buy/Sell Order which would be equal to the target price. If the target
price has been met, no new order during that min.
At the end of every min, if the target has been met, then we go back to first trade order condition again
If the target has not been met during the min, then we get the new target price from the model and do the following 
If we Sell under First Trade Order, and the new target price is less than current market price, we continue to hold the
order and place a new target price order
If we Buy under First Trade Order, and the new target price is more than current market price, we continue to hold the
order and place a new target price order
If we Sell under First Trade Order, and the new target price is more than current market price, we exit the current position and take a fresh Buy position (i.e. double Buy at current maret price). Also place a new target price order
If we Buy under First Trade Order, and the new target price is less than current market price, we exit the current
order and take a fresh Sell position (i.e. double Sell at current maret price). Also place a new target price order
If we Buy/Sell under First Trade Order and the new target price is equal to the current market price, exit the existing trade and put no new orders

Hello Ashish,



You might want to look at the blogs within the following heading:  https://blog.quantinsti.com/tag/python-for-trading/

Can you let me know which blog are you referring to?

Hello Ashish,



You can check out the tutorials on pandas and numpy. You should be able to implement the above algorithm successfully using these packages.