Skip to content

Commit

Permalink
Release v0.3.14
Browse files Browse the repository at this point in the history
  • Loading branch information
alplabin committed Nov 27, 2024
1 parent 8aa9a5d commit d4e0701
Show file tree
Hide file tree
Showing 75 changed files with 2,015 additions and 496 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tspackage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x, 22.x]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Changelog

## 0.3.14 - 2024-11-27
### Added
- `Margin`:
- `POST /sapi/v1/margin/order/oto`
- `POST /sapi/v1/margin/order/otoco`
- `Portfolio`:
- `GET /sapi/v1/portfolio/balance`
- `GET /sapi/v2/portfolio/account`
- `GET /sapi/v2/portfolio/collateralRate`
- `Simple Earn`:
- `POST /sapi/v1/simple-earn/locked/setRedeemOption`
- `Wallet`:
- `GET /sapi/v1/account/info`
- `GET /sapi/v1/asset/custody/transfer-history`
- `GET /sapi/v1/asset/wallet/balance`
- `GET /sapi/v1/capital/deposit/address/list`
- `GET /sapi/v1/spot/delist-schedule`

### Changed
- Updated dependencies
- Added optional parameters `showPermissionSets` and `symbolStatus` to endpoint `GET /api/v3/exchangeInfo`
- Fixed response type issue in `GET /sapi/v1/margin/crossMarginCollateralRatio`
- `POST /sapi/v1/simple-earn/locked/subscribe` new parameter: `redeemTo`
- Updated fields in response for the following endpoints:
- `GET /sapi/v1/margin/account`
- `GET /sapi/v1/simple-earn/locked/position`
- `GET /sapi/v1/simple-earn/flexible/history/subscriptionRecord`
- `GET /sapi/v1/simple-earn/locked/history/subscriptionRecord`
- `GET /sapi/v1/simple-earn/locked/history/redemptionRecord`
- `GET /sapi/v4/sub-account/assets`
- `GET /sapi/v3/sub-account/assets`

## 0.3.13 - 2024-10-11
### Added
- `Dual Investment`:
Expand Down
13 changes: 13 additions & 0 deletions examples/restful/margin/crossMarginCollateralRatio.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import dotenv from 'dotenv';
import { RestMarginTypes, Spot } from '../../../src/index';

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 });

client.crossMarginCollateralRatio().then((res: RestMarginTypes.crossMarginCollateralRatioResponse[]) => {
console.log(res);
}).catch(err => { console.log(err); });
3 changes: 2 additions & 1 deletion examples/restful/margin/getAllCrossMarginPairs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { RestMarginTypes, Spot } from '../../../src/index';
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, '', { baseURL: baseURL });
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

client.getAllCrossMarginPairs().then((res: RestMarginTypes.getAllCrossMarginPairsResponse[]) => {
console.log(res);
Expand Down
9 changes: 7 additions & 2 deletions examples/restful/margin/getAllMarginAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ import { RestMarginTypes, Spot } from '../../../src/index';
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, '', { baseURL: baseURL });
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

client.getAllMarginAssets().then((res: RestMarginTypes.getAllMarginAssetsResponse[]) => {
const options = {
asset: 'BNB',
};

client.getAllMarginAssets(options).then((res: RestMarginTypes.getAllMarginAssetsResponse[]) => {
console.log(res);
}).catch(err => { console.log(err); });
3 changes: 2 additions & 1 deletion examples/restful/margin/getMarginPriceindex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { RestMarginTypes, Spot } from '../../../src/index';
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, '', { baseURL: baseURL });
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });


