feat: 添加资金费率获取功能至基础套利引擎,更新UI以显示资金费率信息

This commit is contained in:
discountry
2025-10-07 15:56:50 +08:00
parent ad46635e20
commit 58f5de4a48
3 changed files with 92 additions and 4 deletions
+10 -1
View File
@@ -82,6 +82,9 @@ export function BasisApp({ onExit }: BasisAppProps) {
const lastUpdated = snapshot.lastUpdated ? new Date(snapshot.lastUpdated).toLocaleTimeString() : "-";
const futuresUpdated = snapshot.futuresLastUpdate ? new Date(snapshot.futuresLastUpdate).toLocaleTimeString() : "-";
const spotUpdated = snapshot.spotLastUpdate ? new Date(snapshot.spotLastUpdate).toLocaleTimeString() : "-";
const fundingRatePct = snapshot.fundingRate != null ? `${(snapshot.fundingRate * 100).toFixed(4)}%` : "-";
const fundingUpdated = snapshot.fundingLastUpdate ? new Date(snapshot.fundingLastUpdate).toLocaleTimeString() : "-";
const nextFundingTime = snapshot.nextFundingTime ? new Date(snapshot.nextFundingTime).toLocaleTimeString() : "-";
const feedStatus = snapshot.feedStatus;
const lastLogs = snapshot.tradeLog.slice(-5);
@@ -92,7 +95,7 @@ export function BasisApp({ onExit }: BasisAppProps) {
<Text>
: {exchangeName} : {snapshot.futuresSymbol} : {snapshot.spotSymbol}
</Text>
<Text color="gray"> Esc 数据状态: 期货({feedStatus.futures ? "OK" : "--"}) ({feedStatus.spot ? "OK" : "--"})</Text>
<Text color="gray"> Esc 数据状态: 期货({feedStatus.futures ? "OK" : "--"}) ({feedStatus.spot ? "OK" : "--"}) ({feedStatus.funding ? "OK" : "--"})</Text>
<Text color="gray">: {lastUpdated}</Text>
</Box>
@@ -109,6 +112,12 @@ export function BasisApp({ onExit }: BasisAppProps) {
</Box>
</Box>
<Box flexDirection="column" marginBottom={1}>
<Text color="yellow"></Text>
<Text>: {fundingRatePct}</Text>
<Text color="gray">: {fundingUpdated} : {nextFundingTime}</Text>
</Box>
<Box flexDirection="column" marginBottom={1}>
<Text color={snapshot.opportunity ? "greenBright" : "redBright"}> / </Text>
<Text color={snapshot.opportunity ? "green" : undefined}>: {spread} USDT {spreadBps} bp</Text>