Skip to content

Commit

Permalink
Release v0.3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
alplabin committed May 30, 2024
1 parent e2edefa commit 29758bd
Show file tree
Hide file tree
Showing 98 changed files with 2,328 additions and 263 deletions.
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# Changelog

## 0.3.8 - 2024-05-30

### Added
- `Convert`:
- `GET /sapi/v1/convert/exchangeInfo`
- `GET /sapi/v1/convert/assetInfo`
- `POST /sapi/v1/convert/getQuote`
- `POST /sapi/v1/convert/acceptQuote`
- `GET /sapi/v1/convert/orderStatus`
- `POST /sapi/v1/convert/limit/placeOrder`
- `POST /sapi/v1/convert/limit/cancelOrder`
- `GET /sapi/v1/convert/limit/queryOpenOrders`
- `GET /sapi/v1/convert/tradeFlow`

- `Portfolio`:
- `GET /sapi/v1/portfolio/account`
- `GET /sapi/v1/portfolio/collateralRate`
- `GET /sapi/v1/portfolio/pmLoan`
- `POST /sapi/v1/portfolio/repay`
- `GET /sapi/v1/portfolio/interest-history`
- `GET /sapi/v1/portfolio/asset-index-price`
- `POST /sapi/v1/portfolio/auto-collection`
- `POST /sapi/v1/portfolio/asset-collection`
- `POST /sapi/v1/portfolio/bnb-transfer`
- `POST /sapi/v1/portfolio/repay-futures-switch`
- `GET /sapi/v1/portfolio/repay-futures-switch`
- `POST /sapi/v1/portfolio/repay-futures-negative-balance`
- `GET /sapi/v1/portfolio/margin-asset-leverage`

### Changed
- Update dependencies
- Update `GET /api/v3/exchangeInfo` response type
- Correct `createMarginListenKey`, `renewMarginListenKey` and `closeMarginListenKey` url
- Update combined streams for websocket streams
- Update Websocket Testnet endpoint

## 0.3.7 - 2024-04-04

### Changed
Expand Down
19 changes: 19 additions & 0 deletions examples/restful/convert/acceptQuote.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { acceptQuoteOptions, acceptQuoteResponse } from '../../../src/modules/restful/convert/types';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: acceptQuoteOptions = {
recvWindow: 5000,
};

