Skip to content

Commit

Permalink
feat: add the getTakenFunds method
Browse files Browse the repository at this point in the history
  • Loading branch information
vansergen committed Feb 16, 2021
1 parent c3fe1d6 commit c53a180
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/auth1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,17 @@ export interface FundingTrade {
offer_id: number;
}

export interface TakenFund {
id: number;
position_id: number;
currency: string;
rate: string;
period: number;
amount: string;
timestamp: string;
auto_close: boolean;
}

export interface AuthenticatedClient1Options extends PublicClient1Params {
key: string;
secret: string;
Expand Down Expand Up @@ -685,12 +696,19 @@ export class AuthenticatedClient1 extends PublicClient1 {
body: FundingTradesParams
): Promise<FundingTrade[]> {
const request = "/v1/mytrades_funding";
const offers = (await this.post(
const trades = (await this.post(
request,
{},
{ ...body }
)) as FundingTrade[];
return offers;
return trades;
}

/** Get funds used in a margin position. */
public async getTakenFunds(): Promise<TakenFund[]> {
const request = "/v1/taken_funds";
const funds = (await this.post(request, {}, {})) as TakenFund[];
return funds;
}

public set nonce(nonce: () => number) {
Expand Down

0 comments on commit c53a180

Please sign in to comment.