Add analytics risk guard and redesigned dashboard

This commit is contained in:
Codex
2026-06-23 17:20:44 +03:00
parent 13de641fe3
commit 4d02ff3806
20 changed files with 1825 additions and 855 deletions
+25
View File
@@ -63,6 +63,19 @@ class BybitClient:
response.raise_for_status()
return self._unwrap(response.json())
def private_get(self, path: str, params: dict[str, Any]) -> dict[str, Any]:
query_params = sorted((key, value) for key, value in params.items() if value is not None)
query = urlencode(query_params)
headers = self._headers(query)
response = self.session.get(
f"{self.settings.rest_base_url}{path}",
params=query_params,
headers=headers,
timeout=15,
)
response.raise_for_status()
return self._unwrap(response.json())
def _headers(self, payload: str) -> dict[str, str]:
timestamp = str(int(time.time() * 1000))
recv_window = "5000"
@@ -204,6 +217,18 @@ class BybitClient:
}
return self.private_post("/v5/order/create", payload)
def wallet_balance(self, account_type: str = "UNIFIED", coin: str | None = None) -> dict[str, Any]:
return self.private_get(
"/v5/account/wallet-balance",
{"accountType": account_type, "coin": coin},
)
def realtime_orders(self, *, category: str = "spot", open_only: int = 0, limit: int = 50) -> dict[str, Any]:
return self.private_get(
"/v5/order/realtime",
{"category": category, "openOnly": open_only, "limit": max(1, min(limit, 50))},
)
def websocket_subscribe_message(symbols: list[str], interval: str = "1") -> str:
args: list[str] = []