Merge branch 'master' of github.com:peepopoggers/bybit-api into masterp
This commit is contained in:
@@ -33,7 +33,11 @@ export class InverseClient extends SharedEndpoints {
|
||||
return this;
|
||||
}
|
||||
|
||||
//------------Market Data Endpoints------------>
|
||||
/**
|
||||
*
|
||||
* Market Data Endpoints
|
||||
*
|
||||
*/
|
||||
|
||||
getKline(params: {
|
||||
symbol: string;
|
||||
@@ -112,7 +116,15 @@ export class InverseClient extends SharedEndpoints {
|
||||
return this.requestWrapper.get('v2/public/premium-index-kline', params);
|
||||
}
|
||||
|
||||
//-----------Account Data Endpoints------------>
|
||||
/**
|
||||
*
|
||||
* Account Data Endpoints
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Active orders
|
||||
*/
|
||||
|
||||
placeActiveOrder(orderRequest: {
|
||||
side: string;
|
||||
@@ -172,6 +184,10 @@ export class InverseClient extends SharedEndpoints {
|
||||
return this.requestWrapper.get('v2/private/order', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Conditional orders
|
||||
*/
|
||||
|
||||
placeConditionalOrder(params: {
|
||||
side: string;
|
||||
symbol: string;
|
||||
@@ -231,6 +247,10 @@ export class InverseClient extends SharedEndpoints {
|
||||
return this.requestWrapper.get('v2/private/stop-order', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Position
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated use getPosition() instead
|
||||
*/
|
||||
@@ -305,6 +325,10 @@ export class InverseClient extends SharedEndpoints {
|
||||
return this.requestWrapper.get('v2/private/trade/closed-pnl/list', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Risk Limit
|
||||
*/
|
||||
|
||||
getRiskLimitList(): GenericAPIResponse {
|
||||
return this.requestWrapper.get('open-api/wallet/risk-limit/list');
|
||||
}
|
||||
@@ -316,6 +340,10 @@ export class InverseClient extends SharedEndpoints {
|
||||
return this.requestWrapper.post('open-api/wallet/risk-limit', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Funding
|
||||
*/
|
||||
|
||||
getLastFundingRate(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
@@ -334,6 +362,10 @@ export class InverseClient extends SharedEndpoints {
|
||||
return this.requestWrapper.get('v2/private/funding/predicted-funding', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* LCP Info
|
||||
*/
|
||||
|
||||
getLcpInfo(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
|
||||
@@ -4,9 +4,9 @@ import RequestWrapper from './util/requestWrapper';
|
||||
import SharedEndpoints from './shared-endpoints';
|
||||
|
||||
export class LinearClient extends SharedEndpoints {
|
||||
protected requestWrapper: RequestWrapper;
|
||||
protected requestWrapper: RequestWrapper;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @public Creates an instance of the inverse REST API client.
|
||||
*
|
||||
* @param {string} key - your API key
|
||||
@@ -16,334 +16,352 @@ export class LinearClient extends SharedEndpoints {
|
||||
* @param {AxiosRequestConfig} [requestOptions={}] HTTP networking options for axios
|
||||
*/
|
||||
|
||||
constructor(
|
||||
key?: string | undefined,
|
||||
secret?: string | undefined,
|
||||
livenet?: boolean,
|
||||
restInverseOptions:RestClientInverseOptions = {}, // TODO: Rename this type to be more general.
|
||||
requestOptions: AxiosRequestConfig = {}
|
||||
) {
|
||||
super()
|
||||
this.requestWrapper = new RequestWrapper(
|
||||
key,
|
||||
secret,
|
||||
getBaseRESTInverseUrl(livenet),
|
||||
restInverseOptions,
|
||||
requestOptions
|
||||
);
|
||||
return this;
|
||||
}
|
||||
constructor(
|
||||
key?: string | undefined,
|
||||
secret?: string | undefined,
|
||||
livenet?: boolean,
|
||||
restInverseOptions:RestClientInverseOptions = {}, // TODO: Rename this type to be more general.
|
||||
requestOptions: AxiosRequestConfig = {}
|
||||
) {
|
||||
super()
|
||||
this.requestWrapper = new RequestWrapper(
|
||||
key,
|
||||
secret,
|
||||
getBaseRESTInverseUrl(livenet),
|
||||
restInverseOptions,
|
||||
requestOptions
|
||||
);
|
||||
return this;
|
||||
}
|
||||
|
||||
//------------Market Data Endpoints------------>
|
||||
/**
|
||||
*
|
||||
* Market Data Endpoints
|
||||
*
|
||||
*/
|
||||
|
||||
getKline(params: {
|
||||
symbol: string;
|
||||
interval: string;
|
||||
from: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('/public/linear/kline', params);
|
||||
}
|
||||
getKline(params: {
|
||||
symbol: string;
|
||||
interval: string;
|
||||
from: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('/public/linear/kline', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use getTrades() instead
|
||||
*/
|
||||
getPublicTradingRecords(params: {
|
||||
symbol: string;
|
||||
from?: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.getTrades(params);
|
||||
}
|
||||
|
||||
getTrades(params: {
|
||||
symbol: string;
|
||||
//from?: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('public/linear/recent-trading-records', params);
|
||||
}
|
||||
|
||||
getLastFundingRate(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('public/linear/funding/prev-funding-rate', params);
|
||||
}
|
||||
|
||||
getMarkPriceKline(params: {
|
||||
symbol: string;
|
||||
interval: string;
|
||||
from: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('public/linear/mark-price-kline', params);
|
||||
}
|
||||
|
||||
getIndexPriceKline(params: {
|
||||
symbol: string;
|
||||
interval: string;
|
||||
from: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('public/linear/index-price-kline', params);
|
||||
}
|
||||
|
||||
getPremiumIndexKline(params: {
|
||||
symbol: string;
|
||||
interval: string;
|
||||
from: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('public/linear/premium-index-kline', params);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Account Data Endpoints
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated use getTrades() instead
|
||||
*/
|
||||
getPublicTradingRecords(params: {
|
||||
symbol: string;
|
||||
from?: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.getTrades(params);
|
||||
}
|
||||
* Active orders
|
||||
*/
|
||||
|
||||
getTrades(params: {
|
||||
symbol: string;
|
||||
//from?: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('public/linear/recent-trading-records', params);
|
||||
}
|
||||
placeActiveOrder(params: {
|
||||
side: string;
|
||||
symbol: string;
|
||||
order_type: string;
|
||||
qty: number;
|
||||
price?: number;
|
||||
time_in_force: string;
|
||||
take_profit?: number;
|
||||
stop_loss?: number;
|
||||
tp_trigger_by?: string;
|
||||
sl_trigger_by?: string;
|
||||
reduce_only?: boolean;
|
||||
close_on_trigger?: boolean;
|
||||
order_link_id?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/order/create', params);
|
||||
}
|
||||
|
||||
getLastFundingRate(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('public/linear/funding/prev-funding-rate', params);
|
||||
}
|
||||
getActiveOrderList(params: {
|
||||
order_id?: string;
|
||||
order_link_id?: string;
|
||||
symbol: string;
|
||||
order?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
order_status?: string;
|
||||
|
||||
getMarkPriceKline(params: {
|
||||
symbol: string;
|
||||
interval: string;
|
||||
from: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('public/linear/mark-price-kline', params);
|
||||
}
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/order/list', params);
|
||||
}
|
||||
|
||||
getIndexPriceKline(params: {
|
||||
symbol: string;
|
||||
interval: string;
|
||||
from: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('public/linear/index-price-kline', params);
|
||||
}
|
||||
cancelActiveOrder(params: {
|
||||
symbol: string;
|
||||
order_id?: string;
|
||||
order_link_id?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/order/cancel', params);
|
||||
}
|
||||
|
||||
getPremiumIndexKline(params: {
|
||||
symbol: string;
|
||||
interval: string;
|
||||
from: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('public/linear/premium-index-kline', params);
|
||||
}
|
||||
cancelAllActiveOrders(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/order/cancel-all', params);
|
||||
}
|
||||
|
||||
//------------Account Data Endpoints------------>
|
||||
replaceActiveOrder(params: {
|
||||
order_id?: string;
|
||||
order_link_id?: string;
|
||||
symbol: string;
|
||||
p_r_qty?: number;
|
||||
p_r_price?: number;
|
||||
take_profit?: number;
|
||||
stop_loss?: number;
|
||||
tp_trigger_by?: string;
|
||||
sl_trigger_by?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/order/replace', params);
|
||||
}
|
||||
|
||||
//Active Orders
|
||||
queryActiveOrder(params: {
|
||||
order_id?: string;
|
||||
order_link_id?: string;
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/order/search', params);
|
||||
}
|
||||
|
||||
placeActiveOrder(params: {
|
||||
side: string;
|
||||
symbol: string;
|
||||
order_type: string;
|
||||
qty: number;
|
||||
price?: number;
|
||||
time_in_force: string;
|
||||
take_profit?: number;
|
||||
stop_loss?: number;
|
||||
tp_trigger_by?: string;
|
||||
sl_trigger_by?: string;
|
||||
reduce_only?: boolean;
|
||||
close_on_trigger?: boolean;
|
||||
order_link_id?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/order/create', params);
|
||||
}
|
||||
/**
|
||||
* Conditional orders
|
||||
*/
|
||||
|
||||
getActiveOrderList(params: {
|
||||
order_id?: string;
|
||||
order_link_id?: string;
|
||||
symbol: string;
|
||||
order?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
order_status?: string;
|
||||
placeConditionalOrder(params: {
|
||||
side: string;
|
||||
symbol: string;
|
||||
order_type: string;
|
||||
qty: number;
|
||||
price?: number;
|
||||
base_price: number;
|
||||
stop_px: number;
|
||||
time_in_force: string;
|
||||
trigger_by?: string;
|
||||
close_on_trigger?: boolean;
|
||||
order_link_id?: string;
|
||||
reduce_only: boolean;
|
||||
take_profit?: number;
|
||||
stop_loss?: number;
|
||||
tp_trigger_by?: string;
|
||||
sl_trigger_by?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/stop-order/create', params);
|
||||
}
|
||||
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/order/list', params);
|
||||
}
|
||||
getConditionalOrder(params: {
|
||||
stop_order_id?: string;
|
||||
order_link_id?: string;
|
||||
symbol: string;
|
||||
stop_order_status?: string;
|
||||
order?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/stop-order/list', params);
|
||||
}
|
||||
|
||||
cancelActiveOrder(params: {
|
||||
symbol: string;
|
||||
order_id?: string;
|
||||
order_link_id?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/order/cancel', params);
|
||||
}
|
||||
cancelConditionalOrder(params: {
|
||||
symbol: string;
|
||||
stop_order_id?: string;
|
||||
order_link_id?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/stop-order/cancel', params);
|
||||
}
|
||||
|
||||
cancelAllActiveOrders(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/order/cancel-all', params);
|
||||
}
|
||||
cancelAllConditionalOrders(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/stop-order/cancel-all', params);
|
||||
}
|
||||
|
||||
replaceActiveOrder(params: {
|
||||
order_id?: string;
|
||||
order_link_id?: string;
|
||||
symbol: string;
|
||||
p_r_qty?: number;
|
||||
p_r_price?: number;
|
||||
take_profit?: number;
|
||||
stop_loss?: number;
|
||||
tp_trigger_by?: string;
|
||||
sl_trigger_by?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/order/replace', params);
|
||||
}
|
||||
replaceConditionalOrder(params: {
|
||||
stop_order_id?: string;
|
||||
order_link_id?: string;
|
||||
symbol: string;
|
||||
p_r_qty?: number;
|
||||
p_r_price?: number;
|
||||
p_r_trigger_price?: number;
|
||||
take_profit?: number;
|
||||
stop_loss?: number;
|
||||
tp_trigger_by?: string;
|
||||
sl_trigger_by?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/stop-order/replace', params);
|
||||
}
|
||||
|
||||
queryActiveOrder(params: {
|
||||
order_id?: string;
|
||||
order_link_id?: string;
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/order/search', params);
|
||||
}
|
||||
queryConditionalOrder(params: {
|
||||
symbol: string;
|
||||
stop_order_id?: string;
|
||||
order_link_id?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/stop-order/search', params);
|
||||
}
|
||||
|
||||
//Conditional Orders
|
||||
/**
|
||||
* Position
|
||||
*/
|
||||
|
||||
placeConditionalOrder(params: {
|
||||
side: string;
|
||||
symbol: string;
|
||||
order_type: string;
|
||||
qty: number;
|
||||
price?: number;
|
||||
base_price: number;
|
||||
stop_px: number;
|
||||
time_in_force: string;
|
||||
trigger_by?: string;
|
||||
close_on_trigger?: boolean;
|
||||
order_link_id?: string;
|
||||
reduce_only: boolean;
|
||||
take_profit?: number;
|
||||
stop_loss?: number;
|
||||
tp_trigger_by?: string;
|
||||
sl_trigger_by?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/stop-order/create', params);
|
||||
}
|
||||
getPosition(params?: {
|
||||
symbol?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/position/list', params);
|
||||
}
|
||||
|
||||
getConditionalOrder(params: {
|
||||
stop_order_id?: string;
|
||||
order_link_id?: string;
|
||||
symbol: string;
|
||||
stop_order_status?: string;
|
||||
order?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/stop-order/list', params);
|
||||
}
|
||||
setAutoAddMargin(params?: {
|
||||
symbol: string;
|
||||
side: string;
|
||||
auto_add_margin: boolean;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/position/set-auto-add-margin', params);
|
||||
}
|
||||
|
||||
cancelConditionalOrder(params: {
|
||||
symbol: string;
|
||||
stop_order_id?: string;
|
||||
order_link_id?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/stop-order/cancel', params);
|
||||
}
|
||||
setMarginSwitch(params?: {
|
||||
symbol: string;
|
||||
is_isolated: boolean;
|
||||
buy_leverage: number;
|
||||
sell_leverage: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/position/switch-isolated', params);
|
||||
}
|
||||
|
||||
cancelAllConditionalOrders(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/stop-order/cancel-all', params);
|
||||
}
|
||||
setSwitchMode(params?: {
|
||||
symbol: string;
|
||||
tp_sl_mode: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/tpsl/switch-mode', params);
|
||||
}
|
||||
|
||||
replaceConditionalOrder(params: {
|
||||
stop_order_id?: string;
|
||||
order_link_id?: string;
|
||||
symbol: string;
|
||||
p_r_qty?: number;
|
||||
p_r_price?: number;
|
||||
p_r_trigger_price?: number;
|
||||
take_profit?: number;
|
||||
stop_loss?: number;
|
||||
tp_trigger_by?: string;
|
||||
sl_trigger_by?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/stop-order/replace', params);
|
||||
}
|
||||
setAddReduceMargin(params?: {
|
||||
symbol: string;
|
||||
side: string;
|
||||
margin: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/position/add-margin', params);
|
||||
}
|
||||
|
||||
queryConditionalOrder(params: {
|
||||
symbol: string;
|
||||
stop_order_id?: string;
|
||||
order_link_id?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/stop-order/search', params);
|
||||
}
|
||||
setUserLeverage(params: {
|
||||
symbol: string;
|
||||
buy_leverage: number;
|
||||
sell_leverage: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/position/set-leverage', params);
|
||||
}
|
||||
|
||||
//Position
|
||||
setTradingStop(params: {
|
||||
symbol: string;
|
||||
side: string;
|
||||
take_profit?: number;
|
||||
stop_loss?: number;
|
||||
trailing_stop?: number;
|
||||
tp_trigger_by?: string;
|
||||
sl_trigger_by?: string;
|
||||
sl_size?: number;
|
||||
tp_size?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/position/trading-stop', params);
|
||||
}
|
||||
|
||||
getPosition(params?: {
|
||||
symbol?: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/position/list', params);
|
||||
}
|
||||
getTradeRecords(params: {
|
||||
symbol: string;
|
||||
start_time?: number;
|
||||
end_time?: number;
|
||||
exec_type?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/trade/execution/list', params);
|
||||
}
|
||||
|
||||
setAutoAddMargin(params?: {
|
||||
symbol: string;
|
||||
side: string;
|
||||
auto_add_margin: boolean;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/position/set-auto-add-margin', params);
|
||||
}
|
||||
getClosedPnl(params: {
|
||||
symbol: string;
|
||||
start_time?: number;
|
||||
end_time?: number;
|
||||
exec_type?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/tpsl/switch-mode', params);
|
||||
}
|
||||
|
||||
setMarginSwitch(params?: {
|
||||
symbol: string;
|
||||
is_isolated: boolean;
|
||||
buy_leverage: number;
|
||||
sell_leverage: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/position/switch-isolated', params);
|
||||
}
|
||||
/**
|
||||
* Risk Limit
|
||||
*/
|
||||
|
||||
setSwitchMode(params?: {
|
||||
symbol: string;
|
||||
tp_sl_mode: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/tpsl/switch-mode', params);
|
||||
}
|
||||
getRiskLimitList(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('public/linear/risk-limit');
|
||||
}
|
||||
|
||||
setAddReduceMargin(params?: {
|
||||
symbol: string;
|
||||
side: string;
|
||||
margin: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/position/add-margin', params);
|
||||
}
|
||||
/**
|
||||
* Funding
|
||||
*/
|
||||
|
||||
setUserLeverage(params: {
|
||||
symbol: string;
|
||||
buy_leverage: number;
|
||||
sell_leverage: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/position/set-leverage', params);
|
||||
}
|
||||
getPredictedFundingFee(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/funding/predicted-funding');
|
||||
}
|
||||
|
||||
setTradingStop(params: {
|
||||
symbol: string;
|
||||
side: string;
|
||||
take_profit?: number;
|
||||
stop_loss?: number;
|
||||
trailing_stop?: number;
|
||||
tp_trigger_by?: string;
|
||||
sl_trigger_by?: string;
|
||||
sl_size?: number;
|
||||
tp_size?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.post('private/linear/position/trading-stop', params);
|
||||
}
|
||||
|
||||
getTradeRecords(params: {
|
||||
symbol: string;
|
||||
start_time?: number;
|
||||
end_time?: number;
|
||||
exec_type?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/trade/execution/list', params);
|
||||
}
|
||||
|
||||
getClosedPnl(params: {
|
||||
symbol: string;
|
||||
start_time?: number;
|
||||
end_time?: number;
|
||||
exec_type?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/tpsl/switch-mode', params);
|
||||
}
|
||||
|
||||
//Risk Limit
|
||||
|
||||
getRiskLimitList(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('public/linear/risk-limit');
|
||||
}
|
||||
|
||||
//Funding
|
||||
|
||||
getPredictedFundingFee(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/funding/predicted-funding');
|
||||
}
|
||||
|
||||
getLastFundingFee(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/funding/prev-funding');
|
||||
}
|
||||
getLastFundingFee(params: {
|
||||
symbol: string;
|
||||
}): GenericAPIResponse {
|
||||
return this.requestWrapper.get('private/linear/funding/prev-funding');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,11 @@ export default class SharedEndpoints {
|
||||
// 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;
|
||||
@@ -56,13 +60,21 @@ export default class SharedEndpoints {
|
||||
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');
|
||||
}
|
||||
|
||||
//------------Wallet Data Endpoints------------>
|
||||
/**
|
||||
*
|
||||
* Wallet Data Endpoints
|
||||
*
|
||||
*/
|
||||
|
||||
getWalletBalance(params: {
|
||||
coin?: string;
|
||||
@@ -101,7 +113,11 @@ export default class SharedEndpoints {
|
||||
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');
|
||||
@@ -111,7 +127,7 @@ export default class SharedEndpoints {
|
||||
return this.requestWrapper.get('v2/public/announcement');
|
||||
}
|
||||
|
||||
async getTimeOffset(): Promise < number > {
|
||||
async getTimeOffset(): Promise<number> {
|
||||
const start = Date.now();
|
||||
return this.getServerTime().then(result => {
|
||||
const end = Date.now();
|
||||
|
||||
Reference in New Issue
Block a user