client.acceptQuote('12415572564', options).then((res: acceptQuoteResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
19 changes: 19 additions & 0 deletions examples/restful/convert/cancelLimitOrder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { cancelLimitOrderOptions, cancelLimitOrderResponse } from '../../../src/modules/restful/convert/types';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: cancelLimitOrderOptions = {
recvWindow: 5000,
};

client.cancelLimitOrder(1603680255057330400, options).then((res: cancelLimitOrderResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
20 changes: 20 additions & 0 deletions examples/restful/convert/getConvertTradeHistory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { getConvertTradeHistoryOptions, getConvertTradeHistoryResponse } from '../../../src/modules/restful/convert/types';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: getConvertTradeHistoryOptions = {
limit: 100,
recvWindow: 5000,
};

client.getConvertTradeHistory(1623824139000, 1626416139000, options).then((res: getConvertTradeHistoryResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
19 changes: 19 additions & 0 deletions examples/restful/convert/getOrderQuantityPrecisionPerAsset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { getOrderQuantityPrecisionPerAssetOptions, getOrderQuantityPrecisionPerAssetResponse } from '../../../src/modules/restful/convert/types';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: getOrderQuantityPrecisionPerAssetOptions = {
recvWindow: 5000,
};

client.getOrderQuantityPrecisionPerAsset(options).then((res: getOrderQuantityPrecisionPerAssetResponse[]) => {
console.log(res);
}).catch(err => { console.log(err); });
21 changes: 21 additions & 0 deletions examples/restful/convert/listAllConvertPairs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { listAllConvertPairsOptions, listAllConvertPairsResponse } from '../../../src/modules/restful/convert/types';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: listAllConvertPairsOptions = {
fromAsset: 'BTC',
toAsset: 'USDT',
recvWindow: 5000,
};

client.listAllConvertPairs(options).then((res: listAllConvertPairsResponse[]) => {
console.log(res);
}).catch(err => { console.log(err); });
20 changes: 20 additions & 0 deletions examples/restful/convert/orderStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { orderStatusOptions, orderStatusResponse } from '../../../src/modules/restful/convert/types';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: orderStatusOptions = {
quoteId: '12415572564',
recvWindow: 5000,
};

client.orderStatus(options).then((res: orderStatusResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
21 changes: 21 additions & 0 deletions examples/restful/convert/placeLimitOrder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { placeLimitOrderOptions, placeLimitOrderResponse } from '../../../src/modules/restful/convert/types';
import { ConvertSide, ConvertExpiredType } from '../../../src/modules/enum';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: placeLimitOrderOptions = {
recvWindow: 5000,
baseAmount: 1
};

client.placeLimitOrder('BNB', 'USDT', 1, ConvertSide.BUY, ConvertExpiredType.One_Day, options).then((res: placeLimitOrderResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
19 changes: 19 additions & 0 deletions examples/restful/convert/queryLimitOpenOrders.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { queryLimitOpenOrdersOptions, queryLimitOpenOrdersResponse } from '../../../src/modules/restful/convert/types';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: queryLimitOpenOrdersOptions = {
recvWindow: 5000,
};

client.queryLimitOpenOrders(options).then((res: queryLimitOpenOrdersResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
19 changes: 19 additions & 0 deletions examples/restful/convert/sendQuoteRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { sendQuoteRequestOptions, sendQuoteRequestResponse } from '../../../src/modules/restful/convert/types';

dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: sendQuoteRequestOptions = {
fromAmount: 0.1,
recvWindow: 5000,
};

client.sendQuoteRequest('BNB', 'USDT', options).then((res: sendQuoteRequestResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
19 changes: 19 additions & 0 deletions examples/restful/portfolioMargin/bnbTransfer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { bnbTransferOptions, bnbTransferResponse } from '../../../src/modules/restful/portfolioMargin/types';
import { TransferSide } from '../../../src/modules/enum';

dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: bnbTransferOptions = {
recvWindow: 5000,
};

client.bnbTransfer(1.01, TransferSide.TO_UM, options).then((res: bnbTransferResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
19 changes: 19 additions & 0 deletions examples/restful/portfolioMargin/changeAutorepayfuturesStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { changeAutorepayfuturesStatusOptions, changeAutorepayfuturesStatusResponse } from '../../../src/modules/restful/portfolioMargin/types';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: changeAutorepayfuturesStatusOptions = {
recvWindow: 5000,
};

client.changeAutorepayfuturesStatus(true, options).then((res: changeAutorepayfuturesStatusResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
19 changes: 19 additions & 0 deletions examples/restful/portfolioMargin/fundAutocollection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { fundAutocollectionOptions, fundAutocollectionResponse } from '../../../src/modules/restful/portfolioMargin/types';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: fundAutocollectionOptions = {
recvWindow: 5000,
};

client.fundAutocollection(options).then((res: fundAutocollectionResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
19 changes: 19 additions & 0 deletions examples/restful/portfolioMargin/fundCollectionByAsset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { fundCollectionByAssetOptions, fundCollectionByAssetResponse } from '../../../src/modules/restful/portfolioMargin/types';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: fundCollectionByAssetOptions = {
recvWindow: 5000,
};

client.fundCollectionByAsset('BTC', options).then((res: fundCollectionByAssetResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
19 changes: 19 additions & 0 deletions examples/restful/portfolioMargin/getAutorepayfuturesStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { getAutorepayfuturesStatusOptions, getAutorepayfuturesStatusResponse } from '../../../src/modules/restful/portfolioMargin/types';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: getAutorepayfuturesStatusOptions = {
recvWindow: 5000,
};

client.getAutorepayfuturesStatus(options).then((res: getAutorepayfuturesStatusResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { getClassicPortfolioMarginNegativeBalanceInterestHistoryOptions, getClassicPortfolioMarginNegativeBalanceInterestHistoryResponse } from '../../../src/modules/restful/portfolioMargin/types';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: getClassicPortfolioMarginNegativeBalanceInterestHistoryOptions = {
asset: 'BNB',
size: 100,
recvWindow: 5000,
};

client.getClassicPortfolioMarginNegativeBalanceInterestHistory(options).then((res: getClassicPortfolioMarginNegativeBalanceInterestHistoryResponse[]) => {
console.log(res);
}).catch(err => { console.log(err); });
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { getPortfolioMarginAssetIndexPriceOptions, getPortfolioMarginAssetIndexPriceResponse } from '../../../src/modules/restful/portfolioMargin/types';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, '', { baseURL: baseURL });

const options: getPortfolioMarginAssetIndexPriceOptions = {
asset: 'BNB',
};

client.getPortfolioMarginAssetIndexPrice(options).then((res: getPortfolioMarginAssetIndexPriceResponse[]) => {
console.log(res);
}).catch(err => { console.log(err); });
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Spot } from '../../../src/index';
import dotenv from 'dotenv';
import { getPortfolioMarginAssetLeverageResponse } from '../../../src/modules/restful/portfolioMargin/types';


dotenv.config();

const apiKey = process.env.BINANCE_API_KEY || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, '', { baseURL: baseURL });

client.getPortfolioMarginAssetLeverage().then((res: getPortfolioMarginAssetLeverageResponse[]) => {
console.log(res);
}).catch(err => { console.log(err); });
Loading

0 comments on commit 29758bd

Please sign in to comment.