Backtesting engine supporting 11 strategies across US (S&P 500) and CN (CSI 300) markets with open-to-close execution, proportional + fixed per-trade fees. Daily trader (trader.py) with auto/morning/evening/simulate/status commands and cron-friendly `auto` mode for unattended daily runs on a server. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
16 lines
395 B
Python
16 lines
395 B
Python
import pandas as pd
|
|
from strategies.base import Strategy
|
|
|
|
class BuyAndHoldStrategy(Strategy):
|
|
"""
|
|
A simple buy and hold strategy.
|
|
"""
|
|
|
|
def generate_signals(self, data):
|
|
"""
|
|
Generates equal weights for all assets.
|
|
"""
|
|
tickers = data.columns
|
|
weights = pd.DataFrame(1 / len(tickers), index=data.index, columns=tickers)
|
|
return weights
|