fix indent
This commit is contained in:
@@ -22,7 +22,7 @@ export class LinearClient extends SharedEndpoints {
|
||||
livenet?: boolean,
|
||||
restInverseOptions:RestClientInverseOptions = {}, // TODO: Rename this type to be more general.
|
||||
requestOptions: AxiosRequestConfig = {}
|
||||
) {
|
||||
) {
|
||||
super()
|
||||
this.requestWrapper = new RequestWrapper(
|
||||
key,
|
||||
@@ -32,7 +32,7 @@ export class LinearClient extends SharedEndpoints {
|
||||
requestOptions
|
||||
);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
//------------Market Data Endpoints------------>
|
||||
|
||||
@@ -101,7 +101,7 @@ export class LinearClient extends SharedEndpoints {
|
||||
|
||||
//Active Orders
|
||||
|
||||
placeActiveOrder(orderRequest: {
|
||||
placeActiveOrder(params: {
|
||||
side: string;
|
||||
symbol: string;
|
||||
order_type: string;
|
||||
@@ -116,7 +116,7 @@ export class LinearClient extends SharedEndpoints {
|
||||
close_on_trigger?: boolean;
|
||||
order_link_id?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/order/create', orderRequest);
|
||||
return this.requestWrapper.post('private/linear/order/create', params);
|
||||
}
|
||||
|
||||
getActiveOrderList(params: {
|
||||
@@ -237,7 +237,7 @@ export class LinearClient extends SharedEndpoints {
|
||||
stop_order_id?: string;
|
||||
order_link_id?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/stop-order/search', params);
|
||||
return this.requestWrapper.get('private/linear/stop-order/search', params);
|
||||
}
|
||||
|
||||
//Position
|
||||
|
||||
@@ -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?
|
||||
// TODO: Is there a way to say that Base has to provide this?
|
||||
protected requestWrapper: RequestWrapper;
|
||||
|
||||
//------------Market Data Endpoints------------>
|
||||
//------------Market Data Endpoints------------>
|
||||
|
||||
getOrderBook(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/orderBook/L2', params);
|
||||
}
|
||||
getOrderBook(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/orderBook/L2', params);
|
||||
}
|
||||
|
||||
getTickers(params?: {
|
||||
symbol?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/tickers', params);
|
||||
}
|
||||
getTickers(params?: {
|
||||
symbol?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/tickers', params);
|
||||
}
|
||||
|
||||
getSymbols(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/symbols');
|
||||
}
|
||||
getSymbols(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/symbols');
|
||||
}
|
||||
|
||||
getLiquidations(params: {
|
||||
symbol: string;
|
||||
from?: number;
|
||||
limit?: number;
|
||||
start_time?: number;
|
||||
end_time?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/liq-records', 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);
|
||||
}
|
||||
|
||||
getOpenInterest(params: {
|
||||
symbol: string;
|
||||
period: string;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/open-interest', params);
|
||||
}
|
||||
getOpenInterest(params: {
|
||||
symbol: string;
|
||||
period: string;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/open-interest', params);
|
||||
}
|
||||
|
||||
getLatestBigDeal(params: {
|
||||
symbol: string;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/big-deal', params);
|
||||
}
|
||||
getLatestBigDeal(params: {
|
||||
symbol: string;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/big-deal', params);
|
||||
}
|
||||
|
||||
getLongShortRatio(params: {
|
||||
symbol: string;
|
||||
period: string;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/account-ratio', params);
|
||||
}
|
||||
getLongShortRatio(params: {
|
||||
symbol: string;
|
||||
period: string;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/account-ratio', params);
|
||||
}
|
||||
|
||||
//------------Account Data Endpoints------------>
|
||||
//------------Account Data Endpoints------------>
|
||||
|
||||
getApiKeyInfo(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/private/account/api-key');
|
||||
}
|
||||
getApiKeyInfo(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/private/account/api-key');
|
||||
}
|
||||
|
||||
//------------Wallet Data Endpoints------------>
|
||||
//------------Wallet Data Endpoints------------>
|
||||
|
||||
getWalletBalance(params: {
|
||||
coin?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/private/wallet/balance',params)
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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------------->
|
||||
//-------------API Data Endpoints------------->
|
||||
|
||||
getServerTime(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/time');
|
||||
}
|
||||
getServerTime(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/time');
|
||||
}
|
||||
|
||||
getApiAnnouncements(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('v2/public/announcement');
|
||||
}
|
||||
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));
|
||||
});
|
||||
}
|
||||
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