diff --git a/backtester/event.py b/backtester/event.py deleted file mode 100644 index ea317d1..0000000 --- a/backtester/event.py +++ /dev/null @@ -1,34 +0,0 @@ -class Event(): - """ - Event is base class providing an interface for all subsequent - (inherited) events, that will trigger further events in the - trading infrastructure. - """ - pass - - -class MarketEvent(Event): - """ - Handles the event of receiving a new market update with - corresponding bars. - """ - - def __init__(self): - self.type = "MARKET" - - -class SignalEvent(Event): - """ - Handles the event of receiving a signal form the Strategy - object. - Portfolio object processes buy/sell orders. - """ - - def __init__(self, symbol, direction, strength): - """symbol: ticker symbol - direction: BUY | SELL - strength: (%Win chance, Win/Loss ratio)""" - self.type = "SIGNAL" - self.symbol = symbol - self.direction = direction - self.strength = strength diff --git a/backtester/strategy/balanced.py b/backtester/strategy/balanced.py deleted file mode 100644 index b73717a..0000000 --- a/backtester/strategy/balanced.py +++ /dev/null @@ -1,29 +0,0 @@ -from .strategy import Strategy -from ..event import SignalEvent - - -class Balanced(Strategy): - """Balanced portfolio strategy. - Inspired by Ray Dalio's all weather portfolio. - """ - - def __init__(self, - data_handler, - events, - symbols=[ - "VOO", "GLD", "VNQ", "VNQI", "TLT", "TIP", "BNDX", "EEM", - "RJI" - ]): - self.data_handler = data_handler - self.symbols = symbols - self.events = events - self._bought = False - - def generate_signals(self, event): - if not self._bought: - for symbol in self.symbols: - buy_signal = SignalEvent( - symbol=symbol, direction="BUY", strength=(1.0, 100)) - self.events.put(buy_signal) - - self._bought = True diff --git a/backtester/strategy/benchmark.py b/backtester/strategy/benchmark.py deleted file mode 100644 index ad13acd..0000000 --- a/backtester/strategy/benchmark.py +++ /dev/null @@ -1,18 +0,0 @@ -from .strategy import Strategy -from ..event import SignalEvent - - -class Benchmark(Strategy): - """Simple buy and hold SPX strategy""" - - def __init__(self, data_handler, events): - self.data_handler = data_handler - self.events = events - self._bought = False - - def generate_signals(self, event): - if not self._bought: - buy_signal = SignalEvent( - symbol="SPX", direction="BUY", strength=(1.0, 100)) - self.events.put(buy_signal) - self._bought = True diff --git a/backtester/utils.py b/backtester/utils.py deleted file mode 100644 index 523cd62..0000000 --- a/backtester/utils.py +++ /dev/null @@ -1,15 +0,0 @@ -import os - - -def get_data_dir(): - """Reads data path from environment variable $OPTIONS_DATA_PATH. - If it is not set, defaults to `data/` - """ - - if "OPTIONS_DATA_PATH" in os.environ: - data_dir = os.path.expanduser(os.environ["OPTIONS_DATA_PATH"]) - else: - data_dir = "data" - os.mkdir(data_dir) - - return data_dir