Replace `Transaction.fqsn` -> `.fqme`
Change over all client (broker) code which constructs transactions and finally wipe required `.fqsn` usage from `.accounting` B)master
parent
31a00eca94
commit
dd10acbbf9
|
@ -54,8 +54,8 @@ class Transaction(Struct, frozen=True):
|
|||
|
||||
# TODO: unify this with the `MktPair`,
|
||||
# once we have that as a required field,
|
||||
# we don't really need the fqsn any more..
|
||||
fqsn: str
|
||||
# we don't really need the fqme any more..
|
||||
fqme: str
|
||||
|
||||
tid: Union[str, int] # unique transaction id
|
||||
size: float
|
||||
|
@ -68,11 +68,6 @@ class Transaction(Struct, frozen=True):
|
|||
# via the `MktPair`?
|
||||
expiry: datetime | None = None
|
||||
|
||||
# remap for back-compat
|
||||
@property
|
||||
def fqme(self) -> str:
|
||||
return self.fqsn
|
||||
|
||||
# TODO: drop the Symbol type, construct using
|
||||
# t.sys (the transaction system)
|
||||
|
||||
|
@ -174,7 +169,7 @@ class TransactionLedger(UserDict):
|
|||
continue
|
||||
|
||||
tx = Transaction(
|
||||
fqsn=fqme,
|
||||
fqme=fqme,
|
||||
tid=txdict['tid'],
|
||||
dt=dt,
|
||||
price=txdict['price'],
|
||||
|
|
|
@ -900,7 +900,7 @@ def open_pps(
|
|||
clears_table['dt'] = dt
|
||||
|
||||
trans.append(Transaction(
|
||||
fqsn=bs_mktid,
|
||||
fqme=bs_mktid,
|
||||
sym=mkt,
|
||||
bs_mktid=bs_mktid,
|
||||
tid=tid,
|
||||
|
|
|
@ -1266,7 +1266,7 @@ def norm_trade_records(
|
|||
insort(
|
||||
records,
|
||||
Transaction(
|
||||
fqsn=fqme,
|
||||
fqme=fqme,
|
||||
sym=pair,
|
||||
tid=tid,
|
||||
size=size,
|
||||
|
|
|
@ -401,7 +401,7 @@ class Client:
|
|||
fqme = asset_key + '.kraken'
|
||||
|
||||
tx = Transaction(
|
||||
fqsn=fqme,
|
||||
fqme=fqme,
|
||||
sym=asset,
|
||||
tid=entry['txid'],
|
||||
dt=pendulum.from_timestamp(entry['time']),
|
||||
|
|
|
@ -895,7 +895,7 @@ async def handle_order_updates(
|
|||
ids.inverse.get(reqid) is None
|
||||
):
|
||||
# parse out existing live order
|
||||
fqsn = pair.replace('/', '').lower()
|
||||
fqme = pair.replace('/', '').lower()
|
||||
price = float(price)
|
||||
size = float(vol)
|
||||
|
||||
|
@ -922,7 +922,7 @@ async def handle_order_updates(
|
|||
action=action,
|
||||
exec_mode='live',
|
||||
oid=oid,
|
||||
symbol=fqsn,
|
||||
symbol=fqme,
|
||||
account=acc_name,
|
||||
price=price,
|
||||
size=size,
|
||||
|
@ -1207,7 +1207,7 @@ async def norm_trade_records(
|
|||
mkt: MktPair = (await get_mkt_info(fqme))[0]
|
||||
|
||||
records[tid] = Transaction(
|
||||
fqsn=fqme,
|
||||
fqme=fqme,
|
||||
sym=mkt,
|
||||
tid=tid,
|
||||
size=size,
|
||||
|
|
|
@ -263,7 +263,7 @@ class PaperBoi(Struct):
|
|||
# other then this thing, our fqme address.
|
||||
bs_mktid: str = fqme
|
||||
t = Transaction(
|
||||
fqsn=fqme,
|
||||
fqme=fqme,
|
||||
sym=self._mkts[fqme],
|
||||
tid=oid,
|
||||
size=size,
|
||||
|
@ -577,9 +577,9 @@ async def trades_dialogue(
|
|||
mkt_by_fqme[fqme] = mkt
|
||||
|
||||
# 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
|
||||
l_fqme = tdict['fqsn']
|
||||
l_fqme = txdict.get('fqme', txdict['fqsn'])
|
||||
|
||||
if (
|
||||
gmi
|
||||
|
|
Loading…
Reference in New Issue