

function dolog
    test -f /tmp/rate_limit ; and echo 'RATE LIMIT' >> out.log ; and return

    set err (curl 'https://api.binance.com/api/v3/depth?symbol=BTCUSDT' >> out.log -v 2>| grep 'HTTP/[^ ]* 4')
    echo '' >> out.log
    test $err != '' ; and begin
        echo 1 > /tmp/rate_limit
        sleep 60 # TODO
        rm /tmp/rate_limit
    end
end
function dolog2
    test -f /tmp/rate_limit ; and echo 'RATE LIMIT' >> out.log ; and return

    set err (curl 'https://api.binance.com/api/v3/avgPrice?symbol=BTCUSDT' >> out.log -v 2>| grep 'HTTP/[^ ]* 4')
    echo '' >> out.log
    test $err != '' ; and begin
        echo 1 > /tmp/rate_limit
        sleep 60 # TODO
        rm /tmp/rate_limit
    end
end


dolog
dolog2

