This commit is contained in:
David Chen
2026-03-14 20:14:33 +08:00
committed by GitHub
parent ab91804be1
commit 05c17f6b5d
16 changed files with 3177 additions and 0 deletions

33
strategy/strategy.py Normal file
View File

@@ -0,0 +1,33 @@
from abc import ABC, abstractmethod
from internal_types.types import OHLC, BidAsk, Instrument, Position
# todo:
# handle strategy that trades multiple instruments
# fractional position/volume for crypto
# callback for async order
#
# def instruments_to_trade
# def 'stuff' to stream (stock price, vix, ...)
class Strategy(ABC):
@abstractmethod
def unfilled_positions(self, instr: Instrument) -> Position:
pass
@abstractmethod
def order_filled(self, new_pos: Position):
pass
@abstractmethod
def process_bid_ask(self, bid_ask: BidAsk):
pass
@abstractmethod
def process_ohlc(self, ohlc: OHLC):
pass
@abstractmethod
def net_liquid_value(self, at_price: float) -> float:
pass