Example: Last trades reading

0 41 Views No Comments 2 months ago
  • This example shows how you can read the contents of the orderbooks in HaasScript.

    NOTE: Last trades is real-time data and can not be backtested, only paper-traded.

    HaasScript Code
    -- NOTE: Last trades is real-time data and can not be backtested, only paper-traded.
    
    -- Running at high speed is highly recommended because last trades often change
    EnableHighSpeedUpdates()
    
    -- The last trades is provided to us as a simple array
    lastTrades = GetLastTrades()
    
    -- So we can just loop them or look in the values
    Log('Trades')
    for i=3, 1, -1 do
        Log(lastTrades[i][1]) -- And display the price
    end
    -- DoBuy DoSell
Login or Register to Comment

Unlock your crypto trading potential

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

Join for Free