система авторизации
This commit is contained in:
1 parent
85425483c0
commit
f6f1ae20c2
21 files changed
+581
-110
No files matched your search
+8
-12
@@ -37,8 +37,8 @@ FIELDS = COMMON_FIELDS + MODE_FIELDS["lead"] + MODE_FIELDS["vector"] + MODE_FIEL
|
||||
TEXT_FIELDS = (("lead_ticker", "KuCoin (ведущая), тикер"), ("lead_pool", "Пул DEX Solana (адрес)"),
|
||||
("follow_ticker", "Ставки: тикер фьючерса"))
|
||||
# Its own account and journal, so the old strategies' history stays untouched.
|
||||
STATE_FILE = sp.ROOT / "lead_paper_state.json"
|
||||
TRADES_FILE = sp.ROOT / "lead_paper_trades.csv"
|
||||
STATE_FILE = sp.DATA_DIR / "lead_paper_state.json"
|
||||
TRADES_FILE = sp.DATA_DIR / "lead_paper_trades.csv"
|
||||
|
||||
|
||||
def inherit_settings(paper: sp.PaperTrader) -> None:
|
||||
@@ -56,15 +56,13 @@ def inherit_settings(paper: sp.PaperTrader) -> None:
|
||||
|
||||
LEAD_MARKETS = {"futures": "KuCoin фьючерсы", "spot": "KuCoin спот",
|
||||
"raydium": "DEX пул Solana (Raydium / PumpSwap / Meteora / Orca / PancakeSwap)"}
|
||||
FOLLOW_EXCHANGES = {"bybit": "Bybit фьючерс", "binance": "Binance фьючерс", "mexc": "MEXC фьючерс"}
|
||||
FOLLOW_EXCHANGES = {"bybit": "Bybit фьючерс", "mexc": "MEXC фьючерс"}
|
||||
|
||||
|
||||
CONNECTIONS_FILE = sp.ROOT / "lead_connections.json"
|
||||
CONNECTIONS_FILE = sp.DATA_DIR / "lead_connections.json"
|
||||
CONNECTION_KEYS = ("lead_market", "lead_ticker", "lead_pool", "follow_exchange", "follow_ticker")
|
||||
# Connections already used; every new one is added so it can be picked again later (removed only by the user).
|
||||
DEFAULT_CONNECTIONS = [
|
||||
{"lead_market": "raydium", "lead_ticker": "ZEREBROUSDTM", "lead_pool": "3sjNoCnkkhWPVXYGDtem8rCciHSGc9jSFZuUAzKbvRVp",
|
||||
"follow_exchange": "binance", "follow_ticker": "ZEREBROUSDT"},
|
||||
{"lead_market": "raydium", "lead_ticker": "SIUSDTM", "lead_pool": "8uwFMFCUDi61rgT1e6bUuDEfaUcN6roSoL7qHkp2NtHk",
|
||||
"follow_exchange": "mexc", "follow_ticker": "SI_USDT"},
|
||||
{"lead_market": "raydium", "lead_ticker": "CLAUDIAUSDTM", "lead_pool": "Fe7bpDYCs74GqiCUF14HwgUMToPKV1d9mDYVX5BTohFr",
|
||||
@@ -82,7 +80,7 @@ def connection_name(c: dict) -> str:
|
||||
lead = f"DEX пул {c['lead_pool'][:6]}…"
|
||||
else:
|
||||
lead = f"KuCoin {'спот' if c['lead_market'] == 'spot' else 'фьючерс'} {c['lead_ticker']}"
|
||||
follow = {"bybit": "Bybit", "binance": "Binance", "mexc": "MEXC"}.get(c["follow_exchange"], c["follow_exchange"])
|
||||
follow = {"bybit": "Bybit", "mexc": "MEXC"}.get(c["follow_exchange"], c["follow_exchange"])
|
||||
return f"{coin}: {lead} → {follow} {c['follow_ticker']}"
|
||||
|
||||
|
||||
@@ -92,7 +90,7 @@ def same_connection(a: dict, b: dict) -> bool:
|
||||
return all(a.get(k) == b.get(k) for k in keys)
|
||||
|
||||
|
||||
REMOVED_FILE = sp.ROOT / "lead_connections_removed.json" # deleted by the user (× on a web tile)
|
||||
REMOVED_FILE = sp.DATA_DIR / "lead_connections_removed.json" # deleted by the user (× on a web tile)
|
||||
|
||||
|
||||
def _read_list(path) -> list[dict]:
|
||||
@@ -116,7 +114,8 @@ def is_removed(conn: dict, removed_path=None) -> bool:
|
||||
|
||||
def load_connections(path=None, removed_path=None) -> list[dict]:
|
||||
removed = _read_list(removed_path or REMOVED_FILE)
|
||||
out = [c for c in _read_list(path or CONNECTIONS_FILE) if not any(same_connection(c, r) for r in removed)]
|
||||
out = [c for c in _read_list(path or CONNECTIONS_FILE) if c.get("follow_exchange") in FOLLOW_EXCHANGES
|
||||
and not any(same_connection(c, r) for r in removed)]
|
||||
for c in DEFAULT_CONNECTIONS:
|
||||
if not any(same_connection(c, s) for s in out) and not any(same_connection(c, r) for r in removed):
|
||||
out.append(dict(c))
|
||||
@@ -440,9 +439,6 @@ def run() -> None:
|
||||
if ps.follow_exchange == "mexc":
|
||||
state["tick"], size = sh.mexc_contract(ps.follow_ticker)
|
||||
state["follower_feed"] = sh.MexcFeed(ps.follow_ticker, events, size)
|
||||
elif ps.follow_exchange == "binance":
|
||||
state["tick"] = sh.binance_tick(ps.follow_ticker)
|
||||
state["follower_feed"] = sh.BinanceFeed(ps.follow_ticker, events)
|
||||
else:
|
||||
state["tick"] = sh.bybit_tick(ps.follow_ticker)
|
||||
state["follower_feed"] = sh.BybitFeed(ps.follow_ticker, events)
|
||||
|
||||
Reference in new issue
Block a user