Merge branch 'master' into wsapi

This commit is contained in:
Tiago
2025-02-28 11:29:50 +00:00
committed by GitHub
4 changed files with 37 additions and 2 deletions

View File

@@ -19,6 +19,8 @@ export interface OrderParamsV5 {
orderType: OrderTypeV5; orderType: OrderTypeV5;
qty: string; qty: string;
marketUnit?: 'baseCoin' | 'quoteCoin'; marketUnit?: 'baseCoin' | 'quoteCoin';
slippageToleranceType?: string;
slippageTolerance?: string;
price?: string; price?: string;
triggerDirection?: 1 | 2; triggerDirection?: 1 | 2;
orderFilter?: OrderFilterV5; orderFilter?: OrderFilterV5;

View File

@@ -42,6 +42,8 @@ export interface AccountOrderV5 {
stopOrderType: StopOrderTypeV5; stopOrderType: StopOrderTypeV5;
orderIv: string; orderIv: string;
marketUnit: 'baseCoin' | 'quoteCoin'; marketUnit: 'baseCoin' | 'quoteCoin';
slippageToleranceType: string;
slippageTolerance: string;
triggerPrice: string; triggerPrice: string;
takeProfit: string; takeProfit: string;
stopLoss: string; stopLoss: string;

View File

@@ -64,6 +64,7 @@ interface SignedRequest<T> {
interface UnsignedRequest<T> { interface UnsignedRequest<T> {
originalParams: T; originalParams: T;
paramsWithSign: T; paramsWithSign: T;
serializedParams: string;
sign?: string; sign?: string;
timestamp?: number; timestamp?: number;
recvWindow?: number; recvWindow?: number;
@@ -276,7 +277,9 @@ export default abstract class BaseRestClient {
return { return {
...options, ...options,
headers, headers,
params: signResult.originalParams, url: signResult.serializedParams
? options.url + '?' + signResult.serializedParams
: options.url,
}; };
} }

View File

@@ -188,7 +188,35 @@ describe('Private READ V5 REST API Endpoints', () => {
accountType: accountType, accountType: accountType,
coin: settleCoin, coin: settleCoin,
}), }),
).toMatchObject({ ...successResponseObjectV3() }); ).toMatchObject({
...successResponseObjectV3(),
// retMsg: '',
});
});
it('getAllCoinsBalance() unified with one symbol', async () => {
const result = await api.getAllCoinsBalance({
accountType: 'UNIFIED',
coin: 'USDT',
});
if (result.retCode !== 0) {
console.error(expect.getState().currentTestName, 'exception: ', result);
}
expect(result).toMatchObject({ ...successResponseObjectV3() });
});
it('getAllCoinsBalance() unified with multiple symbols', async () => {
const result = await api.getAllCoinsBalance({
accountType: 'UNIFIED',
coin: 'USDT,ETH',
});
if (result.retCode !== 0) {
console.error(expect.getState().currentTestName, 'exception: ', result);
}
expect(result).toMatchObject({ ...successResponseObjectV3() });
}); });
it('getTransferableCoinList()', async () => { it('getTransferableCoinList()', async () => {