API

Python functions for phBot Crypto

get_bars(exchange, pair, granularity)

This function retrieves historical bars for a given pair from an exchange. Granularity is in seconds.

Usage

get_bars(EX_COINBASE, 'BTC-USD', 60)

Returns

None or a list containing the historical bars in JSON.

[{
   't': 1663858740,
   'o': 18865.76,
   'h': 18891.17,
   'l': 18855.5,
   'c': 18879.53,
   'v': 41.84053623
}, {
   't': 1663858680,
   'o': 18893.84,
   'h': 18900.26,
   'l': 18862.77,
   'c': 18866.74,
   'v': 41.47941474
}, {
   't': 1663858620,
   'o': 18896.58,
   'h': 18904.81,
   'l': 18882.33,
   'c': 18892.81,
   'v': 50.05292682
}, {
   't': 1663858560,
   'o': 18908.72,
   'h': 18917.8,
   'l': 18878.35,
   'c': 18898.82,
   'v': 29.25498139
}, {
   't': 1663858500,
   'o': 18911.94,
   'h': 18912.82,
   'l': 18883.5,
   'c': 18909.35,
   'v': 38.71486704
}

...etc

]

Last updated