This commit is contained in:
Oleg Sheynin
2026-07-30 02:39:21 +00:00
parent f49a10f54e
commit 4ddf4017bd
41 changed files with 1570 additions and 13025 deletions
+34 -29
View File
@@ -33,24 +33,26 @@ def create_panel_fixture_db(db_path: Path) -> None:
conn.execute(
"""
CREATE TABLE trading_instructions (
time_ns INTEGER,
tstamp TEXT,
tstamp_ns INTEGER,
type TEXT,
book_id TEXT,
strategy_id TEXT,
type TEXT,
data TEXT
action TEXT,
quote_asset TEXT,
assets TEXT,
scaled_disequilibrium REAL,
beta REAL
)
"""
)
conn.execute(
"""
CREATE TABLE ohlcv_1min (
CREATE TABLE market (
tstamp TEXT,
tstamp_ns INTEGER,
exch_acct TEXT,
exchange_id TEXT,
instrument_id TEXT,
interval_sec INTEGER,
open REAL,
high REAL,
low REAL,
@@ -73,44 +75,44 @@ def create_panel_fixture_db(db_path: Path) -> None:
),
)
conn.executemany(
"INSERT INTO trading_instructions VALUES (?, ?, ?, ?, ?, ?)",
"INSERT INTO trading_instructions VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
[
(
trading_day_start_ns,
"2026-06-17T00:00:00Z",
trading_day_start_ns,
"TARGET_POSITION",
"book",
"strategy-AAA:USD-BBB:USD",
"TARGET_POSITION",
(
'{"action":"TARGET","quote_asset":"USD","assets":'
'{"AAA":{"reference_price":"100","strength":"0.5"},'
'"BBB":{"reference_price":"50","strength":"-0.5"}}}'
),
"TARGET",
"USD",
'{"AAA":{"reference_price":"100","strength":"0.5"},'
'"BBB":{"reference_price":"50","strength":"-0.5"}}',
-1.25,
0.75,
),
(
trading_day_start_ns + 60_000_000_000,
"2026-06-17T00:01:00Z",
trading_day_start_ns + 60_000_000_000,
"CLOSE_POSITION",
"book",
"strategy-AAA:USD-BBB:USD",
"CLOSE_POSITION",
(
'{"action":"CLOSE","quote_asset":"USD","assets":'
'{"AAA":{"reference_price":"110"},'
'"BBB":{"reference_price":"45"}}}'
),
"CLOSE",
"USD",
'{"AAA":{"reference_price":"110"},'
'"BBB":{"reference_price":"45"}}',
-0.5,
0.75,
),
],
)
conn.executemany(
"INSERT INTO ohlcv_1min VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
"INSERT INTO market VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
[
(
"2026-06-17T00:00:00Z",
trading_day_start_ns,
"EXCH",
"EXCH",
"PAIR-AAA-USD",
60,
100.0,
100.0,
100.0,
@@ -123,9 +125,7 @@ def create_panel_fixture_db(db_path: Path) -> None:
"2026-06-17T00:00:00Z",
trading_day_start_ns,
"EXCH",
"EXCH",
"PAIR-BBB-USD",
60,
50.0,
50.0,
50.0,
@@ -169,7 +169,8 @@ def test_panel_app_uses_fast_list_template(tmp_path):
assert not hasattr(app, "refresh_button")
assert isinstance(view, module.pn.template.FastListTemplate)
assert view.title == module.APP_TITLE
assert view.sidebar_width == 430
assert view.theme is module.pn.template.DarkTheme
assert view.sidebar_width == module.APP_SIDEBAR_WIDTH
assert view.accent_base_color == module.APP_ACCENT_COLOR
assert view.header_background == module.APP_HEADER_COLOR
assert len(view.sidebar) == 1
@@ -191,8 +192,12 @@ def test_panel_app_calculates_pairs_and_selected_pair_outputs(tmp_path):
app.calculate()
assert app.file_select.value == str(db_path)
assert app.file_select.width == 360
assert app.min_pctg_change_input.width == 220
assert app.directory_input.sizing_mode == "stretch_width"
assert app.directory_input.width is None
assert app.file_select.sizing_mode == "stretch_width"
assert app.file_select.width is None
assert app.min_pctg_change_input.sizing_mode == "stretch_width"
assert app.min_pctg_change_input.width is None
assert app.calculate_button.width == 110
assert app.total_pnl_histogram.sizing_mode == "stretch_width"
assert app.selected_pair_market_plot.sizing_mode == "stretch_width"