kraken: add more type annots in broker codez

basic_buy_bot
Tyler Goodlet 2023-06-17 17:18:20 -04:00
parent 3f555b2f5a
commit 4eeb232248
1 changed files with 9 additions and 9 deletions

View File

@ -183,10 +183,10 @@ async def handle_order_requests(
# logic from old `Client.submit_limit()` # logic from old `Client.submit_limit()`
if order.oid in ids: if order.oid in ids:
ep = 'editOrder' ep: str = 'editOrder'
reqid = ids[order.oid] # integer not txid reqid: int = ids[order.oid] # integer not txid
try: try:
txid = reqids2txids[reqid] txid: str = reqids2txids[reqid]
except KeyError: except KeyError:
# XXX: not sure if this block ever gets hit now? # XXX: not sure if this block ever gets hit now?
log.error('TOO FAST EDIT') log.error('TOO FAST EDIT')
@ -208,7 +208,7 @@ async def handle_order_requests(
} }
else: else:
ep = 'addOrder' ep: str = 'addOrder'
reqid = BrokerClient.new_reqid() reqid = BrokerClient.new_reqid()
ids[order.oid] = reqid ids[order.oid] = reqid
@ -221,8 +221,8 @@ async def handle_order_requests(
'type': order.action, 'type': order.action,
} }
psym = order.symbol.upper() psym: str = order.symbol.upper()
pair = f'{psym[:3]}/{psym[3:]}' pair: str = f'{psym[:3]}/{psym[3:]}'
# XXX: ACK the request **immediately** before sending # XXX: ACK the request **immediately** before sending
# the api side request to ensure the ems maps the oid -> # the api side request to ensure the ems maps the oid ->
@ -423,7 +423,6 @@ async def open_trade_dialog(
) -> AsyncIterator[dict[str, Any]]: ) -> AsyncIterator[dict[str, Any]]:
async with get_client() as client: async with get_client() as client:
# make ems flip to paper mode when no creds setup in # make ems flip to paper mode when no creds setup in
# `brokers.toml` B0 # `brokers.toml` B0
if not client._api_key: if not client._api_key:
@ -867,8 +866,9 @@ async def handle_order_updates(
# 'vol_exec': exec_vlm} # 0.0000 # 'vol_exec': exec_vlm} # 0.0000
match update_msg: match update_msg:
# EMS-unknown LIVE order that needs to be # EMS-unknown pre-exising-submitted LIVE
# delivered and loaded on the client-side. # order that needs to be delivered and
# loaded on the client-side.
case { case {
'userref': reqid, 'userref': reqid,
'descr': { 'descr': {