Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ declare module 'binance-api-node' {
prices(): Promise<{ [index: string]: string }>;
time(): Promise<number>;
ws: WebSocket;
myTrades(options: { symbol: string, limit?: number, fromId?: number }): Promise<MyTrade[]>;
getOrder(options: { symbol: string; orderId: number }): Promise<QueryOrderResult>;
cancelOrder(options: { symbol: string; orderId: number }): Promise<CancelOrderResult>;
openOrders(options: { symbol: string }): Promise<QueryOrderResult[]>;
}

export interface WebSocket {
Expand Down Expand Up @@ -339,4 +343,41 @@ declare module 'binance-api-node' {
isOrderWorking: boolean;
isBuyerMaker: boolean;
}

interface MyTrade {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name Trade is already used for websocket trade events.

id: number;
orderId: number;
price: string;
qty: string;
commission: string;
commissionAsset: string;
time: number;
isBuyer: boolean;
isMaker: boolean;
isBestMatch: boolean;
}

interface QueryOrderResult {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can interface QueryOrderResult and interface Order be merged?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Order uses transactTime instead of time and provides some additional fields.

symbol: string;
orderId: number;
clientOrderId: string;
price: string;
origQty: string;
executedQty: string;
status: OrderStatus;
timeInForce: string;
type: string;
side: string;
stopPrice: string;
icebergQty: string;
time: number;
isWorking: boolean;
}

interface CancelOrderResult {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that a Result? To me it looks like a Request because it is created when calling cancelOrder.

The Java API also names it CancelOrderRequest:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is a Result.

symbol: string;
origClientOrderId: string;
orderId: number;
clientOrderId: string;
}
}