Title: Code Duplication Between Files: Consolidate fetch_binance_ohlcv Function
Body:
The fetch_binance_ohlcv function is duplicated in both backtesting_tool.py and strategy-update-backtest.py. This violates the DRY (Don't Repeat Yourself) principle and makes maintenance more difficult.
To address this, extract the fetch_binance_ohlcv function into a separate module (e.g., data_fetcher.py) and import it into both scripts. This will ensure that any changes or bug fixes to the data fetching logic are applied consistently across all scripts.
# data_fetcher.py
import requests
import pandas as pd
def fetch_binance_ohlcv(symbol, interval='1d', limit=365):
# ... (Implementation of fetch_binance_ohlcv)
pass
Then, in both backtesting_tool.py and strategy-update-backtest.py:
from data_fetcher import fetch_binance_ohlcv
This refactoring reduces code duplication and improves maintainability.
Title: Code Duplication Between Files: Consolidate
fetch_binance_ohlcvFunctionBody:
The
fetch_binance_ohlcvfunction is duplicated in bothbacktesting_tool.pyandstrategy-update-backtest.py. This violates the DRY (Don't Repeat Yourself) principle and makes maintenance more difficult.To address this, extract the
fetch_binance_ohlcvfunction into a separate module (e.g.,data_fetcher.py) and import it into both scripts. This will ensure that any changes or bug fixes to the data fetching logic are applied consistently across all scripts.Then, in both
backtesting_tool.pyandstrategy-update-backtest.py:This refactoring reduces code duplication and improves maintainability.