stbt.download_ohlc package

Submodules

stbt.download_ohlc.cryptocurrency module

Module to download cryptocurrency ohlc data

stbt.download_ohlc.cryptocurrency.from_datetime_to_unix(date)[source]

in: datetime, out: unix_timestamp

stbt.download_ohlc.cryptocurrency.from_unix_to_date(date)[source]

in: unix_timestamp, out: datetime

stbt.download_ohlc.cryptocurrency.str_to_datetime(time_str)[source]

in: str, out: datetime

stbt.download_ohlc.cryptocurrency.columns_to_upper_case(df_ohlc)[source]

in : df, out : df, Makes all columns of df start with capital letter

stbt.download_ohlc.cryptocurrency.correct_ohlc_df(df_ohlc, frequency=None, cols_to_drop=None)[source]

Function to modify df to the required format, checking for wrong entries and filling nans

Parameters
  • df_ohlc (DataFrame) – Close, Open, Low, High and Volume columns are necessary

  • frequency (str) – Resample frequency ‘D’, ‘W’, ‘M’, if None - do not resample data

  • cols_to_drop (list) – names of unnecessary columns in df

Returns

Repaired df

Return type

df (DataFrame)

stbt.download_ohlc.cryptocurrency.get_ohlc_cryptocompare_once(first_ticker, second_ticker, end_date=datetime.datetime(2021, 4, 7, 16, 12, 34, 399203), aggregate=1, interval_key='day')[source]

Retrieve limited bulk of ohlc cryptocurrency data from Cryptocompare.

Parameters
  • first_ticker (str) – Crypto symbol(BTC).

  • second_ticker (str) – Crypto symbol(USD).

  • aggregate (int) – How many points should be made into one

  • interval_key (str) – Time interval of data points

  • end_date (datetime) – Last moment in ohlc data

Returns

DF containing the opening price, high price, low price, closing price, and volume.

Return type

df_ohlc (pandas.DataFrame)

Note

Data is limited(only 2000 point of data will be given)

stbt.download_ohlc.cryptocurrency.get_ohlc_cryptocompare(first_ticker, second_ticker, start_date, end_date=datetime.datetime(2021, 4, 7, 16, 12, 34, 399210), **kwargs)[source]

Retrieves ohlc cryptocurrency data from Cryptocompare.

Parameters
  • first_ticker (str) – Crypto symbol(BTC).

  • second_ticker (str) – Crypto symbol(USD).

  • start_date (datetime) – First moment in ohlc data

  • end_date (datetime) – Optional.Last moment in ohlc data

  • aggregate (int) – Optional.How many points should be made into one

  • interval_key (str) – Optional.Time interval of data points

Returns

DF containing the opening price, high price, low price, closing price, and volume.

Return type

df_total (pandas.DataFrame)

Note

This this loop for get_ohlc_cryptocompare_once

Module contents

Module to make package from folder