fix indent
This commit is contained in:
@@ -1,121 +1,121 @@
|
||||
//type Constructor = new (...args: any[]) => {};
|
||||
import { GenericAPIResponse } from './util/requestUtils';
|
||||
import RequestWrapper from './util/requestWrapper';
|
||||
|
||||
export default class SharedEndpoints {
|
||||
protected requestWrapper: RequestWrapper; // XXX Is there a way to say that Base has to provide this?
|
||||
|
||||
//------------Market Data Endpoints------------>
|
||||
|
||||
getOrderBook(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/orderBook/L2', params);
|
||||
}
|
||||
// TODO: Is there a way to say that Base has to provide this?
|
||||
protected requestWrapper: RequestWrapper;
|
||||
|
||||
getTickers(params?: {
|
||||
symbol?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/tickers', params);
|
||||
}
|
||||
|
||||
getSymbols(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/symbols');
|
||||
}
|
||||
//------------Market Data Endpoints------------>
|
||||
|
||||
getLiquidations(params: {
|
||||
symbol: string;
|
||||
from?: number;
|
||||
limit?: number;
|
||||
start_time?: number;
|
||||
end_time?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/liq-records', params);
|
||||
}
|
||||
|
||||
getOpenInterest(params: {
|
||||
symbol: string;
|
||||
period: string;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/open-interest', params);
|
||||
}
|
||||
getOrderBook(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/orderBook/L2', params);
|
||||
}
|
||||
|
||||
getLatestBigDeal(params: {
|
||||
symbol: string;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/big-deal', params);
|
||||
}
|
||||
getTickers(params?: {
|
||||
symbol?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/tickers', params);
|
||||
}
|
||||
|
||||
getLongShortRatio(params: {
|
||||
symbol: string;
|
||||
period: string;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/account-ratio', params);
|
||||
}
|
||||
|
||||
//------------Account Data Endpoints------------>
|
||||
|
||||
getApiKeyInfo(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/private/account/api-key');
|
||||
}
|
||||
|
||||
//------------Wallet Data Endpoints------------>
|
||||
|
||||
getWalletBalance(params: {
|
||||
coin?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/private/wallet/balance',params)
|
||||
}
|
||||
getSymbols(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/symbols');
|
||||
}
|
||||
|
||||
getAssetExchangeRecords(params?: {
|
||||
limit?: number;
|
||||
from?: number;
|
||||
direction?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/private/exchange-order/list', params);
|
||||
}
|
||||
getLiquidations(params: {
|
||||
symbol: string;
|
||||
from?: number;
|
||||
limit?: number;
|
||||
start_time?: number;
|
||||
end_time?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/liq-records', params);
|
||||
}
|
||||
|
||||
getWalletFundRecords(params?: {
|
||||
start_date?: string;
|
||||
end_date?: string;
|
||||
currency?: string;
|
||||
coin?: string;
|
||||
wallet_fund_type?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/private/wallet/fund/records', params);
|
||||
}
|
||||
getOpenInterest(params: {
|
||||
symbol: string;
|
||||
period: string;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/open-interest', params);
|
||||
}
|
||||
|
||||
getWithdrawRecords(params: {
|
||||
start_date?: string;
|
||||
end_date?: string;
|
||||
coin?: string;
|
||||
status?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/private/wallet/withdraw/list', params);
|
||||
}
|
||||
|
||||
//-------------API Data Endpoints------------->
|
||||
getLatestBigDeal(params: {
|
||||
symbol: string;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/big-deal', params);
|
||||
}
|
||||
|
||||
getServerTime(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/time');
|
||||
}
|
||||
getLongShortRatio(params: {
|
||||
symbol: string;
|
||||
period: string;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/account-ratio', params);
|
||||
}
|
||||
|
||||
getApiAnnouncements(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/announcement');
|
||||
}
|
||||
//------------Account Data Endpoints------------>
|
||||
|
||||
async getTimeOffset(): Promise<number> {
|
||||
const start = Date.now();
|
||||
return this.getServerTime().then(result => {
|
||||
const end = Date.now();
|
||||
return Math.ceil((result.time_now * 1000) - end + ((end - start) / 2));
|
||||
});
|
||||
}
|
||||
}
|
||||
getApiKeyInfo(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/private/account/api-key');
|
||||
}
|
||||
|
||||
//------------Wallet Data Endpoints------------>
|
||||
|
||||
getWalletBalance(params: {
|
||||
coin?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/private/wallet/balance', params)
|
||||
}
|
||||
|
||||
getAssetExchangeRecords(params?: {
|
||||
limit?: number;
|
||||
from?: number;
|
||||
direction?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/private/exchange-order/list', params);
|
||||
}
|
||||
|
||||
getWalletFundRecords(params?: {
|
||||
start_date?: string;
|
||||
end_date?: string;
|
||||
currency?: string;
|
||||
coin?: string;
|
||||
wallet_fund_type?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/private/wallet/fund/records', params);
|
||||
}
|
||||
|
||||
getWithdrawRecords(params: {
|
||||
start_date?: string;
|
||||
end_date?: string;
|
||||
coin?: string;
|
||||
status?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/private/wallet/withdraw/list', params);
|
||||
}
|
||||
|
||||
//-------------API Data Endpoints------------->
|
||||
|
||||
getServerTime(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/time');
|
||||
}
|
||||
|
||||
getApiAnnouncements(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/announcement');
|
||||
}
|
||||
|
||||
async getTimeOffset(): Promise < number > {
|
||||
const start = Date.now();
|
||||
return this.getServerTime().then(result => {
|
||||
const end = Date.now();
|
||||
return Math.ceil((result.time_now * 1000) - end + ((end - start) / 2));
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user