fix: ccxt Gate 类名 gateio 改为兼容 gate
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -394,8 +394,10 @@ os.makedirs(UPLOAD_FOLDER, exist_ok=True)
|
|||||||
os.makedirs(ORDER_CHART_DIR, exist_ok=True)
|
os.makedirs(ORDER_CHART_DIR, exist_ok=True)
|
||||||
app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
|
app.config["UPLOAD_FOLDER"] = UPLOAD_FOLDER
|
||||||
|
|
||||||
|
from lib.exchange.gate_ccxt_lib import gate_ccxt_class
|
||||||
|
|
||||||
# Gate.io USDT 永续(swap)
|
# Gate.io USDT 永续(swap)
|
||||||
exchange = ccxt.gateio({
|
exchange = gate_ccxt_class()({
|
||||||
"enableRateLimit": True,
|
"enableRateLimit": True,
|
||||||
"options": {
|
"options": {
|
||||||
"defaultType": "swap",
|
"defaultType": "swap",
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
"""Gate.io ccxt 构造(ccxt 4.x 起类名由 gateio 改为 gate)。"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import ccxt
|
||||||
|
|
||||||
|
|
||||||
|
def gate_ccxt_class():
|
||||||
|
"""返回 ccxt Gate 交易所类(兼容旧版 gateio 名称)。"""
|
||||||
|
return getattr(ccxt, "gate", None) or ccxt.gateio
|
||||||
@@ -158,7 +158,9 @@ def _make_exchange() -> Any:
|
|||||||
secret = (os.getenv("GATE_API_SECRET") or "").strip()
|
secret = (os.getenv("GATE_API_SECRET") or "").strip()
|
||||||
if not key or not secret:
|
if not key or not secret:
|
||||||
raise RuntimeError("缺少 GATE_API_KEY / GATE_API_SECRET")
|
raise RuntimeError("缺少 GATE_API_KEY / GATE_API_SECRET")
|
||||||
ex = ccxt.gateio(
|
from lib.exchange.gate_ccxt_lib import gate_ccxt_class
|
||||||
|
|
||||||
|
ex = gate_ccxt_class()(
|
||||||
{
|
{
|
||||||
"apiKey": key,
|
"apiKey": key,
|
||||||
"secret": secret,
|
"secret": secret,
|
||||||
|
|||||||
Reference in New Issue
Block a user