Add Linear Client- Test endpoints added.

This commit is contained in:
peepopoggers
2021-01-21 22:19:00 +00:00
committed by GitHub
parent 4d20b58048
commit 4b73b3c3f4

47
src/linear-client.ts Normal file
View File

@@ -0,0 +1,47 @@
import { AxiosRequestConfig } from 'axios';
import { GenericAPIResponse, getBaseRESTInverseUrl, RestClientInverseOptions } from './util/requestUtils';
import RequestWrapper from './util/requestWrapper';
import { SharedEndpoints } from './shared-endpoints';
export class LinearClient extends SharedEndpoints {
protected requestWrapper: RequestWrapper;
/**
* @public Creates an instance of the inverse REST API client.
*
* @param {string} key - your API key
* @param {string} secret - your API secret
* @param {boolean} [livenet=false]
* @param {RestClientInverseOptions} [restInverseOptions={}] options to configure REST API connectivity
* @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;
}
/**
* @public Get the last funding rate.
*/
getLastFundingRate(params: {
symbol: string;
}): GenericAPIResponse {
return this.requestWrapper.get('public/linear/funding/prev-funding-rate', params);
}
}