refactor: rename Aster-prefixed universal types to clean names

- AsterOrder → Order
- AsterAccountSnapshot → AccountSnapshot
- AsterAccountPosition → AccountPosition
- AsterAccountAsset → AccountAsset
- AsterDepthLevel → DepthLevel
- AsterDepth → Depth
- AsterTicker → Ticker
- AsterKline → Kline

These types are the platform-agnostic contract used by all 8 exchanges,
not Aster-specific. Renamed across 63 files.
This commit is contained in:
discountry
2026-04-06 18:11:57 +08:00
parent 230c0d5e18
commit fda6bcad1d
62 changed files with 727 additions and 727 deletions
+7 -7
View File
@@ -1,6 +1,6 @@
import type { BasisArbConfig } from "../config";
import type { ExchangeAdapter, FundingRateSnapshot } from "../exchanges/adapter";
import type { AsterAccountSnapshot, AsterDepth, AsterSpotBookTicker } from "../exchanges/types";
import type { AccountSnapshot, Depth, AsterSpotBookTicker } from "../exchanges/types";
import { AsterSpotRestClient, AsterRestClient } from "../exchanges/aster/client";
import { createTradeLog, type TradeLogEntry } from "../logging/trade-log";
import { StrategyEventEmitter } from "./common/event-emitter";
@@ -155,7 +155,7 @@ export class BasisArbEngine {
private bootstrap(): void {
const log: LogHandler = (type, detail) => this.tradeLog.push(type, detail);
safeSubscribe<AsterDepth>(
safeSubscribe<Depth>(
this.exchange.watchDepth.bind(this.exchange, this.config.futuresSymbol),
(depth) => {
this.applyFuturesDepth(depth);
@@ -168,7 +168,7 @@ export class BasisArbEngine {
);
if (this.exchange.id === "nado" || this.exchange.id === "standx" || this.exchange.id === "binance") {
safeSubscribe<AsterDepth>(
safeSubscribe<Depth>(
this.exchange.watchDepth.bind(this.exchange, this.config.spotSymbol),
(depth) => {
this.applySpotDepth(depth);
@@ -196,7 +196,7 @@ export class BasisArbEngine {
);
}
safeSubscribe<AsterAccountSnapshot>(
safeSubscribe<AccountSnapshot>(
this.exchange.watchAccount.bind(this.exchange),
(snapshot) => {
this.applyAccountSnapshot(snapshot);
@@ -210,7 +210,7 @@ export class BasisArbEngine {
}
}
private applyFuturesDepth(depth: AsterDepth): void {
private applyFuturesDepth(depth: Depth): void {
if (!depth?.bids?.length || !depth?.asks?.length) {
return;
}
@@ -360,7 +360,7 @@ export class BasisArbEngine {
this.emitUpdate();
}
private applySpotDepth(depth: AsterDepth): void {
private applySpotDepth(depth: Depth): void {
if (!depth?.bids?.length || !depth?.asks?.length) {
return;
}
@@ -395,7 +395,7 @@ export class BasisArbEngine {
this.emitUpdate();
}
private applyAccountSnapshot(snapshot: AsterAccountSnapshot): void {
private applyAccountSnapshot(snapshot: AccountSnapshot): void {
const assets = Array.isArray(snapshot.assets) ? snapshot.assets : [];
const spotBalances: SpotBalanceStateEntry[] = [];