expand spot public tests, fix broken trades and server time endpoints
This commit is contained in:
@@ -46,8 +46,8 @@ export class SpotClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
async getServerTime(): Promise<number> {
|
||||
const result = await this.get('/spot/v1/time');
|
||||
return result.serverTime;
|
||||
const res = await this.get('/spot/v1/time');
|
||||
return res.result.serverTime;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +80,7 @@ export class SpotClient extends BaseRestClient {
|
||||
}
|
||||
|
||||
getTrades(symbol: string, limit?: number): Promise<APIResponse<any[]>> {
|
||||
return this.get('/spot/v1/trades', {
|
||||
return this.get('/spot/quote/v1/trades', {
|
||||
symbol,
|
||||
limit,
|
||||
});
|
||||
@@ -176,26 +176,4 @@ export class SpotClient extends BaseRestClient {
|
||||
getBalances() {
|
||||
return this.getPrivate('/spot/v1/account');
|
||||
}
|
||||
|
||||
/**
|
||||
* Leveraged Token Endpoints
|
||||
*/
|
||||
|
||||
getLeveragedTokenAssetInfo(
|
||||
leverageTokenCode: string,
|
||||
timestamp?: number
|
||||
): Promise<APIResponse<any>> {
|
||||
return this.get('/spot/lt/v1/info', {
|
||||
ltCode: leverageTokenCode,
|
||||
timestamp,
|
||||
});
|
||||
}
|
||||
|
||||
getLeveragedTokenMarketInfo(
|
||||
leverageTokenCode: string
|
||||
): Promise<APIResponse<any>> {
|
||||
return this.get('/spot/lt/v1/reference', {
|
||||
ltCode: leverageTokenCode,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('Public Spot REST API Endpoints', () => {
|
||||
});
|
||||
|
||||
const symbol = 'BTCUSDT';
|
||||
const interval = '15';
|
||||
const interval = '15m';
|
||||
const timestampOneHourAgo = new Date().getTime() / 1000 - 1000 * 60 * 60;
|
||||
const from = Number(timestampOneHourAgo.toFixed(0));
|
||||
|
||||
@@ -34,4 +34,48 @@ describe('Public Spot REST API Endpoints', () => {
|
||||
successResponseObject(null)
|
||||
);
|
||||
});
|
||||
|
||||
it('getMergedOrderBook()', async () => {
|
||||
expect(await api.getMergedOrderBook(symbol)).toMatchObject(
|
||||
successResponseObject(null)
|
||||
);
|
||||
});
|
||||
|
||||
it('getTrades()', async () => {
|
||||
expect(await api.getTrades(symbol)).toMatchObject(
|
||||
successResponseObject(null)
|
||||
);
|
||||
});
|
||||
|
||||
it('getCandles()', async () => {
|
||||
expect(await api.getCandles(symbol, interval)).toMatchObject(
|
||||
successResponseObject(null)
|
||||
);
|
||||
});
|
||||
|
||||
it('get24hrTicker()', async () => {
|
||||
expect(await api.get24hrTicker()).toMatchObject(
|
||||
successResponseObject(null)
|
||||
);
|
||||
});
|
||||
|
||||
it('getLastTradedPrice()', async () => {
|
||||
expect(await api.getLastTradedPrice()).toMatchObject(
|
||||
successResponseObject(null)
|
||||
);
|
||||
});
|
||||
|
||||
it('getBestBidAskPrice()', async () => {
|
||||
expect(await api.getBestBidAskPrice()).toMatchObject(
|
||||
successResponseObject(null)
|
||||
);
|
||||
});
|
||||
|
||||
it('getServerTime()', async () => {
|
||||
expect(await api.getServerTime()).toStrictEqual(expect.any(Number));
|
||||
});
|
||||
|
||||
it('fetchServertime() returns number', async () => {
|
||||
expect(await api.fetchServerTime()).toStrictEqual(expect.any(Number));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user