diff --git a/src/bingx-socket/bingx-market-socket-stream.ts b/src/bingx-socket/bingx-market-socket-stream.ts index d483bf5..e09940f 100644 --- a/src/bingx-socket/bingx-market-socket-stream.ts +++ b/src/bingx-socket/bingx-market-socket-stream.ts @@ -16,9 +16,9 @@ import { HeartbeatInterface } from 'bingx-api/bingx-socket/interfaces/heartbeat. import { LatestTradeEvent, MarkerSubscription, - MarkerWebsocketEvents, + MarketWebsocketEvents, SubscriptionType, -} from 'bingx-api/bingx-socket/events/marker-websocket-events'; +} from 'bingx-api/bingx-socket/events/market-websocket-events'; export class BingxMarketSocketStream { private forceClose$ = new BehaviorSubject(false); @@ -36,7 +36,7 @@ export class BingxMarketSocketStream { } private async connect(url: URL): Promise { - const socket$ = webSocket({ + const socket$ = webSocket({ deserializer: (e) => new BingxWebsocketDeserializer().deserializer(e), serializer: (e) => new BingxWebsocketSerializer().serializer(e), url: url.toString(), diff --git a/src/bingx-socket/events/index.ts b/src/bingx-socket/events/index.ts index 641314a..add0f81 100644 --- a/src/bingx-socket/events/index.ts +++ b/src/bingx-socket/events/index.ts @@ -4,11 +4,11 @@ export { SubscriptionType, LatestTradeEvent, TradeDataType, - MarkerWebsocketEvents, + MarketWebsocketEvents, Price, Volume, MarkerWebsocketEventCode, IsMarketMaker, TransactionTimeInMillis, MarkerSubscription, -} from './marker-websocket-events'; +} from './market-websocket-events'; diff --git a/src/bingx-socket/events/marker-websocket-events.ts b/src/bingx-socket/events/market-websocket-events.ts similarity index 72% rename from src/bingx-socket/events/marker-websocket-events.ts rename to src/bingx-socket/events/market-websocket-events.ts index c45529e..80e65d2 100644 --- a/src/bingx-socket/events/marker-websocket-events.ts +++ b/src/bingx-socket/events/market-websocket-events.ts @@ -19,16 +19,21 @@ export type TradeDataType = `${TradingPair}@trade`; export type SubscriptionType = TradeDataType; -export interface MarkerWebsocketEvents { +export interface MarketWebsocketEvents { code: MarkerWebsocketEventCode; dataType: SubscriptionType; } -export interface LatestTradeEvent extends MarkerWebsocketEvents { - dataType: TradeDataType; +export interface TradeDetail { T: TransactionTimeInMillis; s: TradingPair; m: IsMarketMaker; p: Price; - v: Volume; + v: Volume; // Assuming 'q' represents volume +} + +export interface LatestTradeEvent extends MarketWebsocketEvents { + code: MarkerWebsocketEventCode; + dataType: TradeDataType; + data: TradeDetail[]; }