You can create and edit the file ExtOrders-YYMMDD.txt inside the Spark Order folder (e.g. today is Dec 10, 2015, the file date will be Spark\ORDERS\ExtOrders-151210.txt ). A seperate file is needed for every trade day.
[Protocol] Name=External Order File Version=1.00 Description=External Order File [Orders] [Modify Orders] [Delete Orders]
Add Order
To place an order to Spark, add a line under the [Orders]
[Orders] 20151210-002=Is Simulation=NO~Action=BUY~Product ID=HSIZ5~Price=21700~Quantity=1
Order Feedback
You can then check the Feedback file ExtOrders_Feedback-YYMMDD.txt in the Orders folder (e.g. for Dec 10, 2015, the file name will be Spark\ORDERS\ExtOrders_Feedback-151210.txt)
[Orders] 20151210-002=[Feedback]~Status=Working~Status At=15-12-10 14:36:22.714~~
After the order is accepted, it will shows the order Status as Working
Modify Order
If you need to modify the Order Price, you can add a line under [Modify Orders] in the file ExtOrders-YYMMDD.txt e.g.
[Modify Orders]
002=ID=20151210-002~Price=21710
The feedback of this order in the feedback file will then become:
20151210-002=[Feedback]~Status=Working~Status At=15-12-10 14:44:42.539~Modify History=002~~
Note, the Modification ID at the end of the above line.
If you modify the same order again, you need to give a new Modification ID to it and add another line e.g.
003=ID=20151210-002~Price=21740
If the order is then executed (filled), the feedback line will be like:
20151210-002=[Feedback]~Status=Traded~Status At=15-12-10 14:46:50.321~Modify History=002->003~Traded Quantity=1~Average Traded Price=21739~Last Traded At=15-12-10 14:46:50.271~~
The Traded Quantity and Average Traded Price of the order will be added to the feedback line.
Note: You can only modify the order Price and/or reduce Quantity after the order is accepted by the system.
Stop Loss Order
To ADD a Stop Loss Order, you must add the 3 additional fields "Condition Type", "Stop Level", "Stop Toler". The field Price is ignored.
20151214-002=Is Simulation=NO~Condition Type=Stop Loss~Action=BUY~Product ID=HSIZ5~Stop Level=21400~Stop Toler=4~Quantity=2
To modify such an order, you can add a line under [Modify Orders]
001=ID=20151214-002~Stop Level=21430~Stop Toler=5~Quantity=1
You do not have to modify all of these fields at the same time. You can just choose one field to modify like:
002=ID=20151214-002~Stop Toler=5
or
003=ID=20151214-002~Stop Level=21435
or
004=ID=20151214-002~Price=21105
or
005=ID=20151214-002~Quantity=1
One Cancels the Other Stop Loss Order
To add an OCO Stop Loss Order, add a line under [Orders] with 3 additional fields "Condition Type", "Stop Level", "Stop Toler".
20151214-003=Is Simulation=NO~Condition Type=OCO Stop Loss~Action=BUY~Product ID=HSIZ5~Stop Level=21400~Stop Toler=4~Quantity=1~Price=21100
To modify such an order, you can add a line under [Modify Orders]
001=ID=20151214-003~Stop Level=21430~Stop Toler=5~Quantity=1~Price=21101
You do not have to modify all of these fields at the same time. You can just choose one field to modify like:
002=ID=20151214-003~Stop Toler=5
or
003=ID=20151214-003~Stop Level=21435
or
004=ID=20151214-003~Price=21105
Leave a reply