Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Spot Test Network #409

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion src/main-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,11 @@ export class MainClient extends BaseRestClient {
constructor(
restClientOptions: RestClientOptions = {},
requestOptions: AxiosRequestConfig = {},
useTestnet?: boolean,
) {
super('spot1', restClientOptions, requestOptions);
const clientId = useTestnet ? 'spottest' : 'spot1';

super(clientId, restClientOptions, requestOptions);
return this;
}

Expand Down
7 changes: 5 additions & 2 deletions src/types/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type BooleanStringCapitalised = 'TRUE' | 'FALSE';

export type BinanceBaseUrlKey =
| 'spot'
| 'spottest'
| 'spot1'
| 'spot2'
| 'spot3'
Expand Down Expand Up @@ -280,9 +281,11 @@ export interface SymbolLotSizeFilter {
}

export interface SymbolMinNotionalFilter {
filterType: 'MIN_NOTIONAL';
filterType: 'NOTIONAL';
Copy link
Owner

Choose a reason for hiding this comment

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

This is a breaking change, MIN_NOTIONAL is definitely there for futures:
https://binance-docs.github.io/apidocs/futures/en/#filters

and for spot as well:
https://binance-docs.github.io/apidocs/spot/en/#filters

Seems I don't have an interface yet for filterType: 'NOTIONAL', I'd welcome a change to add it, but it should not be at the cost of removing the existing SymbolMinNotionalFilter interface. You can make a new one such as SymbolNotionalFilter, but please revert this breaking change.

minNotional: numberInString;
applyToMarket: boolean;
maxNotional: numberInString;
applyMinToMarket: boolean;
applyMaxToMarket: boolean;
avgPriceMins: number;
}

Expand Down
1 change: 1 addition & 0 deletions src/types/websockets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {

export type WsMarket =
| 'spot'
| 'spotTestnet'
| 'margin'
| 'isolatedMargin'
| 'usdm'
Expand Down
3 changes: 3 additions & 0 deletions src/util/requestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export type GenericAPIResponse<T = any> = Promise<T>;
export function getOrderIdPrefix(network: BinanceBaseUrlKey): string {
switch (network) {
case 'spot':
case 'spottest':
case 'spot1':
case 'spot2':
case 'spot3':
Expand Down Expand Up @@ -156,6 +157,7 @@ export async function getRequestSignature(
const BINANCE_BASE_URLS: Record<BinanceBaseUrlKey, string> = {
// spot/margin/savings/mining
spot: 'https://api.binance.com',
spottest: 'https://testnet.binance.vision',
spot1: 'https://api.binance.com',
spot2: 'https://api1.binance.com',
spot3: 'https://api2.binance.com',
Expand All @@ -177,6 +179,7 @@ const BINANCE_BASE_URLS: Record<BinanceBaseUrlKey, string> = {
export function getServerTimeEndpoint(urlKey: BinanceBaseUrlKey): string {
switch (urlKey) {
case 'spot':
case 'spottest':
case 'spot1':
case 'spot2':
case 'spot3':
Expand Down
Loading