Initialize crypto_monitor_user (user edition) from monitor codebase.

Retarget git remote, install path, and deploy docs from crypto_monitor to crypto_monitor_user.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-17 16:18:13 +08:00
commit 53863559f4
608 changed files with 162764 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
"""后台 board 缓存:版本递增与快照."""
from __future__ import annotations
import asyncio
import sys
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))
sys.path.insert(0, str(ROOT / "manual_trading_hub"))
from hub_board_cache import MonitorBoardStore # noqa: E402
class TestHubBoardStore(unittest.TestCase):
def test_snapshot_and_version(self) -> None:
store = MonitorBoardStore()
store.version = 2
store.payload = {"ok": True, "rows": [{"id": "0"}], "updated_at": "2026-01-01T00:00:00"}
snap = store.snapshot_dict()
self.assertEqual(snap["board_version"], 2)
self.assertEqual(len(snap["rows"]), 1)
def test_aggregate_increments_version(self) -> None:
async def run() -> None:
store = MonitorBoardStore()
n = 0
async def build():
nonlocal n
n += 1
return {"ok": True, "rows": [{"n": n}], "updated_at": "t"}
await store.start(build)
await asyncio.sleep(0.05)
self.assertGreaterEqual(store.version, 1)
await store.stop()
asyncio.run(run())
if __name__ == "__main__":
unittest.main()