Example: Orderbook reading
stableDescription
This example shows how you can read the contents of the orderbooks.
NOTE: Orderbook data is real-time data and can not be backtested, only paper-traded.
HaasScript
-- NOTE: Orderbook data is real-time data and can not be backtested, only paper-traded.
-- Running at high speed is highly recommended because orderbooks always change
EnableHighSpeedUpdates()
-- The orderbook is provided to us as a simple array
askOrders = GetOrderbookAsk()
bidOrders = GetOrderbookBid()
-- So we can just loop them or look in the values
Log('Asks')
for i=3, 1, -1 do
Log(askOrders[i])
end
Log('Bids')
for i=3, 1, -1 do
Log(bidOrders[i])
end
0 Comments
Sign in to leave a comment.
No comments yet. Be the first!