Skip to content

Issue 2: Code Duplication #5

@PrinceSajjadHussain

Description

@PrinceSajjadHussain

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions