Skip to content

Commit

Permalink
Add timestamp to GMOCoinDataStore (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
MtkN1 committed Nov 10, 2021
1 parent 192735a commit 1dca568
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pybotters/models/gmocoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ def _onmessage(self, mes: Ticker) -> None:
class OrderBookStore(DataStore):
_KEYS = ["symbol", "side", "price"]

def _init(self) -> None:
self.timestamp: Optional[datetime] = None

def sorted(self, query: Optional[Item] = None) -> dict[OrderSide, list[OrderLevel]]:
if query is None:
query = {}
Expand All @@ -308,6 +311,7 @@ def _onmessage(self, mes: OrderBook) -> None:
result = self.find({"symbol": mes["symbol"]})
self._delete(result)
self._insert(cast(list[Item], data))
self.timestamp = mes["timestamp"]


class TradeStore(DataStore):
Expand Down

0 comments on commit 1dca568

Please sign in to comment.