Fix historical runner: store actual ticker name (BTC/ETH/HYPE/VVV) not timestamp
- Added HYPE and VVV to --coin choices - Fixed coin field to store ticker name instead of first candle timestamp - Added coin_name parameter to simulate_strategy_on_candles
This commit is contained in:
@@ -81,6 +81,7 @@ def fetch_candles(coin: str, interval: str = "1h", limit: int = 720) -> list[dic
|
||||
def simulate_strategy_on_candles(
|
||||
key: str,
|
||||
candles: list[dict],
|
||||
coin_name: str = "BTC",
|
||||
allocation: float = 100.0,
|
||||
fee_tier: int = 0,
|
||||
staking_tier: str = "none",
|
||||
@@ -289,7 +290,7 @@ def simulate_strategy_on_candles(
|
||||
return {
|
||||
"strategy": name,
|
||||
"strategy_key": key,
|
||||
"coin": candles[0]["t"] if candles else "unknown",
|
||||
"coin": coin_name, # actual ticker (BTC, ETH, etc.)
|
||||
"allocation": allocation,
|
||||
"start_time": curve[0]["t"] if curve else "",
|
||||
"end_time": curve[-1]["t"] if curve else "",
|
||||
@@ -319,7 +320,7 @@ def simulate_strategy_on_candles(
|
||||
|
||||
def main():
|
||||
p = argparse.ArgumentParser(description="FTDT Historical Backtest Runner")
|
||||
p.add_argument("--coin", default="BTC", choices=["BTC", "ETH", "SOL"], help="Coin to backtest")
|
||||
p.add_argument("--coin", default="BTC", choices=["BTC", "ETH", "SOL", "HYPE", "VVV"], help="Coin to backtest")
|
||||
p.add_argument("--strategy", "-s", choices=list(STRATEGIES) + ["all"], default="all")
|
||||
p.add_argument("--fee-tier", type=int, default=0, choices=range(7))
|
||||
p.add_argument("--staking-tier", default="none", choices=list(STAKING_TIERS.keys()))
|
||||
@@ -355,7 +356,7 @@ def main():
|
||||
print(f"\n Running: {cfg['name']} on {a.coin}...")
|
||||
|
||||
result = simulate_strategy_on_candles(
|
||||
key, candles,
|
||||
key, candles, a.coin,
|
||||
fee_tier=a.fee_tier,
|
||||
staking_tier=a.staking_tier,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user