Enable console via `.clearing._ems.open_brokerd_dialog()`
Enable console logs for both `.clearing` and `.accounting` in `open_brokerd_dialog()` and pass `loglevel` to all broker-backend trade-dialog endpoints. This ensures all `open_trade_dialog()` will receive the same level passed to the EMS, including the paper engine. Deats, - add `loglevel` param to `mk_paper_ep()` closure. - pass `loglevel=loglevel` to all trade endpoint `open_context()` calls and `mk_paper_ep()` invocations. - change default `loglevel` in `open_ems()` from `'error'` to `'warning'`. - add `get_console_log()` calls for `'clearing'` and `'piker.accounting'` at top of `open_brokerd_dialog()` to ensure those dependent subsystems are console enabled given they're namely used by the `brokerd` trade-dialog ep tasks. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code
parent
041f0d7e6f
commit
e08fb267f8
|
|
@ -215,7 +215,7 @@ async def relay_orders_from_sync_code(
|
||||||
async def open_ems(
|
async def open_ems(
|
||||||
fqme: str,
|
fqme: str,
|
||||||
mode: str = 'live',
|
mode: str = 'live',
|
||||||
loglevel: str = 'error',
|
loglevel: str = 'warning',
|
||||||
|
|
||||||
) -> tuple[
|
) -> tuple[
|
||||||
OrderClient, # client
|
OrderClient, # client
|
||||||
|
|
|
||||||
|
|
@ -352,9 +352,21 @@ async def open_brokerd_dialog(
|
||||||
broker backend, configuration, or client code usage.
|
broker backend, configuration, or client code usage.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
get_console_log(
|
||||||
|
level=loglevel,
|
||||||
|
name='clearing',
|
||||||
|
)
|
||||||
|
# enable `.accounting` console since normally used by
|
||||||
|
# each `brokerd`.
|
||||||
|
get_console_log(
|
||||||
|
level=loglevel,
|
||||||
|
name='piker.accounting',
|
||||||
|
)
|
||||||
broker: str = brokermod.name
|
broker: str = brokermod.name
|
||||||
|
|
||||||
def mk_paper_ep():
|
def mk_paper_ep(
|
||||||
|
loglevel: str,
|
||||||
|
):
|
||||||
from . import _paper_engine as paper_mod
|
from . import _paper_engine as paper_mod
|
||||||
|
|
||||||
nonlocal brokermod, exec_mode
|
nonlocal brokermod, exec_mode
|
||||||
|
|
@ -406,17 +418,21 @@ async def open_brokerd_dialog(
|
||||||
|
|
||||||
if (
|
if (
|
||||||
trades_endpoint is not None
|
trades_endpoint is not None
|
||||||
or exec_mode != 'paper'
|
or
|
||||||
|
exec_mode != 'paper'
|
||||||
):
|
):
|
||||||
# open live brokerd trades endpoint
|
# open live brokerd trades endpoint
|
||||||
open_trades_endpoint = portal.open_context(
|
open_trades_endpoint = portal.open_context(
|
||||||
trades_endpoint,
|
trades_endpoint,
|
||||||
|
loglevel=loglevel,
|
||||||
)
|
)
|
||||||
|
|
||||||
@acm
|
@acm
|
||||||
async def maybe_open_paper_ep():
|
async def maybe_open_paper_ep():
|
||||||
if exec_mode == 'paper':
|
if exec_mode == 'paper':
|
||||||
async with mk_paper_ep() as msg:
|
async with mk_paper_ep(
|
||||||
|
loglevel=loglevel,
|
||||||
|
) as msg:
|
||||||
yield msg
|
yield msg
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -427,7 +443,9 @@ async def open_brokerd_dialog(
|
||||||
# runtime indication that the backend can't support live
|
# runtime indication that the backend can't support live
|
||||||
# order ctrl yet, so boot the paperboi B0
|
# order ctrl yet, so boot the paperboi B0
|
||||||
if first == 'paper':
|
if first == 'paper':
|
||||||
async with mk_paper_ep() as msg:
|
async with mk_paper_ep(
|
||||||
|
loglevel=loglevel,
|
||||||
|
) as msg:
|
||||||
yield msg
|
yield msg
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue