Files
strat-playground/strategy/strategy.py
David Chen 05c17f6b5d -
2026-03-14 20:14:33 +08:00

34 lines
729 B
Python

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