Skip to content

Commit

Permalink
Release v0.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
alplabin committed Jan 10, 2024
1 parent 1d3844e commit a273269
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 49 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## 0.3.4 - 2023-11-20
## 0.3.5 - 2024-01-10
- Add new Enums
- Update Websocket types

## 0.3.4 - 2023-11-17

- Upgrade dependencies
- Fix sentences grammar
Expand Down
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/connector-typescript",
"version": "0.3.4",
"version": "0.3.5",
"description": "This is a lightweight library that works as a connector to the Binance public API.",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
21 changes: 11 additions & 10 deletions src/modules/websocket/websocketAPI/account/types.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
import { SelfTradePreventionMode } from '../../../enum';
import { RestTradeTypes } from '../../../../index';
import { sendMessageOptions } from '../../../../setters/types';

export interface accountOptions {
export interface accountOptions extends sendMessageOptions {
recvWindow?: number;
}

export interface orderLimitOptions {
export interface orderLimitOptions extends sendMessageOptions {
recvWindow: number;
}

export interface orderHistoryOptions {
export interface orderHistoryOptions extends sendMessageOptions {
orderId?: number;
startTime?: number;
endTime?: number;
limit?: number;
recvWindow?: number;
}

export interface ocoOrderHistoryOptions {
export interface ocoOrderHistoryOptions extends sendMessageOptions {
fromId?: number;
startTime?: number;
endTime?: number;
limit?: number;
recvWindow?: number;
}

export interface myTradesOptions {
export interface myTradesOptions extends sendMessageOptions {
orderId?: number;
startTime?: number;
endTime?: number;
Expand All @@ -34,15 +35,15 @@ export interface myTradesOptions {
recvWindow?: number;
}

export interface preventedMatchesOptions {
export interface preventedMatchesOptions extends sendMessageOptions {
preventedMatchId?: number;
orderId?: number;
fromPreventedMatchId?: number;
limit?: number;
recvWindow?: number;
}

export interface accountAllocationOptions {
export interface accountAllocationOptions extends sendMessageOptions {
startTime?: number;
endTime?: number;
fromAllocationId?: number;
Expand All @@ -51,7 +52,7 @@ export interface accountAllocationOptions {
recvWindow?: number;
}

export interface accountAllocationResponse {
export interface accountAllocationResponse extends sendMessageOptions {
symbol: string,
allocationId: number,
allocationType: string,
Expand All @@ -68,12 +69,12 @@ export interface accountAllocationResponse {
isAllocator: boolean
}

export interface orderHistoryResponse extends RestTradeTypes.getOrderResponse {
export interface orderHistoryResponse extends RestTradeTypes.getOrderResponse, sendMessageOptions {
preventedMatchId: number,
preventedQuantity: string
}

export interface preventedMatchesResponse {
export interface preventedMatchesResponse extends sendMessageOptions {
symbol: string,
preventedMatchId: number,
takerOrderId: number,
Expand Down
25 changes: 13 additions & 12 deletions src/modules/websocket/websocketAPI/market/types.ts
Original file line number Diff line number Diff line change
@@ -1,70 +1,71 @@
import { sendMessageOptions } from '../../../../setters/types';
import { ticker24hrResponse } from '../../../restful/market/types';

export interface pingOptions {
id?: number;
}

export interface exchangeInfoOptions {
export interface exchangeInfoOptions extends sendMessageOptions {
symbol?: string;
symbols?: string[];
permissions?: string[];
}

export interface orderbookOptions {
export interface orderbookOptions extends sendMessageOptions {
limit?: number;
}

export interface tradesOptions {
export interface tradesOptions extends sendMessageOptions {
limit?: number;
}

export interface historicalTradesOptions {
export interface historicalTradesOptions extends sendMessageOptions {
limit?: number;
fromId?: number;
}

export interface aggTradesOptions {
export interface aggTradesOptions extends sendMessageOptions {
limit?: number;
fromId?: number;
startTime?: number;
endTime?: number;
}

export interface klinesOptions {
export interface klinesOptions extends sendMessageOptions {
startTime?: number;
endTime?: number;
limit?: number;
}

export interface uiKlinesOptions {
export interface uiKlinesOptions extends sendMessageOptions {
startTime?: number;
endTime?: number;
limit?: number;
}

export interface ticker24hrOptions {
export interface ticker24hrOptions extends sendMessageOptions {
symbol?: string;
symbols?: string[];
type?: string;
}

export interface tickerOptions {
export interface tickerOptions extends sendMessageOptions {
symbol?: string;
symbols?: string[];
type?: string;
}

export interface tickerPriceOptions {
export interface tickerPriceOptions extends sendMessageOptions {
symbol?: string;
symbols?: string[];
}

export interface tickerBookOptions {
export interface tickerBookOptions extends sendMessageOptions {
symbol?: string;
symbols?: string[];
}

export interface Ticket24hr extends ticker24hrResponse {
export interface Ticket24hr extends ticker24hrResponse, sendMessageOptions {
weightedAvgPrice: string;
lastQty: string;
}
45 changes: 23 additions & 22 deletions src/modules/websocket/websocketAPI/trade/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { sendMessageOptions } from '../../../../setters/types';
import { CancelRestrictions, NewOrderRespType, SelfTradePreventionMode, StopLimitTimeInForce, TimeInForce } from '../../../enum';
import {
cancelOcoResponse,
Expand All @@ -9,7 +10,7 @@ import {
newOcoOrderReports
} from '../../../restful/trade/types';

export interface newOrderOptions {
export interface newOrderOptions extends sendMessageOptions {
timeInForce?: TimeInForce | '';
price?: number;
quantity?: number;
Expand All @@ -25,7 +26,7 @@ export interface newOrderOptions {
recvWindow?: number;
}

export interface testNewOrderOptions {
export interface testNewOrderOptions extends sendMessageOptions{
timeInForce?: TimeInForce | '';
price?: number;
quantity?: number;
Expand All @@ -41,19 +42,19 @@ export interface testNewOrderOptions {
recvWindow?: number;
}

export interface getOrderOptions {
export interface getOrderOptions extends sendMessageOptions {
origClientOrderId?: string;
recvWindow?: number;
}

export interface cancelOrderOptions {
export interface cancelOrderOptions extends sendMessageOptions {
origClientOrderId?: string;
newClientOrderId?: string;
cancelRestrictions?: CancelRestrictions;
recvWindow?: number;
}

export interface cancelReplaceOrderOptions {
export interface cancelReplaceOrderOptions extends sendMessageOptions {
cancelOrigClientOrderId?: string;
cancelNewClientOrderId?: string;
timeInForce?: TimeInForce | '';
Expand All @@ -72,16 +73,16 @@ export interface cancelReplaceOrderOptions {
recvWindow?: number;
}

export interface openOrdersOptions {
export interface openOrdersOptions extends sendMessageOptions {
symbol?: string;
recvWindow?: number;
}

export interface cancelOpenOrdersOptions {
export interface cancelOpenOrdersOptions extends sendMessageOptions {
recvWindow?: number;
}

export interface newOCOOrderOptions {
export interface newOCOOrderOptions extends sendMessageOptions {
listClientOrderId?: string;
limitClientOrderId?: string;
limitIcebergQty?: number;
Expand All @@ -100,22 +101,22 @@ export interface newOCOOrderOptions {
recvWindow?: number;
}

export interface getOCOOrderOptions {
export interface getOCOOrderOptions extends sendMessageOptions {
orderListId?: number;
recvWindow?: number;
}

export interface cancelOCOOrderOptions {
export interface cancelOCOOrderOptions extends sendMessageOptions {
listClientOrderId?: string;
newClientOrderId?: string;
recvWindow?: number;
}

export interface getOCOOpenOrdersOptions {
export interface getOCOOpenOrdersOptions extends sendMessageOptions {
recvWindow?: number;
}

export interface newOrderSOROptions {
export interface newOrderSOROptions extends sendMessageOptions {
timeInForce?: TimeInForce | '';
price?: number;
newClientOrderId?: string;
Expand All @@ -127,49 +128,49 @@ export interface newOrderSOROptions {
recvWindow?: number;
}

export interface cancelOCOOrder extends Omit<cancelOcoResponse, 'orderReports'> {
export interface cancelOCOOrder extends Omit<cancelOcoResponse, 'orderReports'>, sendMessageOptions {
orderReports: cancelOcoOrder[];
}

interface cancelOcoOrder extends Omit<cancelOcoOrderReports, 'origClientOrderId' | 'stopPrice'> {
interface cancelOcoOrder extends Omit<cancelOcoOrderReports, 'origClientOrderId' | 'stopPrice'>, sendMessageOptions {
transactTime?: number;
stopPrice?: string;
}

export interface cancelOpenOrder extends cancelOrderResponse {
export interface cancelOpenOrder extends cancelOrderResponse, sendMessageOptions {
transactTime: number;
stopPrice: string;
icebergQty: string;
strategyId: number;
strategyType: number;
}

export interface cancelOpenOCOOrder extends Omit<cancelOcoResponse, 'orderReports'> {
export interface cancelOpenOCOOrder extends Omit<cancelOcoResponse, 'orderReports'>, sendMessageOptions {
orderReports: orderReport[];
}

interface orderReport extends Omit<cancelOcoOrderReports, 'stopPrice'> {
interface orderReport extends Omit<cancelOcoOrderReports, 'stopPrice'>, sendMessageOptions {
transactTime?: number;
stopPrice?: string;
}

export interface cancelOrder extends cancelOrderResponse {
export interface cancelOrder extends cancelOrderResponse, sendMessageOptions {
transactTime: number;
}

export interface CancelReplaceOrder extends Omit<cancelAnExistingOrderAndSendANewOrderResponse, 'cancelResponse'> {
export interface CancelReplaceOrder extends Omit<cancelAnExistingOrderAndSendANewOrderResponse, 'cancelResponse'>, sendMessageOptions {
cancelResponse: cancelResponse;
}

interface cancelResponse extends cancelAnExistingOrderAndSendANewOrderCancelresponse {
interface cancelResponse extends cancelAnExistingOrderAndSendANewOrderCancelresponse, sendMessageOptions {
transactTime: number;
}

export interface newOCOOrder extends Omit<newOcoResponse, 'orderReports'> {
export interface newOCOOrder extends Omit<newOcoResponse, 'orderReports'>, sendMessageOptions {
orderReports: orderReports[];
}

interface orderReports extends Omit<newOcoOrderReports, 'stopPrice'> {
interface orderReports extends Omit<newOcoOrderReports, 'stopPrice'>, sendMessageOptions {
workingTime: number;
stopPrice?: string;
}
2 changes: 1 addition & 1 deletion src/websocketAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class WebsocketAPI extends WebsocketFeaturesBase {
console.error('Not connected');
return;
}
const id = options.id || randomString();
const id = options.id && /^[0-9a-f]{32}$/.test(options.id) ? options.id : randomString();
delete options.id;
const payload = {
id,
Expand Down

0 comments on commit a273269

Please sign in to comment.