Initial commit: quant backtesting framework with daily trading simulator
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>
This commit is contained in:
15
strategies/buy_and_hold.py
Normal file
15
strategies/buy_and_hold.py
Normal file
@@ -0,0 +1,15 @@
|
||||
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
|
||||
Reference in New Issue
Block a user