fix indent

This commit is contained in:
tiagosiebler
2021-01-30 18:11:55 +00:00
parent fc78d32023
commit e092b1355a
2 changed files with 151 additions and 151 deletions

View File

@@ -22,7 +22,7 @@ export class LinearClient extends SharedEndpoints {
livenet?: boolean, livenet?: boolean,
restInverseOptions:RestClientInverseOptions = {}, // TODO: Rename this type to be more general. restInverseOptions:RestClientInverseOptions = {}, // TODO: Rename this type to be more general.
requestOptions: AxiosRequestConfig = {} requestOptions: AxiosRequestConfig = {}
) { ) {
super() super()
this.requestWrapper = new RequestWrapper( this.requestWrapper = new RequestWrapper(
key, key,
@@ -32,7 +32,7 @@ export class LinearClient extends SharedEndpoints {
requestOptions requestOptions
); );
return this; return this;
} }
//------------Market Data Endpoints------------> //------------Market Data Endpoints------------>
@@ -101,7 +101,7 @@ export class LinearClient extends SharedEndpoints {
//Active Orders //Active Orders
placeActiveOrder(orderRequest: { placeActiveOrder(params: {
side: string; side: string;
symbol: string; symbol: string;
order_type: string; order_type: string;
@@ -116,7 +116,7 @@ export class LinearClient extends SharedEndpoints {
close_on_trigger?: boolean; close_on_trigger?: boolean;
order_link_id?: string; order_link_id?: string;
}): GenericAPIResponse { }): GenericAPIResponse {
return this.requestWrapper.post('private/linear/order/create', orderRequest); return this.requestWrapper.post('private/linear/order/create', params);
} }
getActiveOrderList(params: { getActiveOrderList(params: {
@@ -237,7 +237,7 @@ export class LinearClient extends SharedEndpoints {
stop_order_id?: string; stop_order_id?: string;
order_link_id?: string; order_link_id?: string;
}): GenericAPIResponse { }): GenericAPIResponse {
return this.requestWrapper.get('private/linear/stop-order/search', params); return this.requestWrapper.get('private/linear/stop-order/search', params);
} }
//Position //Position

View File

@@ -1,121 +1,121 @@
//type Constructor = new (...args: any[]) => {};
import { GenericAPIResponse } from './util/requestUtils'; import { GenericAPIResponse } from './util/requestUtils';
import RequestWrapper from './util/requestWrapper'; import RequestWrapper from './util/requestWrapper';
export default class SharedEndpoints { 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: { getOrderBook(params: {
symbol: string; symbol: string;
}): GenericAPIResponse { }): GenericAPIResponse {
return this.requestWrapper.get('v2/public/orderBook/L2', params); return this.requestWrapper.get('v2/public/orderBook/L2', params);
} }
getTickers(params?: { getTickers(params?: {
symbol?: string; symbol?: string;
}): GenericAPIResponse { }): GenericAPIResponse {
return this.requestWrapper.get('v2/public/tickers', params); return this.requestWrapper.get('v2/public/tickers', params);
} }
getSymbols(): GenericAPIResponse { getSymbols(): GenericAPIResponse {
return this.requestWrapper.get('v2/public/symbols'); return this.requestWrapper.get('v2/public/symbols');
} }
getLiquidations(params: { getLiquidations(params: {
symbol: string; symbol: string;
from?: number; from?: number;
limit?: number; limit?: number;
start_time?: number; start_time?: number;
end_time?: number; end_time?: number;
}): GenericAPIResponse { }): GenericAPIResponse {
return this.requestWrapper.get('v2/public/liq-records', params); return this.requestWrapper.get('v2/public/liq-records', params);
} }
getOpenInterest(params: { getOpenInterest(params: {
symbol: string; symbol: string;
period: string; period: string;
limit?: number; limit?: number;
}): GenericAPIResponse { }): GenericAPIResponse {
return this.requestWrapper.get('v2/public/open-interest', params); return this.requestWrapper.get('v2/public/open-interest', params);
} }
getLatestBigDeal(params: { getLatestBigDeal(params: {
symbol: string; symbol: string;
limit?: number; limit?: number;
}): GenericAPIResponse { }): GenericAPIResponse {
return this.requestWrapper.get('v2/public/big-deal', params); return this.requestWrapper.get('v2/public/big-deal', params);
} }
getLongShortRatio(params: { getLongShortRatio(params: {
symbol: string; symbol: string;
period: string; period: string;
limit?: number; limit?: number;
}): GenericAPIResponse { }): GenericAPIResponse {
return this.requestWrapper.get('v2/public/account-ratio', params); return this.requestWrapper.get('v2/public/account-ratio', params);
} }
//------------Account Data Endpoints------------> //------------Account Data Endpoints------------>
getApiKeyInfo(): GenericAPIResponse { getApiKeyInfo(): GenericAPIResponse {
return this.requestWrapper.get('v2/private/account/api-key'); return this.requestWrapper.get('v2/private/account/api-key');
} }
//------------Wallet Data Endpoints------------> //------------Wallet Data Endpoints------------>
getWalletBalance(params: { getWalletBalance(params: {
coin?: string; coin?: string;
}): GenericAPIResponse { }): GenericAPIResponse {
return this.requestWrapper.get('v2/private/wallet/balance',params) return this.requestWrapper.get('v2/private/wallet/balance', params)
} }
getAssetExchangeRecords(params?: { getAssetExchangeRecords(params?: {
limit?: number; limit?: number;
from?: number; from?: number;
direction?: string; direction?: string;
}): GenericAPIResponse { }): GenericAPIResponse {
return this.requestWrapper.get('v2/private/exchange-order/list', params); return this.requestWrapper.get('v2/private/exchange-order/list', params);
} }
getWalletFundRecords(params?: { getWalletFundRecords(params?: {
start_date?: string; start_date?: string;
end_date?: string; end_date?: string;
currency?: string; currency?: string;
coin?: string; coin?: string;
wallet_fund_type?: string; wallet_fund_type?: string;
page?: number; page?: number;
limit?: number; limit?: number;
}): GenericAPIResponse { }): GenericAPIResponse {
return this.requestWrapper.get('v2/private/wallet/fund/records', params); return this.requestWrapper.get('v2/private/wallet/fund/records', params);
} }
getWithdrawRecords(params: { getWithdrawRecords(params: {
start_date?: string; start_date?: string;
end_date?: string; end_date?: string;
coin?: string; coin?: string;
status?: string; status?: string;
page?: number; page?: number;
limit?: number; limit?: number;
}): GenericAPIResponse { }): GenericAPIResponse {
return this.requestWrapper.get('v2/private/wallet/withdraw/list', params); return this.requestWrapper.get('v2/private/wallet/withdraw/list', params);
} }
//-------------API Data Endpoints-------------> //-------------API Data Endpoints------------->
getServerTime(): GenericAPIResponse { getServerTime(): GenericAPIResponse {
return this.requestWrapper.get('v2/public/time'); return this.requestWrapper.get('v2/public/time');
} }
getApiAnnouncements(): GenericAPIResponse { getApiAnnouncements(): GenericAPIResponse {
return this.requestWrapper.get('v2/public/announcement'); return this.requestWrapper.get('v2/public/announcement');
} }
async getTimeOffset(): Promise<number> { async getTimeOffset(): Promise < number > {
const start = Date.now(); const start = Date.now();
return this.getServerTime().then(result => { return this.getServerTime().then(result => {
const end = Date.now(); const end = Date.now();
return Math.ceil((result.time_now * 1000) - end + ((end - start) / 2)); return Math.ceil((result.time_now * 1000) - end + ((end - start) / 2));
}); });
} }
} }