forked from singlesly/bingx-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbingx-perpetual-swap-positions-endpoint.ts
More file actions
53 lines (47 loc) · 1.45 KB
/
Copy pathbingx-perpetual-swap-positions-endpoint.ts
File metadata and controls
53 lines (47 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { Endpoint } from 'bingx-api/bingx/endpoints/endpoint';
import { EndpointInterface } from 'bingx-api/bingx/endpoints/endpoint.interface';
import { SignatureParametersInterface } from 'bingx-api/bingx/account/signature-parameters.interface';
import { AccountInterface } from 'bingx-api/bingx/account/account.interface';
import { DefaultSignatureParameters } from 'bingx-api/bingx/account/default-signature-parameters';
import { OrderPositionSideEnum } from 'bingx-api/bingx/enums/order-position-side.enum';
import { BingxResponse } from 'bingx-api/bingx';
export interface PerpetualSwapPositionsData<
T extends number | string = string,
> {
symbol: string;
positionId: string;
positionSide: OrderPositionSideEnum;
isolated: boolean;
positionAmt: T;
availableAmt: string;
unrealizedProfit: T;
realisedProfit: T;
initialMargin: T;
avgPrice: T;
leverage: number;
}
export class BingxPerpetualSwapPositionsEndpoint<
R = PerpetualSwapPositionsData[],
>
extends Endpoint
implements EndpointInterface<BingxResponse<R>>
{
constructor(
private readonly symbol: string,
account: AccountInterface,
) {
super(account);
}
method(): 'get' | 'post' | 'put' | 'patch' | 'delete' {
return 'get';
}
parameters(): SignatureParametersInterface {
return new DefaultSignatureParameters({
symbol: this.symbol,
});
}
path(): string {
return '/openApi/swap/v2/user/positions';
}
readonly t!: BingxResponse<R>;
}