Replace `Transaction.fqsn` -> `.fqme`

Change over all client (broker) code which constructs transactions
and finally wipe required `.fqsn` usage from `.accounting` B)
master
Tyler Goodlet 2023-05-22 12:21:38 -04:00
parent 31a00eca94
commit dd10acbbf9
6 changed files with 12 additions and 17 deletions

View File

@ -54,8 +54,8 @@ class Transaction(Struct, frozen=True):
# TODO: unify this with the `MktPair`, # TODO: unify this with the `MktPair`,
# once we have that as a required field, # once we have that as a required field,
# we don't really need the fqsn any more.. # we don't really need the fqme any more..
fqsn: str fqme: str
tid: Union[str, int] # unique transaction id tid: Union[str, int] # unique transaction id
size: float size: float
@ -68,11 +68,6 @@ class Transaction(Struct, frozen=True):
# via the `MktPair`? # via the `MktPair`?
expiry: datetime | None = None expiry: datetime | None = None
# remap for back-compat
@property
def fqme(self) -> str:
return self.fqsn
# TODO: drop the Symbol type, construct using # TODO: drop the Symbol type, construct using
# t.sys (the transaction system) # t.sys (the transaction system)
@ -174,7 +169,7 @@ class TransactionLedger(UserDict):
continue continue
tx = Transaction( tx = Transaction(
fqsn=fqme, fqme=fqme,
tid=txdict['tid'], tid=txdict['tid'],
dt=dt, dt=dt,
price=txdict['price'], price=txdict['price'],

View File

@ -900,7 +900,7 @@ def open_pps(
clears_table['dt'] = dt clears_table['dt'] = dt
trans.append(Transaction( trans.append(Transaction(
fqsn=bs_mktid, fqme=bs_mktid,
sym=mkt, sym=mkt,
bs_mktid=bs_mktid, bs_mktid=bs_mktid,
tid=tid, tid=tid,

View File

@ -1266,7 +1266,7 @@ def norm_trade_records(
insort( insort(
records, records,
Transaction( Transaction(
fqsn=fqme, fqme=fqme,
sym=pair, sym=pair,
tid=tid, tid=tid,
size=size, size=size,

View File

@ -401,7 +401,7 @@ class Client:
fqme = asset_key + '.kraken' fqme = asset_key + '.kraken'
tx = Transaction( tx = Transaction(
fqsn=fqme, fqme=fqme,
sym=asset, sym=asset,
tid=entry['txid'], tid=entry['txid'],
dt=pendulum.from_timestamp(entry['time']), dt=pendulum.from_timestamp(entry['time']),

View File

@ -895,7 +895,7 @@ async def handle_order_updates(
ids.inverse.get(reqid) is None ids.inverse.get(reqid) is None
): ):
# parse out existing live order # parse out existing live order
fqsn = pair.replace('/', '').lower() fqme = pair.replace('/', '').lower()
price = float(price) price = float(price)
size = float(vol) size = float(vol)
@ -922,7 +922,7 @@ async def handle_order_updates(
action=action, action=action,
exec_mode='live', exec_mode='live',
oid=oid, oid=oid,
symbol=fqsn, symbol=fqme,
account=acc_name, account=acc_name,
price=price, price=price,
size=size, size=size,
@ -1207,7 +1207,7 @@ async def norm_trade_records(
mkt: MktPair = (await get_mkt_info(fqme))[0] mkt: MktPair = (await get_mkt_info(fqme))[0]
records[tid] = Transaction( records[tid] = Transaction(
fqsn=fqme, fqme=fqme,
sym=mkt, sym=mkt,
tid=tid, tid=tid,
size=size, size=size,

View File

@ -263,7 +263,7 @@ class PaperBoi(Struct):
# other then this thing, our fqme address. # other then this thing, our fqme address.
bs_mktid: str = fqme bs_mktid: str = fqme
t = Transaction( t = Transaction(
fqsn=fqme, fqme=fqme,
sym=self._mkts[fqme], sym=self._mkts[fqme],
tid=oid, tid=oid,
size=size, size=size,
@ -577,9 +577,9 @@ async def trades_dialogue(
mkt_by_fqme[fqme] = mkt mkt_by_fqme[fqme] = mkt
# for each sym in the ledger load it's `MktPair` info # for each sym in the ledger load it's `MktPair` info
for tid, tdict in ledger.data.items(): for tid, txdict in ledger.data.items():
# TODO: switch this to fqme # TODO: switch this to fqme
l_fqme = tdict['fqsn'] l_fqme = txdict.get('fqme', txdict['fqsn'])
if ( if (
gmi gmi