@pendle/sdk-boros 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ import { FixedX18 } from '@pendle/boros-offchain-math';
2
2
  export type MarketConfig = {
3
3
  marginFactor: FixedX18;
4
4
  markRate: FixedX18;
5
- maxMarginIndexRate: FixedX18;
5
+ minMarginIndexRate: FixedX18;
6
6
  marketExpiry_s: number;
7
7
  };
8
8
  export type GetOrderSizeByExactInitialMarginParams = {
@@ -7,14 +7,14 @@ const SIZE_ORDER_RATE_RATIO = boros_offchain_math_1.FixedX18.fromNumber(0.01);
7
7
  const SECONDS_PER_YEARS = 3600 * 24 * 365;
8
8
  class Market {
9
9
  static getOrderSizeByExactInitialMargin(params) {
10
- const { initialMargin, orderRate, isMarketOrder, leverage, marginFactor, markRate, maxMarginIndexRate, marketExpiry_s, } = params;
10
+ const { initialMargin, orderRate, isMarketOrder, leverage, marginFactor, markRate, minMarginIndexRate, marketExpiry_s, } = params;
11
11
  const timeToMaturity_y = (marketExpiry_s - Math.floor(Date.now() / 1000)) / SECONDS_PER_YEARS;
12
12
  const orderRateWithBuffer = isMarketOrder
13
13
  ? orderRate.mulDown(boros_offchain_math_1.FixedX18.ONE.add(MARKET_ORDER_BUFFER_RATE))
14
14
  : orderRate;
15
15
  const sizeOrderRateRatio = [
16
16
  marginFactor.mulDown(markRate),
17
- marginFactor.mulDown(maxMarginIndexRate),
17
+ marginFactor.mulDown(minMarginIndexRate),
18
18
  orderRateWithBuffer.divDown(boros_offchain_math_1.FixedX18.fromNumber(leverage)),
19
19
  ].reduce((a, b) => (a.gt(b) ? a : b), boros_offchain_math_1.FixedX18.ZERO);
20
20
  const sizeOrderRateRatioWithBuffer = sizeOrderRateRatio.mulDown(boros_offchain_math_1.FixedX18.ONE.add(SIZE_ORDER_RATE_RATIO));
@@ -25,12 +25,12 @@ class Market {
25
25
  return orderSize;
26
26
  }
27
27
  static getInitialMarginByOrderSize(params) {
28
- const { orderSize, orderRate, isMarketOrder, leverage, marginFactor, markRate, maxMarginIndexRate, marketExpiry_s } = params;
28
+ const { orderSize, orderRate, isMarketOrder, leverage, marginFactor, markRate, minMarginIndexRate, marketExpiry_s } = params;
29
29
  const timeToMaturity_y = (marketExpiry_s - Math.floor(Date.now() / 1000)) / SECONDS_PER_YEARS;
30
30
  const orderRateWithBuffer = isMarketOrder ? orderRate.mulDown(boros_offchain_math_1.FixedX18.ONE.add(MARKET_ORDER_BUFFER_RATE)) : orderRate;
31
31
  const sizeOrderRateRatio = [
32
32
  marginFactor.mulDown(markRate),
33
- marginFactor.mulDown(maxMarginIndexRate),
33
+ marginFactor.mulDown(minMarginIndexRate),
34
34
  orderRateWithBuffer.divDown(boros_offchain_math_1.FixedX18.fromNumber(leverage)),
35
35
  ].reduce((a, b) => (a.gt(b) ? a : b), boros_offchain_math_1.FixedX18.ZERO);
36
36
  const initialMarginRateRatioWithBuffer = sizeOrderRateRatio.mulDown(boros_offchain_math_1.FixedX18.ONE.add(SIZE_ORDER_RATE_RATIO));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@pendle/sdk-boros",
3
3
  "description": "Pendle SDK for Boros",
4
4
  "license": "MIT",
5
- "version": "0.1.0",
5
+ "version": "0.1.1",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "files": [