-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathOnQuote_2.lua
More file actions
46 lines (33 loc) · 952 Bytes
/
OnQuote_2.lua
File metadata and controls
46 lines (33 loc) · 952 Bytes
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
function OnInit()
LASTBID = 0
LastQBid = 0
LASTOFFER = 0
LastQOffer = 0
end
function OnStop()
do_it = false
end
function OnQuote(class, tiker)
if class == "TQBR" and tiker == "SBER" then
quotelvl = getQuoteLevel2("TQBR", "SBER")
if quotelvl and quotelvl.bid then
offer = tonumber(quotelvl.offer[1].price)
quant_offer = tonumber(quotelvl.offer[1].quantity)
bid = tonumber(quotelvl.bid[tonumber(quotelvl.bid_count)].price)
quant_bid = tonumber(quotelvl.bid[tonumber(quotelvl.bid_count)].quantity)
if offer~=LASTOFFER or bid ~= LASTBID or quant_offer ~= LastQOffer or quant_bid ~= LastQBid then
message(offer.." ð. "..quant_offer.." / "..bid.." ð. "..quant_bid)
LASTBID = bid
LastQBid = quant_bid
LASTOFFER = offer
LastQOffer = quant_offer
end
end
end
end
function main()
do_it = true
while do_it do
sleep(1000)
end
end