`ib/kraken`: adjust to new default of not-writing in `open_pps()`

explicit_write_pps_on_exit
Tyler Goodlet 2023-03-01 17:29:45 -05:00
parent d04fe366ab
commit f53f4df583
2 changed files with 11 additions and 23 deletions

View File

@ -480,10 +480,17 @@ async def trades_dialogue(
# open ledger and pptable wrapper for each
# detected account.
ledger = ledgers[acctid] = lstack.enter_context(
open_trade_ledger('ib', acctid)
open_trade_ledger(
'ib',
acctid,
)
)
table = tables[acctid] = lstack.enter_context(
open_pps('ib', acctid)
open_pps(
'ib',
acctid,
write_on_exit=True,
)
)
for account, proxy in proxies.items():

View File

@ -470,6 +470,7 @@ async def trades_dialogue(
open_pps(
'kraken',
acctid,
write_on_exit=True,
) as table,
open_trade_ledger(
@ -627,7 +628,7 @@ async def trades_dialogue(
cost_scalar=1,
)
log.info(
'Updated {dst} from transfers:\n'
f'Updated {dst} from transfers:\n'
f'{pformat(updated)}'
)
@ -1212,23 +1213,3 @@ def norm_trade_records(
)
return records
@cm
def open_ledger(
acctid: str,
trade_entries: list[dict[str, Any]],
) -> set[Transaction]:
'''
Write recent session's trades to the user's (local) ledger file.
'''
with open_trade_ledger(
'kraken',
acctid,
) as ledger:
yield ledger
# update on exit
ledger.update(trade_entries)