Skip to content

Commit

Permalink
Merge branch 'master' into portfoliom
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagosiebler authored Nov 7, 2024
2 parents df85af1 + 3b39b28 commit db8cc9a
Show file tree
Hide file tree
Showing 19 changed files with 915 additions and 571 deletions.
1,046 changes: 528 additions & 518 deletions docs/endpointFunctionList.md

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions examples/apidoc/CoinMClient/getAccountCommissionRate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { CoinMClient } = require('binance');

// This example shows how to call this Binance API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "binance" for Binance exchange
// This Binance API SDK is available on npm via "npm install binance"
// ENDPOINT: dapi/v1/commissionRate
// METHOD: GET
// PUBLIC: NO

const client = new CoinMClient({
apiKey: 'insert_api_key_here',
apiSecret: 'insert_api_secret_here',
});

client.getAccountCommissionRate(params)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
20 changes: 20 additions & 0 deletions examples/apidoc/CoinMClient/getDownloadIdForFuturesOrderHistory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { CoinMClient } = require('binance');

// This example shows how to call this Binance API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "binance" for Binance exchange
// This Binance API SDK is available on npm via "npm install binance"
// ENDPOINT: dapi/v1/order/asyn
// METHOD: GET
// PUBLIC: NO

const client = new CoinMClient({
apiKey: 'insert_api_key_here',
apiSecret: 'insert_api_secret_here',
});

client.getDownloadIdForFuturesOrderHistory(params)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
20 changes: 20 additions & 0 deletions examples/apidoc/CoinMClient/getDownloadIdForFuturesTradeHistory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { CoinMClient } = require('binance');

// This example shows how to call this Binance API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "binance" for Binance exchange
// This Binance API SDK is available on npm via "npm install binance"
// ENDPOINT: dapi/v1/trade/asyn
// METHOD: GET
// PUBLIC: NO

const client = new CoinMClient({
apiKey: 'insert_api_key_here',
apiSecret: 'insert_api_secret_here',
});

client.getDownloadIdForFuturesTradeHistory(params)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { CoinMClient } = require('binance');

// This example shows how to call this Binance API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "binance" for Binance exchange
// This Binance API SDK is available on npm via "npm install binance"
// ENDPOINT: dapi/v1/income/asyn
// METHOD: GET
// PUBLIC: NO

const client = new CoinMClient({
apiKey: 'insert_api_key_here',
apiSecret: 'insert_api_secret_here',
});

client.getDownloadIdForFuturesTransactionHistory(params)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
20 changes: 20 additions & 0 deletions examples/apidoc/CoinMClient/getFuturesOrderHistoryDownloadLink.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { CoinMClient } = require('binance');

// This example shows how to call this Binance API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "binance" for Binance exchange
// This Binance API SDK is available on npm via "npm install binance"
// ENDPOINT: dapi/v1/order/asyn/id
// METHOD: GET
// PUBLIC: NO

const client = new CoinMClient({
apiKey: 'insert_api_key_here',
apiSecret: 'insert_api_secret_here',
});

client.getFuturesOrderHistoryDownloadLink(params)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
20 changes: 20 additions & 0 deletions examples/apidoc/CoinMClient/getFuturesTradeHistoryDownloadLink.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { CoinMClient } = require('binance');

// This example shows how to call this Binance API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "binance" for Binance exchange
// This Binance API SDK is available on npm via "npm install binance"
// ENDPOINT: dapi/v1/trade/asyn/id
// METHOD: GET
// PUBLIC: NO

const client = new CoinMClient({
apiKey: 'insert_api_key_here',
apiSecret: 'insert_api_secret_here',
});

client.getFuturesTradeHistoryDownloadLink(params)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { CoinMClient } = require('binance');

// This example shows how to call this Binance API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "binance" for Binance exchange
// This Binance API SDK is available on npm via "npm install binance"
// ENDPOINT: dapi/v1/income/asyn/id
// METHOD: GET
// PUBLIC: NO

const client = new CoinMClient({
apiKey: 'insert_api_key_here',
apiSecret: 'insert_api_secret_here',
});

client.getFuturesTransactionHistoryDownloadLink(params)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
20 changes: 20 additions & 0 deletions examples/apidoc/MainClient/getPortfolioMarginProAccountBalance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { MainClient } = require('binance');

// This example shows how to call this Binance API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "binance" for Binance exchange
// This Binance API SDK is available on npm via "npm install binance"
// ENDPOINT: sapi/v1/portfolio/balance
// METHOD: GET
// PUBLIC: NO

