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
95 changes: 95 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ declare module 'binance-api-node' {

export interface Binance {
accountInfo(): Promise<Account>;
book(options: { symbol: string, limit?: number }): Promise<OrderBook>;
exchangeInfo(): Promise<ExchangeInfo>;
order(options: NewOrder): Promise<Order>;
prices(): Promise<{ [index: string]: string }>;
time(): Promise<number>;
Expand All @@ -40,6 +42,99 @@ declare module 'binance-api-node' {
user: ( callback: (msg: OutboundAccountInfo|ExecutionReport) => void) => Function;
}

export type RateLimitType =
| 'REQUESTS'
| 'ORDERS';

export type RateLimitInterval =
| 'SECOND'
| 'MINUTE'
| 'DAY';

export interface ExchangeInfoRateLimit {
rateLimitType: RateLimitType;
interval: RateLimitInterval;
limit: number;
}

export type ExchangeFilterType =
| 'EXCHANGE_MAX_NUM_ORDERS'
| 'EXCHANGE_MAX_ALGO_ORDERS';

export interface ExchangeFilter {
filterType: ExchangeFilterType;
limit: number;
}

export type SymbolFilterType =
| 'PRICE_FILTER'
| 'LOT_SIZE'
| 'MIN_NOTIONAL'
| 'MAX_NUM_ORDERS'
| 'MAX_ALGO_ORDERS';

export interface SymbolPriceFilter {
filterType: SymbolFilterType,
minPrice: string;
maxPrice: string;
tickSize: string;
}

export interface SymbolLotSizeFilter {
filterType: SymbolFilterType,
minQty: string;
maxQty: string;
stepSize: string;
}

export interface SymbolMinNotionalFilter {
filterType: SymbolFilterType;
minNotional: string;
}

export interface SymbolMaxNumOrdersFilter {
filterType: SymbolFilterType;
limit: number;
}

export interface SymbolMaxAlgoOrdersFilter {
filterType: SymbolFilterType;
limit: number;
}

export type SymbolFilter =
| SymbolPriceFilter
| SymbolLotSizeFilter
| SymbolMinNotionalFilter
| SymbolMaxNumOrdersFilter
| SymbolMaxAlgoOrdersFilter;

interface Symbol {
symbol: string;
status: string;
baseAsset: string;
baseAssetPrecision: number;
quoteAsset: string;
quotePrecision: number;
orderTypes: OrderType[];
icebergAllowed: boolean;
filters: SymbolFilter[];
}

export interface ExchangeInfo {
timezone: string;
serverTime: number;
rateLimits: ExchangeInfoRateLimit[];
exchangeFilters: ExchangeFilter[];
symbols: Symbol[];
}

export interface OrderBook {
lastUpdateId: number;
asks: Bid[];
bids: Bid[];
}

export interface NewOrder {
icebergQty?: string;
newClientOrderId?: string;
Expand Down