research.candle
Documentation for eth_defi.research.candle Python module.
Create OHLCV candle charts.
Allows analysing of cryptocurrency price data in notebooks.
Create OHLCV charts out from pandas.DataFrame price data.
Functions
|
Create OHLCV candles based on raw trade events. |
- convert_to_ohlcv_candles(df, time_frame=Timedelta('1 days 00:00:00'), price_column='price', value_column='value', timestamp_index_column='timestamp')
Create OHLCV candles based on raw trade events.
Example:
candles = convert_to_ohlcv_candles(df, time_bucket=pd.Timedelta("4h"))
See the full example in Uniswap v3 OHLCV notebook.
- Parameters
df (pandas.core.frame.DataFrame) – Input data frame.
time_frame (pandas._libs.tslibs.timedeltas.Timedelta) – What’s the duration of a single candle.
price_column (str) – The dataframe column containing the price of a trade. Used to generate open, high, low and close columns.
value_column (str) – The dataframe column containing the price of a trade. Used to generate volume column.
timestamp_index_column (Optional[str]) – If given then convert this timestamp column to an index. It can contain ISO8601 string timestamp, or be a timestamp column.
- Returns
pd.DataFramewith open, high, low, close and volume columns. Index is resampled timestamp.- Return type
pandas.core.frame.DataFrame