const client = new MainClient({
apiKey: 'insert_api_key_here',
apiSecret: 'insert_api_secret_here',
});

client.getPortfolioMarginProAccountBalance(params)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
20 changes: 20 additions & 0 deletions examples/apidoc/MainClient/getPortfolioMarginProSpanAccountInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { MainClient } = require('binance');

// This example shows how to call this Binance API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "binance" for Binance exchange
// This Binance API SDK is available on npm via "npm install binance"
// ENDPOINT: sapi/v2/portfolio/account
// METHOD: GET
// PUBLIC: NO

const client = new MainClient({
apiKey: 'insert_api_key_here',
apiSecret: 'insert_api_secret_here',
});

client.getPortfolioMarginProSpanAccountInfo(params)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
20 changes: 20 additions & 0 deletions examples/apidoc/USDMClient/getAccountCommissionRate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { USDMClient } = require('binance');

// This example shows how to call this Binance API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "binance" for Binance exchange
// This Binance API SDK is available on npm via "npm install binance"
// ENDPOINT: fapi/v1/commissionRate
// METHOD: GET
// PUBLIC: NO

const client = new USDMClient({
apiKey: 'insert_api_key_here',
apiSecret: 'insert_api_secret_here',
});

client.getAccountCommissionRate(params)
.then((response) => {
console.log(response);
})
.catch((error) => {
console.error(error);
});
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "binance",
"version": "2.13.11",
"version": "2.13.13",
"description": "Node.js & JavaScript SDK for Binance REST APIs & WebSockets, with TypeScript & end-to-end tests.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
58 changes: 58 additions & 0 deletions src/coinm-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
CoinMPositionTrade,
CoinMSymbolOrderBookTicker,
FundingRate,
FuturesTransactionHistoryDownloadLink,
GetClassicPortfolioMarginNotionalLimitParams,
PositionRisk,
SymbolOrPair,
Expand Down Expand Up @@ -441,12 +442,21 @@ export class CoinMClient extends BaseRestClient {
return this.getPrivate('dapi/v1/balance');
}

/**
* @deprecated Please use `getAccountCommissionRate()` instead. This will be removed in the next major release.
*/
getAccountComissionRate(
params: BasicSymbolParam,
): Promise<UserCommissionRate> {
return this.getPrivate('dapi/v1/commissionRate', params);
}

getAccountCommissionRate(
params: BasicSymbolParam,
): Promise<UserCommissionRate> {
return this.getPrivate('dapi/v1/commissionRate', params);
}

getAccountInformation(): Promise<FuturesCoinMAccountInformation> {
return this.getPrivate('dapi/v1/account');
}
Expand All @@ -471,6 +481,54 @@ export class CoinMClient extends BaseRestClient {
return this.getPrivate('dapi/v1/income', params);
}

getDownloadIdForFuturesTransactionHistory(params: {
startTime: number;
endTime: number;
}): Promise<{
avgCostTimestampOfLast30d: number;
downloadId: string;
}> {
return this.getPrivate('dapi/v1/income/asyn', params);
}

getFuturesTransactionHistoryDownloadLink(params: {
downloadId: string;
}): Promise<FuturesTransactionHistoryDownloadLink> {
return this.getPrivate('dapi/v1/income/asyn/id', params);
}

getDownloadIdForFuturesOrderHistory(params: {
startTime: number;
endTime: number;
}): Promise<{
avgCostTimestampOfLast30d: number;
downloadId: string;
}> {
return this.getPrivate('dapi/v1/order/asyn', params);
}

getFuturesOrderHistoryDownloadLink(params: {
downloadId: string;
}): Promise<FuturesTransactionHistoryDownloadLink> {
return this.getPrivate('dapi/v1/order/asyn/id', params);
}

getDownloadIdForFuturesTradeHistory(params: {
startTime: number;
endTime: number;
}): Promise<{
avgCostTimestampOfLast30d: number;
downloadId: string;
}> {
return this.getPrivate('dapi/v1/trade/asyn', params);
}

getFuturesTradeHistoryDownloadLink(params: {
downloadId: string;
}): Promise<FuturesTransactionHistoryDownloadLink> {
return this.getPrivate('dapi/v1/trade/asyn/id', params);
}

/**
*
* Portfolio Margin Endpoints
Expand Down
Loading

0 comments on commit db8cc9a

Please sign in to comment.