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:
17
strategies/base.py
Normal file
17
strategies/base.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
class Strategy(ABC):
|
||||
"""
|
||||
Abstract base class for all strategies.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def generate_signals(self, data):
|
||||
"""
|
||||
Generates trading signals for each stock.
|
||||
|
||||
:param data: A pandas DataFrame of historical price data.
|
||||
:return: A pandas Series with the same index as the input data,
|
||||
containing the trading signals (e.g., 'buy', 'hold', 'sell').
|
||||
"""
|
||||
pass
|
||||
Reference in New Issue
Block a user