-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |