forked from morefinances/qlua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete_orders_only_script.lua
More file actions
60 lines (40 loc) · 1.49 KB
/
delete_orders_only_script.lua
File metadata and controls
60 lines (40 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
function OnInit()
class = "QJSIM" -- êëàññ áóìàã: àêöèè
tiker = "SBER" -- òèêåð: Ñáåð
account = "NL0011100043" -- òîðãîâûé ñ÷åò
client_code = "10070" -- êîä êëèåíòà
id_transact = 0 -- id ñ÷åò÷èê âñåõ òðàíçàêöèé
progname = "delete_order_1.0" -- íàçâàíèå ñêðèïòà
code_order = "sndTr_v1"
end
function trasactiondelete(number_order)
id_transact = id_transact + 1
deleteorder =
{
["TRANS_ID"] = tostring(id_transact),
["ACTION"] = "KILL_ORDER",
["CLASSCODE"] = class ,
["SECCODE"] = tiker,
["ACCOUNT"] = account,
["ORDER_KEY"] = tostring(number_order)
}
end
function main()
num_orders = getNumberOf("orders")
for i = num_orders - 1, 0, -1 do
myorder = getItem("orders", i)
if myorder["client_code"]==client_code and myorder["sec_code"]==tiker then
if bit.band(tonumber(myorder["flags"]),1)>0 and string.sub(myorder["brokerref"], 8 , 15) == code_order then
message(progname.." Íîìåð çàÿâêè: "..myorder.order_num)
trasactiondelete(myorder.order_num)
error_transaction = sendTransaction(deleteorder)
sleep(300)
if error_transaction ~= "" then
message(progname.." : îøèáêà ="..error_transaction, 3)
else
message(progname.." : ñíÿòèå çàÿâêè "..myorder["order_num"].." öåíà:"..myorder["price"].." îáúåì: "..myorder["balance"].." êîììåíòàðèé:"..myorder["brokerref"], 2)
end
end
end
end
end