Skip to content

Commit

Permalink
Merge pull request #74 from singlesly/feat_cancel_order
Browse files Browse the repository at this point in the history
Feat cancel order
  • Loading branch information
singlesly authored Feb 25, 2024
2 parents 67f232d + 08044dc commit e10420e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/bingx-socket/bingx-account-socket-stream-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,16 @@ export class BingxAccountSocketStreamPool {

if (this.accounts[account.getApiKey()]) {
this.accounts[account.getApiKey()][1].disconnect();
this.accounts[account.getApiKey()][1].disconnect();
}

this.accounts[account.getApiKey()] = [account, stream];
}

public getAccounts() {
return this.accounts;
}

public removeAccount(account: AccountInterface) {
if (this.accounts[account.getApiKey()]) {
const [sacrifice, stream] = this.accounts[account.getApiKey()];
Expand Down
7 changes: 3 additions & 4 deletions src/bingx-socket/bingx-account-socket-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,9 @@ export class BingxAccountSocketStream {

this.onDisconnect$.subscribe(() => {
socketSubscription.unsubscribe();

if (!this.forceClose$.value) {
this.connect(account, requestExecutor);
}
console.log(
`${BingxAccountSocketStream.name} disconnected ${account.getApiKey()}`,
);
});

this.forceClose$.subscribe((v) => {
Expand Down

0 comments on commit e10420e

Please sign in to comment.