Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed May 28, 2019
1 parent 5d21939 commit be40fa6
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
1 change: 0 additions & 1 deletion aat/data_source.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from abc import ABCMeta, abstractmethod
from typing import Set
from .callback import Callback
from .structs import TradeRequest, TradeResponse
from .enums import TickType
Expand Down
45 changes: 45 additions & 0 deletions aat/strategies/data_capture.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from ..strategy import TradingStrategy
from ..structs import MarketData, TradeResponse
from ..logging import STRAT as slog, ERROR as elog


class DataCaptureStrategy(TradingStrategy):
def __init__(self, filename) -> None:
super(DataCaptureStrategy, self).__init__()
self.filename = filename

def onBuy(self, res: TradeResponse) -> None:
slog.info(res)

def onSell(self, res: TradeResponse) -> None:
slog.info(res)

def onTrade(self, data: MarketData) -> bool:
slog.info(data)

def onError(self, e) -> None:
elog.critical(e, type(e))

def onExit(self) -> None:
self.cancelAll(lambda *args: True)

def onChange(self, data: MarketData) -> None:
slog.info(data)

def onFill(self, data: MarketData) -> None:
slog.info(data)

def onCancel(self, data: MarketData) -> None:
slog.info(data)

def onOpen(self, data: MarketData) -> None:
slog.info(data)

def slippage(self, resp: TradeResponse) -> TradeResponse:
return resp

def transactionCost(self, resp: TradeResponse) -> TradeResponse:
return resp

def onAnalyze(self, _) -> None:
pass

0 comments on commit be40fa6

Please sign in to comment.