Minor formatting

paper_trade_improvements_rebase
jaredgoldman 2023-02-25 16:09:16 -05:00
parent 2131394939
commit 6068724fd4
3 changed files with 7 additions and 3 deletions

View File

@ -235,7 +235,8 @@ async def open_ems(
not getattr(mod, 'trades_dialogue', None) not getattr(mod, 'trades_dialogue', None)
or mode == 'paper' or mode == 'paper'
): ):
mode = 'paper' mode = 'paper'
from ._ems import _emsd_main from ._ems import _emsd_main
async with ( async with (
# connect to emsd # connect to emsd
@ -254,6 +255,7 @@ async def open_ems(
dialogs, dialogs,
) )
), ),
# open 2-way trade command stream # open 2-way trade command stream
ctx.open_stream() as trades_stream, ctx.open_stream() as trades_stream,
): ):
@ -263,7 +265,8 @@ async def open_ems(
relay_order_cmds_from_sync_code, relay_order_cmds_from_sync_code,
fqsn, fqsn,
trades_stream trades_stream
) )
yield ( yield (
book, book,
trades_stream, trades_stream,

View File

@ -76,7 +76,7 @@ def get_app_dir(app_name, roaming=True, force_posix=False):
# TODO: This is a hacky way to a) determine we're testing # TODO: This is a hacky way to a) determine we're testing
# and b) creating a test dir. We should aim to set a variable # and b) creating a test dir. We should aim to set a variable
# within the tractor runtimes and store testing config data # within the tractor runtimes and store testing config data
# outside of the users filesystem # outside of the users filesystem
if "pytest" in sys.modules: if "pytest" in sys.modules:
app_name = os.path.join(app_name, TEST_CONFIG_DIR_PATH) app_name = os.path.join(app_name, TEST_CONFIG_DIR_PATH)

View File

@ -126,6 +126,7 @@ def test_paper_trade(open_test_pikerd: AsyncContextManager, delete_testing_dir):
except (NameError, AttributeError): except (NameError, AttributeError):
pass pass
# Do nothing, message isn't a position # Do nothing, message isn't a position
await trio.sleep(1) await trio.sleep(1)
# Assert entries are made in both ledger and PPS # Assert entries are made in both ledger and PPS
if assert_entries or assert_pps or assert_zeroed_pps: if assert_entries or assert_pps or assert_zeroed_pps: