Skip to content

Commit

Permalink
Release v0.3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
alplabin committed Jul 2, 2024
1 parent 273bb2d commit dcd36cc
Show file tree
Hide file tree
Showing 50 changed files with 913 additions and 443 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 0.3.9 - 2024-07-02

### Added
- `POST /api/v3/orderList/oto`
- `POST /api/v3/orderList/otoco`

### Changed
- Updated dependencies
- Updated `Restful` OCO trade deprecated endpoint `POST /api/v3/order/oco` to `POST /api/v3/orderList/oco`
- Updated `Websocket API` OCO trade deprecated endpoint `orderList.place` to `orderList.place.oco`
- Updated `updateIpRestrictionForSubAccountApiKey` function typo to `addIpRestrictionForSubAccountApiKey`
- Updated following enums:
- `OCOOrderStatus` to `OrderListOrderStatus`
- `OCOStatusType` to `OrderListStatusType`

## 0.3.8 - 2024-05-30

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ const apiSecret = process.env.BINANCE_API_SECRET || '';
const baseURL = process.env.BINANCE_BASE_URL || '';
const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: RestSubAccountTypes.updateIpRestrictionForSubAccountApiKeyOptions = {
const options: RestSubAccountTypes.addIpRestrictionForSubAccountApiKeyOptions = {
recvWindow: 5000,
};

client.updateIpRestrictionForSubAccountApiKey(
client.addIpRestrictionForSubAccountApiKey(
'[email protected]',
'subAccountApiKey',
'1',
options
).then((res: RestSubAccountTypes.updateIpRestrictionForSubAccountApiKeyResponse) => {
).then((res: RestSubAccountTypes.addIpRestrictionForSubAccountApiKeyResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
6 changes: 4 additions & 2 deletions examples/restful/trade/newOco.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import dotenv from 'dotenv';
import { Side, RestTradeTypes, Spot } from '../../../src/index';
import { OrderListAboveBelowType, RestTradeTypes, Side, Spot } from '../../../src/index';

dotenv.config();

Expand All @@ -10,8 +10,10 @@ const client = new Spot(apiKey, apiSecret, { baseURL: baseURL });

const options: RestTradeTypes.newOcoOptions = {
recvWindow: 5000,
abovePrice: 510,
belowPrice: 500
};

client.newOco('BNBUSDT', Side.SELL, 1, 218, 220, options).then((res: RestTradeTypes.newOcoResponse) => {
client.newOco('BNBUSDT', Side.SELL, 1, OrderListAboveBelowType.LIMIT_MAKER, OrderListAboveBelowType.LIMIT_MAKER, options).then((res: RestTradeTypes.newOcoResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
20 changes: 20 additions & 0 deletions examples/restful/trade/newOto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import dotenv from 'dotenv';
import { OtoPendingType, orderListWorkingType, RestTradeTypes, 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: RestTradeTypes.newOtoOptions = {
recvWindow: 5000,
workingTimeInForce: TimeInForce.GTC,
pendingPrice: 400,
pendingTimeInForce: TimeInForce.GTC
};

client.newOto('BNBUSDT', orderListWorkingType.LIMIT, Side.BUY, 400, 1, OtoPendingType.LIMIT, Side.BUY, 1, options).then((res: RestTradeTypes.newOcoResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
22 changes: 22 additions & 0 deletions examples/restful/trade/newOtoco.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import dotenv from 'dotenv';
import { OrderListAboveBelowType, orderListWorkingType, RestTradeTypes, 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: RestTradeTypes.newOtocoOptions = {
recvWindow: 5000,
workingTimeInForce: TimeInForce.GTC,
pendingAbovePrice: 400,
pendingBelowType: OrderListAboveBelowType.LIMIT_MAKER,
pendingBelowPrice: 395
};

client.newOtoco('BNBUSDT', orderListWorkingType.LIMIT, Side.BUY, 400, 1, Side.BUY, 1, OrderListAboveBelowType.LIMIT_MAKER, options).then((res: RestTradeTypes.newOcoResponse) => {
console.log(res);
}).catch(err => { console.log(err); });
10 changes: 4 additions & 6 deletions examples/websocketAPI/trade/newOCOOrder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import dotenv from 'dotenv';
import { NewOrderRespType, Side, StopLimitTimeInForce, WebsocketAPI, WsTradeTypes } from '../../../src/index';
import { OrderListAboveBelowType, Side, WebsocketAPI, WsTradeTypes } from '../../../src/index';

dotenv.config();

Expand All @@ -8,15 +8,13 @@ const apiSecret = process.env.BINANCE_API_SECRET || '';
const wsURL = 'wss://ws-api.testnet.binance.vision:9443/ws-api/v3'; // we setup wsURL to testnet. The default value set to production site: wss://ws-api.binance.com/ws-api/v3
const options: WsTradeTypes.newOCOOrderOptions = {
listClientOrderId: 'my_list_order',
stopPrice: 330,
stopLimitPrice: 340,
stopLimitTimeInForce: StopLimitTimeInForce.GTC,
newOrderRespType: NewOrderRespType.FULL
abovePrice: 400,
belowPrice: 395
};
const callbacks = {
open: (client: WebsocketAPI) => {
console.debug('Connected to WebSocket server');
client.newOCOOrder('BNBUSDT', Side.BUY, 300, 0.1, options);
client.newOCOOrder('BNBUSDT', Side.BUY, 1, OrderListAboveBelowType.LIMIT_MAKER, OrderListAboveBelowType.LIMIT_MAKER, options);
},
close: () => console.debug('Disconnected from WebSocket server'),
message: (data: string) => {
Expand Down
Loading

0 comments on commit dcd36cc

Please sign in to comment.