import pandas as pd import numpy as np import ccxt # for fetching cryptocurrency market data
def backtest_crypto(strategy, symbol, start_date, end_date): """ Function to backtest a cryptocurrency trading strategy :param strategy: a callable function that takes two arguments - historical prices and current price The function should return a boolean indicating whether to buy or sell :param symbol: cryptocurrency symbol to test (e.g. 'BTC/USDT') :param start_date: start date of historical data to be fetched (format 'YYYY-MM-DD') :param end_date: end date of historical data to be fetched (format 'YYYY-MM-DD') :return: DataFrame containing the backtesting results """ # initialize exchange API exchange = ccxt.binance() exchange.load_markets()
main.py1928 chars49 lines
main.py960 chars11 lines
gistlibby LogSnag