@kamino-finance/kliquidity-sdk
Version:
Typescript SDK for interacting with the Kamino Liquidity (kliquidity) protocol
35 lines • 1.57 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.ManualRebalanceTypeName = void 0;
exports.getManualRebalanceFieldInfos = getManualRebalanceFieldInfos;
exports.getDefaultManualRebalanceFieldInfos = getDefaultManualRebalanceFieldInfos;
const CreationParameters_1 = require("../utils/CreationParameters");
const consts_1 = require("./consts");
exports.ManualRebalanceTypeName = 'manual';
function getManualRebalanceFieldInfos(lowerPrice, upperPrice, enabled = true) {
const rebalanceType = {
label: consts_1.RebalanceTypeLabelName,
type: 'string',
value: exports.ManualRebalanceTypeName,
enabled,
};
const lowerRangeRebalanceFieldInfo = {
label: 'rangePriceLower',
type: 'number',
value: lowerPrice,
enabled,
};
const upperRangeRebalanceFieldInfo = {
label: 'rangePriceUpper',
type: 'number',
value: upperPrice,
enabled,
};
return [rebalanceType, lowerRangeRebalanceFieldInfo, upperRangeRebalanceFieldInfo];
}
function getDefaultManualRebalanceFieldInfos(price) {
const lowerPrice = price.mul(CreationParameters_1.FullBPSDecimal.sub(CreationParameters_1.DefaultLowerPercentageBPSDecimal)).div(CreationParameters_1.FullBPSDecimal);
const upperPrice = price.mul(CreationParameters_1.FullBPSDecimal.add(CreationParameters_1.DefaultUpperPercentageBPSDecimal)).div(CreationParameters_1.FullBPSDecimal);
return getManualRebalanceFieldInfos(lowerPrice, upperPrice);
}
//# sourceMappingURL=manualRebalance.js.map
;