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