@parcl-finance/product-sdk
Version:
TypeScript SDK for interacting with Parcl's product APIs
60 lines • 1.96 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TimeSeriesClass = void 0;
const defaults_1 = require("./constants/defaults");
const httpClient_1 = require("./httpClient");
class TimeSeriesClass {
baseUrl;
headers;
client;
expressClient;
constructor(baseUrl, accessToken, env) {
const headers = {};
if (accessToken !== undefined) {
headers["Authorization"] = "Bearer " + accessToken;
}
this.headers = headers;
this.baseUrl = baseUrl.concat("/time-series");
this.client = new httpClient_1.HttpClient(this.baseUrl, this.headers);
this.expressClient = new httpClient_1.HttpClient((0, defaults_1.getDefaultExpressApiUrl)(env), this.headers);
}
async getCumulativeNotionalVolume(params) {
const { timeSeries } = await this.client.get({
path: "/cumulative-notional-volume",
params,
});
return timeSeries;
}
async getCumulativeLpFee(params) {
const { timeSeries } = await this.client.get({
path: "/cumulative-lp-fee",
params,
});
return timeSeries;
}
async getAggregatePnl(params) {
const { timeSeries } = await this.client.get({
path: "/aggregate-pnl",
params,
});
return timeSeries;
}
async getLpSharePrice(params) {
const { timeSeries } = await this.client.get({
path: "/lp-share-price",
params,
});
return timeSeries;
}
async getHistoricalMarketData(params) {
const { historicalMarketData } = await this.expressClient.get({
path: `/market-time-series/${params.marketId}`,
params: {
window: params.window,
},
});
return historicalMarketData;
}
}
exports.TimeSeriesClass = TimeSeriesClass;
//# sourceMappingURL=timeSeries.js.map