Fix bad-fqme test, adjust prices based on buy/sell
parent
d29e9eeb31
commit
114e7660aa
|
@ -159,20 +159,26 @@ def load_and_check_pos(
|
||||||
yield pp
|
yield pp
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.trio
|
def test_ems_err_on_bad_broker(
|
||||||
async def test_ems_err_on_bad_broker(
|
|
||||||
open_test_pikerd: Services,
|
open_test_pikerd: Services,
|
||||||
loglevel: str,
|
loglevel: str,
|
||||||
):
|
):
|
||||||
try:
|
async def load_bad_fqme():
|
||||||
async with open_ems(
|
try:
|
||||||
'doggy.smiles',
|
async with (
|
||||||
mode='paper',
|
open_test_pikerd() as (_, _, _, services),
|
||||||
loglevel=loglevel,
|
|
||||||
) as _:
|
open_ems(
|
||||||
pytest.fail('EMS is working on non-broker!?')
|
'doggycoin.doggy',
|
||||||
except ModuleNotFoundError:
|
mode='paper',
|
||||||
pass
|
loglevel=loglevel,
|
||||||
|
) as _
|
||||||
|
):
|
||||||
|
pytest.fail('EMS is working on non-broker!?')
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
run_and_tollerate_cancels(load_bad_fqme)
|
||||||
|
|
||||||
|
|
||||||
async def match_ppmsgs_on_ems_boot(
|
async def match_ppmsgs_on_ems_boot(
|
||||||
|
@ -264,12 +270,14 @@ async def submit_and_check(
|
||||||
od: dict
|
od: dict
|
||||||
for od in fills:
|
for od in fills:
|
||||||
print(f'Sending order {od} for fill')
|
print(f'Sending order {od} for fill')
|
||||||
|
size = od['size']
|
||||||
sent, msgs = await order_and_and_wait_for_ppmsg(
|
sent, msgs = await order_and_and_wait_for_ppmsg(
|
||||||
client,
|
client,
|
||||||
trades_stream,
|
trades_stream,
|
||||||
fqme,
|
fqme,
|
||||||
action='buy',
|
action='buy' if size > 0 else 'sell',
|
||||||
size=od['size'],
|
price=100e3 if size > 0 else 0,
|
||||||
|
size=size,
|
||||||
)
|
)
|
||||||
|
|
||||||
last_order: Order = sent[-1]
|
last_order: Order = sent[-1]
|
||||||
|
@ -300,7 +308,8 @@ async def submit_and_check(
|
||||||
{'size': 0.001},
|
{'size': 0.001},
|
||||||
),
|
),
|
||||||
|
|
||||||
# multi-partial entry and exits.
|
# multi-partial entry and exits from net-zero, to short and back
|
||||||
|
# to net-zero.
|
||||||
(
|
(
|
||||||
# enters
|
# enters
|
||||||
{'size': 0.001},
|
{'size': 0.001},
|
||||||
|
@ -314,10 +323,18 @@ async def submit_and_check(
|
||||||
{'size': 0.001},
|
{'size': 0.001},
|
||||||
{'size': 0.002},
|
{'size': 0.002},
|
||||||
|
|
||||||
# exits to get back to zero.
|
# nearly back to zero.
|
||||||
{'size': -0.001},
|
{'size': -0.001},
|
||||||
|
|
||||||
|
# switch to net-short
|
||||||
{'size': -0.025},
|
{'size': -0.025},
|
||||||
{'size': -0.0195},
|
{'size': -0.0195},
|
||||||
|
|
||||||
|
# another entry
|
||||||
|
{'size': 0.001},
|
||||||
|
|
||||||
|
# final cover to net-zero again.
|
||||||
|
{'size': 0.038},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
ids='fills={}'.format,
|
ids='fills={}'.format,
|
||||||
|
@ -328,7 +345,7 @@ def test_multi_fill_positions(
|
||||||
|
|
||||||
fills: tuple[dict],
|
fills: tuple[dict],
|
||||||
|
|
||||||
check_cross_session: bool = True,
|
check_cross_session: bool = False,
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue