Large Requests
Both get_rows and stream_rows handle batching of large requests automatically, but if you wish to receive batch responses individually rather than in one final DataFrame, you should use stream_rows.
from velodata import lib as velo
day_in_ms = 1000 * 60 * 60 * 24
# new velo client
client = velo.client('api_key')
# from 5 days ago in 1 minute resolution
# 2 columns * 4 products * 1 exchange * 7200 rows = 57600 values
params = {
'type': 'futures',
'columns': ['open_price', 'close_price'],
'exchanges': ['binance-futures'],
'products': ['LTCUSDT', 'ETCUSDT', 'BCHUSDT', 'SOLUSDT'],
'begin': client.timestamp() - day_in_ms * 5,
'end': client.timestamp(),
'resolution': '1m'
}
# creates 3 batches (57600 values / 22500 limit)
batches = client.batch_rows(params)
# prints each batch as it finishes
for df in client.stream_rows(batches):
print(df)