Skip to content

Commit

Permalink
Merge pull request #352 from tiagosiebler/convert
Browse files Browse the repository at this point in the history
v2.8.7: feat(#351) add convert endpoints
  • Loading branch information
tiagosiebler authored Jul 30, 2023
2 parents 1e9d58f + 7902f3e commit 8a45eeb
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 65 deletions.
2 changes: 1 addition & 1 deletion examples/rest-usdm-private-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const client = new USDMClient({
});
console.log(
'btcNotionalBrackets: ',
JSON.stringify(btcNotionalBrackets, null, 2)
JSON.stringify(btcNotionalBrackets, null, 2),
);
} catch (e) {
console.error('request failed: ', e);
Expand Down
64 changes: 32 additions & 32 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",
"version": "2.8.6",
"version": "2.8.7",
"description": "Node.js & JavaScript SDK for Binance REST APIs & WebSockets, with TypeScript & end-to-end tests.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
20 changes: 5 additions & 15 deletions src/main-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,33 +315,23 @@ export class MainClient extends BaseRestClient {
return this.getPrivate('sapi/v1/account/apiRestrictions');
}

acceptQuoteRequest(
params: EnableConvertSubAccountParams,
): Promise<any> {
acceptQuoteRequest(params: EnableConvertSubAccountParams): Promise<any> {
return this.postPrivate('sapi/v1/convert/acceptQuote', params);
}

enableConvertSubAccount(
params: AcceptQuoteRequestParams
): Promise<any> {
enableConvertSubAccount(params: AcceptQuoteRequestParams): Promise<any> {
return this.postPrivate('sapi/v1/broker/subAccount/convert', params);
}

convertQuoteRequest(
params: ConvertQuoteRequestParams,
): Promise<any> {
convertQuoteRequest(params: ConvertQuoteRequestParams): Promise<any> {
return this.postPrivate('sapi/v1/convert/getQuote', params);
}

getOrderStatus(
params: GetOrderStatusParams,
): Promise<any> {
getOrderStatus(params: GetOrderStatusParams): Promise<any> {
return this.getPrivate('sapi/v1/convert/orderStatus', params);
}

getConvertTradeHistory(
params: GetConvertTradeHistoryParams,
): Promise<any> {
getConvertTradeHistory(params: GetConvertTradeHistoryParams): Promise<any> {
return this.getPrivate('sapi/v1/convert/tradeFlow', params);
}

Expand Down
41 changes: 25 additions & 16 deletions src/types/spot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,32 +173,32 @@ export interface TransferBrokerSubAccountParams {
}

export interface ConvertQuoteRequestParams {
fromAsset: string;
toAsset: string;
fromAmount?: number;
toAmount?: number;
walletType?: string;
validTime?: string;
fromAsset: string;
toAsset: string;
fromAmount?: number;
toAmount?: number;
walletType?: string;
validTime?: string;
}

export interface EnableConvertSubAccountParams {
subAccountId: string;
convert: boolean;
subAccountId: string;
convert: boolean;
}

export interface AcceptQuoteRequestParams {
quoteId: string;
quoteId: string;
}

export interface GetOrderStatusParams {
orderId?: string;
quoteId?: string;
orderId?: string;
quoteId?: string;
}

export interface GetConvertTradeHistoryParams {
startTime: number;
endTime?: number;
limit?: string
startTime: number;
endTime?: number;
limit?: string;
}

export interface TransferBrokerSubAccount {
Expand Down Expand Up @@ -492,8 +492,17 @@ export interface SymbolExchangeInfo {
isMarginTradingAllowed: boolean;
filters: SymbolFilter[];
permissions: ('SPOT' | 'MARGIN')[];
defaultSelfTradePreventionMode: 'NONE' | 'EXPIRE_TAKER' | 'EXPIRE_BOTH' | 'EXPIRE_MAKER'
allowedSelfTradePreventionModes: ('NONE' | 'EXPIRE_TAKER' | 'EXPIRE_BOTH' | 'EXPIRE_MAKER')[];
defaultSelfTradePreventionMode:
| 'NONE'
| 'EXPIRE_TAKER'
| 'EXPIRE_BOTH'
| 'EXPIRE_MAKER';
allowedSelfTradePreventionModes: (
| 'NONE'
| 'EXPIRE_TAKER'
| 'EXPIRE_BOTH'
| 'EXPIRE_MAKER'
)[];
}

export interface ExchangeInfo {
Expand Down

0 comments on commit 8a45eeb

Please sign in to comment.