beta_load_historical_data

Fetches historical token prices from cryptocompare

def beta_load_historical_data(
    from_symbol, 
    to_symbol, 
    start_timestamp, 
    end_timestamp, 
    apikey, 
    apilimit=2000, 
    interval='H', 
    exchange='CCCAGG'
)

Parameters

  • from_symbol (str)

    Symbol of the token to get its pricing history.

  • to_symbol (str)

    For fiat, use USD, EUR

  • start_timestamp (int)

    The timestamp at the beginning of the query period.

  • end_timestamp (int)

    The timestamp at the end of the period.

  • apikey (str)

    The API key from CryptoCompare. Register here.

  • apilimit (int)

    The number of items per request. Default set to 2000. You may get a higher limit as a paid customer.

  • interval (str)

    Sampling frequency. Must be one of these options:

    • H for hour

    • D for day

    • T or min for minute. ATTN: by minute has limited availability. Often only available in the most recent 7 days.

  • exchange (str)

    Default to CCCAGG from CryptoCompare.

Return

The historical pricing data in the DataFrame type.

time                datetime64[ns]
high                       float64
low                        float64
open                       float64
volumefrom                 float64
volumeto                   float64
close                      float64
conversionType              object
conversionSymbol            object

Example

Get hourly rate of ETH to USD from 2021-05-01 to 2021-05-02

output = bubbletea.beta_load_historical_data(
    'ETH', 
    'USD', 
    1619827200, 
    1619913600, 
    <API KEY>, 
    2000, 
    interval='H')

print(output)

Last updated

Was this helpful?