Skip to content

Commit

Permalink
Add some todo-reminders for msgspec stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Jul 8, 2022
1 parent de91c21 commit 87aa1e3
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions piker/clearing/_messages.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# piker: trading gear for hackers
# Copyright (C) Tyler Goodlet (in stewardship for piker0)
# Copyright (C) Tyler Goodlet (in stewardship for pikers)

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
Expand All @@ -15,7 +15,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.

"""
Clearing system messagingn types and protocols.
Clearing sub-system message and protocols.
"""
from typing import Optional, Union
Expand All @@ -24,6 +24,12 @@
from ..data.types import Struct


# TODO: ``msgspec`` stuff worth paying attention to:
# - schema evolution: https://jcristharif.com/msgspec/usage.html#schema-evolution
# - use literals for a common msg determined by diff keys?
# - https://jcristharif.com/msgspec/usage.html#literal
# - for eg. ``BrokerdStatus``, instead just have separate messages?

# --------------
# Client -> emsd
# --------------
Expand All @@ -40,13 +46,18 @@ class Cancel(Struct):

class Order(Struct):

# TODO: use ``msgspec.Literal``
# https://jcristharif.com/msgspec/usage.html#literal
action: str # {'buy', 'sell', 'alert'}
# internal ``emdsd`` unique "order id"
oid: str # uuid4
symbol: Union[str, Symbol]
account: str # should we set a default as '' ?

price: float
# TODO: could we drop the ``.action`` field above and instead just
# use +/- values here? Would make the msg smaller at the sake of a
# teensie fp precision?
size: float
brokers: list[str]

Expand Down

0 comments on commit 87aa1e3

Please sign in to comment.