Add backpressure setting back as it wasn't altering test behaviour

paper_trade_improvements_rebase
jaredgoldman 2023-02-26 16:11:28 -05:00
parent 84fedf5153
commit 944c1945fc
2 changed files with 11 additions and 10 deletions

View File

@ -1467,7 +1467,7 @@ async def maybe_open_feed(
'tick_throttle': kwargs.get('tick_throttle'),
# XXX: super critical to have bool defaults here XD
# 'backpressure': kwargs.get('backpressure', True),
'backpressure': kwargs.get('backpressure', True),
'start_stream': kwargs.get('start_stream', True),
},
key=fqsn,

View File

@ -41,25 +41,26 @@ async def _async_main(
open_test_pikerd_and_ems: AsyncContextManager,
action: Literal['buy', 'sell'] | None = None,
price: int = 30000,
executions: int = 1,
size: float = 0.01,
# Assert options
assert_entries: bool = False,
assert_pps: bool = False,
assert_zeroed_pps: bool = False,
assert_msg: bool = False,
executions: int = 1,
size: float = 0.01,
) -> None:
'''Start piker, place a trade and assert data in pps stream, ledger and position table. Then restart piker and ensure
that pps from previous trade exists in the ems pps.
Finally close the position and ensure that the position in pps.toml is closed.
) -> None:
'''
Start piker, place a trade and assert data in
pps stream, ledger and position table.
'''
oid: str = ''
last_msg = {}
async with open_test_pikerd_and_ems() as (
services,
(book, trades_stream, pps, accounts, dialogs),
):
# Set up piker and EMS
# Send order to EMS
if action:
for x in range(executions):
oid = str(uuid4())
@ -80,6 +81,7 @@ async def _async_main(
async for msg in trades_stream:
last_msg = msg
match msg:
# Wait for position message before moving on
case {'name': 'position'}:
break
@ -183,7 +185,6 @@ def test_sell(open_test_pikerd_and_ems: AsyncContextManager, delete_testing_dir)
)
#
def test_multi_sell(open_test_pikerd_and_ems: AsyncContextManager, delete_testing_dir):
# Make 5 market limit buy orders
_run_test_and_check(