-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement switch margin mode #39
- Loading branch information
ilinikh.a1
committed
Oct 12, 2023
1 parent
d1da148
commit 6cb367e
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { | ||
AccountInterface, | ||
DefaultSignatureParameters, | ||
Endpoint, | ||
EndpointInterface, | ||
SignatureParametersInterface, | ||
} from '@app/bingx'; | ||
|
||
export interface SwitchMarginModeResponse { | ||
code: number; | ||
msg: string; | ||
} | ||
|
||
export type MarginType = 'ISOLATED' | 'CROSSED'; | ||
|
||
export class BingxSwitchMarginModeEndpoint | ||
extends Endpoint | ||
implements EndpointInterface<SwitchMarginModeResponse> | ||
{ | ||
public constructor( | ||
private readonly symbol: string, | ||
private readonly marginType: MarginType, | ||
account: AccountInterface, | ||
) { | ||
super(account); | ||
} | ||
|
||
method(): 'get' | 'post' | 'put' | 'patch' | 'delete' { | ||
return 'post'; | ||
} | ||
|
||
parameters(): SignatureParametersInterface { | ||
return new DefaultSignatureParameters({ | ||
symbol: this.symbol, | ||
marginType: this.marginType, | ||
}); | ||
} | ||
|
||
path(): string { | ||
return '/openApi/swap/v2/trade/marginType'; | ||
} | ||
|
||
readonly t!: SwitchMarginModeResponse; | ||
} |