client.getMarginPriceIndex('BNBUSDT').then((res: RestMarginTypes.getMarginPriceIndexResponse) => {
Expand Down
31 changes: 31 additions & 0 deletions examples/restful/margin/marginAccountNewOto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import dotenv from 'dotenv';
import { OtoPendingType, OrderListWorkingType, RestMarginTypes, Side, Spot, TimeInForce } from '../../../src/index';

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: RestMarginTypes.marginAccountNewOtoOptions = {
workingTimeInForce: TimeInForce.GTC,
pendingPrice: 595,
pendingTimeInForce: TimeInForce.GTC,
workingIcebergQty: 0.1,
recvWindow: 5000,
};

client.marginAccountNewOto(
'BNBUSDT',
OrderListWorkingType.LIMIT,
Side.SELL,
600,
1,
OtoPendingType.LIMIT,
Side.BUY,
1,
options
).then((res: RestMarginTypes.marginAccountNewOtoResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
32 changes: 32 additions & 0 deletions examples/restful/margin/marginAccountNewOtoco.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import dotenv from 'dotenv';
import { OrderListAboveBelowType, OrderListWorkingType, RestMarginTypes, Side, Spot, TimeInForce } from '../../../src/index';

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: RestMarginTypes.marginAccountNewOtocoOptions = {
workingTimeInForce: TimeInForce.GTC,
pendingAbovePrice: 605,
pendingBelowType: OrderListAboveBelowType.LIMIT_MAKER,
pendingBelowPrice: 595,
workingIcebergQty: 0.1,
recvWindow: 5000,
};

client.marginAccountNewOtoco(
'BNBUSDT',
OrderListWorkingType.LIMIT,
Side.BUY,
600,
1,
Side.SELL,
1,
OrderListAboveBelowType.LIMIT_MAKER,
options
).then((res: RestMarginTypes.marginAccountNewOtocoResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
19 changes: 19 additions & 0 deletions examples/restful/portfolioMargin/getAccountBalance.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 { getAccountBalanceOptions, getAccountBalanceResponse } 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: getAccountBalanceOptions = {
recvWindow: 5000,
};

client.getAccountBalance(options).then((res: getAccountBalanceResponse[]) => {
console.log(res);
}).catch(err => { console.log(err); });
19 changes: 19 additions & 0 deletions examples/restful/portfolioMargin/getSpanAccountInfo.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 { getSpanAccountInfoOptions, getSpanAccountInfoResponse } 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: getSpanAccountInfoOptions = {
recvWindow: 5000,
};

client.getSpanAccountInfo(options).then((res: getSpanAccountInfoResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
19 changes: 19 additions & 0 deletions examples/restful/portfolioMargin/getTieredCollateralRate.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 { getTieredCollateralRateOptions, getTieredCollateralRateResponse } 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: getTieredCollateralRateOptions = {
recvWindow: 5000,
};

client.getTieredCollateralRate(options).then((res: getTieredCollateralRateResponse[]) => {
console.log(res);
}).catch(err => { console.log(err); });
17 changes: 17 additions & 0 deletions examples/restful/simpleEarn/setLockedRedeemOption.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import dotenv from 'dotenv';
import { RedeemOption, RestSimpleEarnTypes, Spot } from '../../../src/index';

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: RestSimpleEarnTypes.setLockedRedeemOptionOptions = {
recvWindow: 5000,
};

client.setLockedRedeemOption('1', RedeemOption.SPOT, options).then((res: RestSimpleEarnTypes.setLockedRedeemOptionResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
14 changes: 14 additions & 0 deletions examples/restful/wallet/accountInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import dotenv from 'dotenv';
import { RestWalletTypes, Spot } from '../../../src/index';

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 });


client.accountInfo().then((res: RestWalletTypes.accountInfoResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
14 changes: 14 additions & 0 deletions examples/restful/wallet/depositAddressList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import dotenv from 'dotenv';
import { RestWalletTypes, Spot } from '../../../src/index';

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 });


client.depositAddressList('BNB').then((res: RestWalletTypes.depositAddressListResponse[]) => {
console.log(res);
}).catch(err => { console.log(err); });
14 changes: 14 additions & 0 deletions examples/restful/wallet/getSymbolsDelistSchedule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import dotenv from 'dotenv';
import { RestWalletTypes, Spot } from '../../../src/index';

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 });


client.getSymbolsDelistSchedule().then((res: RestWalletTypes.getSymbolsDelistScheduleResponse[]) => {
console.log(res);
}).catch(err => { console.log(err); });
14 changes: 14 additions & 0 deletions examples/restful/wallet/queryUserDelegationHistory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import dotenv from 'dotenv';
import { RestWalletTypes, Spot } from '../../../src/index';

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 });


client.queryUserDelegationHistory('email', 1695205000000, 1695205999999).then((res: RestWalletTypes.queryUserDelegationHistoryResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
14 changes: 14 additions & 0 deletions examples/restful/wallet/queryUserWalletBalance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import dotenv from 'dotenv';
import { RestWalletTypes, Spot } from '../../../src/index';

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 });


client.queryUserWalletBalance().then((res: RestWalletTypes.queryUserWalletBalanceResponse[]) => {
console.log(res);
}).catch(err => { console.log(err); });
Loading

0 comments on commit d4e0701

Please sign in to comment.