система авторизации
Offline regression tests / windows (3.11) (push) Canceled after 0s
Offline regression tests / windows (3.12) (push) Canceled after 0s
Offline regression tests / windows (3.13) (push) Canceled after 0s

This commit is contained in:
listik committed 2026-10-23 21:14:57 +03:00
1 parent 85425483c0
commit f6f1ae20c2
21 files changed
+581 -110

No files matched your search

+9 -16
View File
@@ -17,6 +17,7 @@ A spread above 10 % is flagged «разные монеты?» (the same ticker o
from __future__ import annotations
import json
import os
import re
import threading
import time
@@ -25,10 +26,10 @@ from pathlib import Path
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass
EXCHANGES = ["Bybit", "Binance", "MEXC", "HTX", "Gate"]
TAKER = {"Bybit": 0.055, "Binance": 0.05, "MEXC": 0.02, "HTX": 0.05, "Gate": 0.05} # % per market order, futures
EXCHANGES = ["Bybit", "MEXC", "HTX", "Gate"]
TAKER = {"Bybit": 0.055, "MEXC": 0.02, "HTX": 0.05, "Gate": 0.05} # % per market order, futures
# spot market-order fees at the base level (no VIP, no fee-token discount) — editable on the page
SPOT_TAKER = {"Bybit": 0.1, "Binance": 0.1, "MEXC": 0.05, "HTX": 0.2, "Gate": 0.1}
SPOT_TAKER = {"Bybit": 0.1, "MEXC": 0.05, "HTX": 0.2, "Gate": 0.1}
LEVERAGED = re.compile(r"(\d+[LS]|UP|DOWN|BULL|BEAR)$") # leveraged tokens, not the coin itself
CYCLE_S = 10.0
USUAL_WINDOW_S = 1800.0
@@ -109,18 +110,13 @@ class Fetchers:
def refresh_reference(self) -> None:
if time.time() - self.ref_time < 3600 and self.ref:
return
ref: dict[str, dict] = {"bybit_interval": {}, "binance_interval": {}, "htx_size": {}, "htx_interval": {},
ref: dict[str, dict] = {"bybit_interval": {}, "htx_size": {}, "htx_interval": {},
"gate_interval": {}, "mexc_size": {}}
try:
for it in _get("https://api.bybit.com/v5/market/instruments-info?category=linear&limit=1000")["result"]["list"]:
ref["bybit_interval"][it["symbol"]] = _f(it.get("fundingInterval"), 480) / 60
except Exception:
pass
try:
for it in _get("https://fapi.binance.com/fapi/v1/fundingInfo"):
ref["binance_interval"][it["symbol"]] = _f(it.get("fundingIntervalHours"), 8)
except Exception:
pass
try:
for it in _get("https://api.hbdm.com/linear-swap-api/v1/swap_contract_info?business_type=swap")["data"]:
ref["htx_size"][it["contract_code"]] = _f(it.get("contract_size"), 1)
@@ -232,10 +228,6 @@ class SpotFetchers:
if time.time() - self.volume_time < 60 and self.volume:
return
vol = {}
try:
vol["Binance"] = {t["symbol"]: _f(t.get("quoteVolume")) for t in _get("https://api.binance.com/api/v3/ticker/24hr")}
except Exception:
pass
try:
vol["MEXC"] = {t["symbol"]: _f(t.get("quoteVolume")) for t in _get("https://api.mexc.com/api/v3/ticker/24hr")}
except Exception:
@@ -433,7 +425,8 @@ def best_pairs(quotes: list[Quote], usual: dict, taker: dict | None = None, mark
return rows
PAUSED_FILE = Path(__file__).resolve().parent / "web_sim_data" / "arb_paused.json"
PAUSED_FILE = Path(os.environ.get("CRYPTO_SCAM_DATA_DIR", Path(__file__).resolve().parent / "web_sim_data")) \\
/ "arb_paused.json"
def load_paused() -> dict:
@@ -499,7 +492,7 @@ class ArbScanner:
getattr(self.fetchers, refresh)()
except Exception:
pass
calls = {"Bybit": self.fetchers.bybit, "Binance": self.fetchers.binance, "MEXC": self.fetchers.mexc,
calls = {"Bybit": self.fetchers.bybit, "MEXC": self.fetchers.mexc,
"HTX": self.fetchers.htx, "Gate": self.fetchers.gate}
quotes, status, counts = [], {}, {}
@@ -510,7 +503,7 @@ class ArbScanner:
except Exception as exc:
return name, [], f"ошибка: {str(exc)[:80]}"
with ThreadPoolExecutor(max_workers=5) as pool:
with ThreadPoolExecutor(max_workers=len(EXCHANGES)) as pool:
for name, qs, st in pool.map(one, EXCHANGES):
quotes += qs
status[name], counts[name] = st, len(qs)