Example: Orderbook reading

0 47 Views No Comments 2 months ago
  • 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 Code
    -- 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
Login or Register to Comment

Unlock your crypto trading potential

Create a free account and enjoy everything we have to offer.

Join for Free