mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-10 08:48:07 +00:00
更新环境配置示例,添加 GRVT 相关的 API 凭证和选项,增强文档以支持新的交易所适配器,确保用户能够正确配置和使用 GRVT 交易功能。
This commit is contained in:
+22
-13
@@ -1,7 +1,7 @@
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { Box, Text, useInput } from "ink";
|
||||
import { makerConfig } from "../config";
|
||||
import { AsterExchangeAdapter } from "../exchanges/aster-adapter";
|
||||
import { createExchangeAdapter, resolveExchangeId } from "../exchanges/create-adapter";
|
||||
import { OffsetMakerEngine, type OffsetMakerEngineSnapshot } from "../core/offset-maker-engine";
|
||||
import { DataTable, type TableColumn } from "./components/DataTable";
|
||||
import { formatNumber } from "../utils/format";
|
||||
@@ -28,18 +28,28 @@ export function OffsetMakerApp({ onExit }: OffsetMakerAppProps) {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const apiKey = process.env.ASTER_API_KEY;
|
||||
const apiSecret = process.env.ASTER_API_SECRET;
|
||||
if (!apiKey || !apiSecret) {
|
||||
setError(new Error("缺少 ASTER_API_KEY 或 ASTER_API_SECRET 环境变量"));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const adapter = new AsterExchangeAdapter({
|
||||
apiKey,
|
||||
apiSecret,
|
||||
symbol: makerConfig.symbol,
|
||||
});
|
||||
const exchangeId = resolveExchangeId();
|
||||
let adapter;
|
||||
if (exchangeId === "aster") {
|
||||
const apiKey = process.env.ASTER_API_KEY;
|
||||
const apiSecret = process.env.ASTER_API_SECRET;
|
||||
if (!apiKey || !apiSecret) {
|
||||
setError(new Error("缺少 ASTER_API_KEY 或 ASTER_API_SECRET 环境变量"));
|
||||
return;
|
||||
}
|
||||
adapter = createExchangeAdapter({
|
||||
exchange: exchangeId,
|
||||
symbol: makerConfig.symbol,
|
||||
aster: { apiKey, apiSecret },
|
||||
});
|
||||
} else {
|
||||
adapter = createExchangeAdapter({
|
||||
exchange: exchangeId,
|
||||
symbol: makerConfig.symbol,
|
||||
grvt: { symbol: makerConfig.symbol },
|
||||
});
|
||||
}
|
||||
const engine = new OffsetMakerEngine(makerConfig, adapter);
|
||||
engineRef.current = engine;
|
||||
setSnapshot(engine.getSnapshot());
|
||||
@@ -192,4 +202,3 @@ export function OffsetMakerApp({ onExit }: OffsetMakerAppProps) {
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user