expose connectPrivate() util method for spot
This commit is contained in:
@@ -101,7 +101,8 @@ const getLinearWsKeyForTopic = (topic: string): WsKey => {
|
|||||||
return wsKeyLinearPublic;
|
return wsKeyLinearPublic;
|
||||||
}
|
}
|
||||||
const getSpotWsKeyForTopic = (topic: string): WsKey => {
|
const getSpotWsKeyForTopic = (topic: string): WsKey => {
|
||||||
const privateLinearTopics = ['position', 'execution', 'order', 'stop_order'];
|
const privateLinearTopics = ['position', 'execution', 'order', 'stop_order', 'outboundAccountInfo', 'executionReport', 'ticketInfo'];
|
||||||
|
|
||||||
if (privateLinearTopics.includes(topic)) {
|
if (privateLinearTopics.includes(topic)) {
|
||||||
return wsKeySpotPrivate;
|
return wsKeySpotPrivate;
|
||||||
}
|
}
|
||||||
@@ -233,6 +234,20 @@ export class WebsocketClient extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public connectPrivate(): Promise<WebSocket | undefined> | undefined {
|
||||||
|
if (this.isInverse()) {
|
||||||
|
return this.connect(wsKeyInverse);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.isLinear()) {
|
||||||
|
return this.connect(wsKeyLinearPrivate);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.isSpot()) {
|
||||||
|
return this.connect(wsKeySpotPrivate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async connect(wsKey: WsKey): Promise<WebSocket | undefined> {
|
private async connect(wsKey: WsKey): Promise<WebSocket | undefined> {
|
||||||
try {
|
try {
|
||||||
if (this.wsStore.isWsOpen(wsKey)) {
|
if (this.wsStore.isWsOpen(wsKey)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user