| sealed_flags = []
|
|
|
| def test_asymmetric_fleet_each_account_detects_against_its_own_position(sealed_flags):
|
| """THE FLEET CASE the single-book sim structurally could not reproduce: three accounts on ONE
|
| market series — one long, one short, one flat. Each account's detect sees ITS OWN position, so
|
| the same tape fires a long trail for one, nothing for the other two."""
|
| provider = TrailStopProvider(trail_pct=1.0)
|
| books = {
|
| "cuixia": AccountBook(account_nick="cuixia", equity=30000.0, buying_power=60000.0,
|
| held_symbol="TNA", held_direction="long", held_shares=30,
|
| held_entry_px=100.0, held_entry_et="09:41:00"),
|
| "yuchao": AccountBook(account_nick="yuchao", equity=30000.0, buying_power=60000.0,
|
| held_symbol="TZA", held_direction="short", held_shares=50,
|
| held_entry_px=100.0, held_entry_et="09:41:00"),
|
| "miaoyong": AccountBook(account_nick="miaoyong", equity=30000.0, buying_power=60000.0),
|
| }
|
| series = [("09:41:00", 100.0), ("09:45:00", 110.0), ("09:50:00", 108.9)]
|
| results = {nick: provider.detect(series, PORT.PositionState.from_account_book(book))
|
| for nick, book in books.items()}
|
| > assert results["cuixia"] is not None and results["cuixia"].trigger == TRIGGER_LONG, (
|
| "the long account gave back 1.0% from its best point and must fire")
|
| E AssertionError: the long account gave back 1.0% from its best point and must fire
|
| E assert (None is not None)
|
|
|
| tests/services/test_exit_consult_port.py:433: AssertionError
|