From 5b9c7c061f112a31be62231db069ecf436e85399 Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Thu, 21 Mar 2024 12:12:28 +0100 Subject: [PATCH] More on forward-fill --- source/glossary.rst | 23 ++++++++++++++++--- .../programming/market-data/candle-format.rst | 11 +++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/source/glossary.rst b/source/glossary.rst index b433d93..9a301e7 100644 --- a/source/glossary.rst +++ b/source/glossary.rst @@ -433,6 +433,8 @@ and algorithmic trading. - :term:`Bucket` + - :term:`Forward fill` + Time frame See :term:`bucket`. @@ -539,8 +541,22 @@ and algorithmic trading. Dataset - A data bundle consisting of :term:`candles ` or other quantitative data sources. - The most usual dataset is hourly or daily candles for multiple assets, distributed as a downloadable archive of several hundreds of megabytes. + In :term:`quantitative finance`, a dataset is a data bundle consisting of :term:`candles ` or other quantitative data sources. + The most usual dataset is hourly or daily :term:`OHLCV` candles for multiple assets. + + Datasets can be anywhere between megabytes to several gigabytes. + + `See Trading Strategy free and open datasets `__. + + See also + + - :term:`OHLCV` + + - :term:`Forward fill` + + - :term:`Jupyter notebook` + + - :term:`Machine learning` Dataset server @@ -3957,7 +3973,8 @@ and algorithmic trading. Alternative methods for handling missing data include backward fill (carrying the next observed value backward) or more sophisticated imputation techniques that estimate missing values based on statistical methods or predictive models. The choice of method depends on the specific characteristics of the dataset and the objectives of the analysis. - The :term:`Trading Strategy Framework` gives you various :term:`Python` functions for forward-fill, especially for :term:`OHLCV` data. See :term:`documentation` for more info. + The :term:`Trading Strategy Framework` gives you various :term:`Python` functions for forward-fill, especially for :term:`OHLCV` data. See ref:`forward filling data` + in the documentation for more information. See also diff --git a/source/programming/market-data/candle-format.rst b/source/programming/market-data/candle-format.rst index cc1eef8..bc40647 100644 --- a/source/programming/market-data/candle-format.rst +++ b/source/programming/market-data/candle-format.rst @@ -30,6 +30,8 @@ This is because we believe this formats fit better for DeFi market data feeds Furthermore there are no opening and closing auctions as one might have at stock markets. +.. forward filling data: + Forward filling data -------------------- @@ -51,6 +53,15 @@ following: - For any missing sparse timestamps, generate a candle where open/high/low close are set the the volume to zero using :term:`forward fill`. +Some methods for forward fill your data: + +- :py:meth:`tradeexecutor.strategy.trading_strategy_universe.TradingStrategyUniverse.create_from_dataset` + takes `forward_fill` argument (`False` by default). You can use this in your `create_trading_universe` + function to forward fill loaded data. + +- For low-level forward filling see :py:func:`tradingstrategy.utils.groupeduniverse.resample_candles` + and :py:func:`tradingstrategy.utils.groupeduniverse.resample_series`. + Distinction between buys and sells ----------------------------------