Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/day-markets/acred/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"selfLiquidationBonus": 0.01,
"stProtocolFee": 0,
"jtProtocolFee": 0,
"jtYieldShareProtocolFee": 0.45,
"ltYieldShareProtocolFee": 0.45,
"jtYieldShareProtocolFee": 0.05,
"ltYieldShareProtocolFee": 0.05,
"stableYield": 0.035,
"swapFeeBps": 10,
"poolTurnoverPerYear": 8,
Expand Down
4 changes: 2 additions & 2 deletions lib/day-markets/blockhouse/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"selfLiquidationBonus": 0.01,
"stProtocolFee": 0,
"jtProtocolFee": 0,
"jtYieldShareProtocolFee": 0.45,
"ltYieldShareProtocolFee": 0.45,
"jtYieldShareProtocolFee": 0.05,
"ltYieldShareProtocolFee": 0.05,
"stableYield": 0.035,
"swapFeeBps": 10,
"poolTurnoverPerYear": 8,
Expand Down
4 changes: 2 additions & 2 deletions lib/day-markets/dualmint/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"selfLiquidationBonus": 0.01,
"stProtocolFee": 0,
"jtProtocolFee": 0,
"jtYieldShareProtocolFee": 0.45,
"ltYieldShareProtocolFee": 0.45,
"jtYieldShareProtocolFee": 0.05,
"ltYieldShareProtocolFee": 0.05,
"stableYield": 0.035,
"swapFeeBps": 10,
"poolTurnoverPerYear": 8,
Expand Down
4 changes: 2 additions & 2 deletions lib/day-markets/infinifi/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"selfLiquidationBonus": 0.01,
"stProtocolFee": 0,
"jtProtocolFee": 0,
"jtYieldShareProtocolFee": 0.45,
"ltYieldShareProtocolFee": 0.45,
"jtYieldShareProtocolFee": 0.05,
"ltYieldShareProtocolFee": 0.05,
"stableYield": 0.035,
"swapFeeBps": 10,
"poolTurnoverPerYear": 8,
Expand Down
4 changes: 2 additions & 2 deletions lib/day-markets/makina-dbit/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"selfLiquidationBonus": 0.01,
"stProtocolFee": 0,
"jtProtocolFee": 0,
"jtYieldShareProtocolFee": 0.45,
"ltYieldShareProtocolFee": 0.45,
"jtYieldShareProtocolFee": 0.05,
"ltYieldShareProtocolFee": 0.05,
"stableYield": 0,
"swapFeeBps": 10,
"poolTurnoverPerYear": 2.4,
Expand Down
4 changes: 2 additions & 2 deletions lib/day-markets/makina-deth/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"selfLiquidationBonus": 0.01,
"stProtocolFee": 0,
"jtProtocolFee": 0,
"jtYieldShareProtocolFee": 0.45,
"ltYieldShareProtocolFee": 0.45,
"jtYieldShareProtocolFee": 0.05,
"ltYieldShareProtocolFee": 0.05,
"stableYield": 0.035,
"swapFeeBps": 10,
"poolTurnoverPerYear": 8,
Expand Down
4 changes: 2 additions & 2 deletions lib/day-markets/makina-dusd/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"selfLiquidationBonus": 0.01,
"stProtocolFee": 0,
"jtProtocolFee": 0,
"jtYieldShareProtocolFee": 0.45,
"ltYieldShareProtocolFee": 0.45,
"jtYieldShareProtocolFee": 0.05,
"ltYieldShareProtocolFee": 0.05,
"stableYield": 0.035,
"swapFeeBps": 10,
"poolTurnoverPerYear": 8,
Expand Down
4 changes: 2 additions & 2 deletions lib/day-markets/makina-usdshfmk/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"selfLiquidationBonus": 0.01,
"stProtocolFee": 0,
"jtProtocolFee": 0,
"jtYieldShareProtocolFee": 0.45,
"ltYieldShareProtocolFee": 0.45,
"jtYieldShareProtocolFee": 0.05,
"ltYieldShareProtocolFee": 0.05,
"stableYield": 0.035,
"swapFeeBps": 10,
"poolTurnoverPerYear": 8,
Expand Down
6 changes: 3 additions & 3 deletions lib/day-markets/pareto-falconx/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"riskYDM": {
"mode": "adaptive",
"y0": 0.005,
"yTarget": 0.045,
"yTarget": 0.027,
"y100": 0.31,
"maxAdaptSpeedPerYear": 100,
"minYTarget": 0.0001,
Expand All @@ -41,8 +41,8 @@
"selfLiquidationBonus": 0.01,
"stProtocolFee": 0,
"jtProtocolFee": 0,
"jtYieldShareProtocolFee": 0.45,
"ltYieldShareProtocolFee": 0.45,
"jtYieldShareProtocolFee": 0.05,
"ltYieldShareProtocolFee": 0.05,
"stableYield": 0.035,
"swapFeeBps": 10,
"poolTurnoverPerYear": 8,
Expand Down
4 changes: 2 additions & 2 deletions lib/day-markets/reusde/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"selfLiquidationBonus": 0.01,
"stProtocolFee": 0,
"jtProtocolFee": 0,
"jtYieldShareProtocolFee": 0.45,
"ltYieldShareProtocolFee": 0.45,
"jtYieldShareProtocolFee": 0.05,
"ltYieldShareProtocolFee": 0.05,
"stableYield": 0.035,
"swapFeeBps": 10,
"poolTurnoverPerYear": 8,
Expand Down
6 changes: 3 additions & 3 deletions lib/day-markets/susdai/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"riskYDM": {
"mode": "adaptive",
"y0": 0.03,
"yTarget": 0.07,
"yTarget": 0.188,
"y100": 0.31,
"maxAdaptSpeedPerYear": 100,
"minYTarget": 0.0001,
Expand All @@ -41,8 +41,8 @@
"selfLiquidationBonus": 0.01,
"stProtocolFee": 0,
"jtProtocolFee": 0,
"jtYieldShareProtocolFee": 0.45,
"ltYieldShareProtocolFee": 0.45,
"jtYieldShareProtocolFee": 0.05,
"ltYieldShareProtocolFee": 0.05,
"stableYield": 0.035,
"swapFeeBps": 10,
"poolTurnoverPerYear": 8,
Expand Down
40 changes: 40 additions & 0 deletions lib/day-simulator-template/explorer-market.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ import {
import { runDayTargetScenario } from "@/lib/day-simulator-template/runtime";
import { annualizedSeriesApy } from "@/lib/day-simulator-template/series";
import { JBBB_SAMPLE_MARKET } from "@/lib/day-sample-sources/jbbb/market";
import { DAY_MARKETS } from "@/lib/day-markets/registry";

const YIELD_PREMIUM_PROTOCOL_FEE = 0.05;

for (const market of DAY_MARKETS) {
assert.equal(
market.defaults.jtYieldShareProtocolFee,
YIELD_PREMIUM_PROTOCOL_FEE,
`${market.id} Junior yield-premium protocol fee`,
);
assert.equal(
market.defaults.ltYieldShareProtocolFee,
YIELD_PREMIUM_PROTOCOL_FEE,
`${market.id} SLP yield-premium protocol fee`,
);
}

assert.equal(DAY_EXPLORER_TEMPLATE_MARKET.route, "/day-sim");
assert.equal(DAY_EXPLORER_TEMPLATE_MARKET.series.length, 13);
Expand All @@ -30,6 +46,14 @@ assert.equal(draft.certification.intakeConfirmed, false);
assert.equal(draft.provenance.observationCount, 3);
assert.equal(draft.provenance.priceType, "unknown");
assert.ok(draft.defaults.sourceApy > 0);
assert.equal(
draft.defaults.jtYieldShareProtocolFee,
YIELD_PREMIUM_PROTOCOL_FEE,
);
assert.equal(
draft.defaults.ltYieldShareProtocolFee,
YIELD_PREMIUM_PROTOCOL_FEE,
);

const outputs = runDayTargetScenario(draft.defaults);
assert.ok(Number.isFinite(outputs.seniorApy));
Expand All @@ -43,6 +67,14 @@ assert.equal(JBBB_SAMPLE_MARKET.provenance.observationCount, 1144);
assert.equal(JBBB_SAMPLE_MARKET.provenance.firstDate, "2022-01-12");
assert.equal(JBBB_SAMPLE_MARKET.provenance.lastDate, "2026-08-05");
assert.equal(JBBB_SAMPLE_MARKET.series[0].price, 100);
assert.equal(
JBBB_SAMPLE_MARKET.defaults.jtYieldShareProtocolFee,
YIELD_PREMIUM_PROTOCOL_FEE,
);
assert.equal(
JBBB_SAMPLE_MARKET.defaults.ltYieldShareProtocolFee,
YIELD_PREMIUM_PROTOCOL_FEE,
);
assert.ok(Math.abs(annualizedSeriesApy(JBBB_SAMPLE_MARKET.series) - 0.05825) < 0.00001);

const yieldDraft = buildDayYieldDraftMarket({
Expand All @@ -57,6 +89,14 @@ assert.equal(yieldDraft.provenance.observationCount, 0);
assert.equal(yieldDraft.provenance.feesIncluded, true);
assert.equal(yieldDraft.customization.hiddenSections.includes("backtest"), true);
assert.equal(yieldDraft.series.length, 0);
assert.equal(
yieldDraft.defaults.jtYieldShareProtocolFee,
YIELD_PREMIUM_PROTOCOL_FEE,
);
assert.equal(
yieldDraft.defaults.ltYieldShareProtocolFee,
YIELD_PREMIUM_PROTOCOL_FEE,
);

const yieldOutputs = runDayTargetScenario(yieldDraft.defaults);
assert.ok(Number.isFinite(yieldOutputs.seniorApy));
Expand Down
4 changes: 2 additions & 2 deletions lib/day-simulator-template/explorer-market.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export const DAY_EXPLORER_TEMPLATE_MANIFEST: DayMarketManifest = {
selfLiquidationBonus: 0.02,
stProtocolFee: 0,
jtProtocolFee: 0,
jtYieldShareProtocolFee: 0,
ltYieldShareProtocolFee: 0,
jtYieldShareProtocolFee: 0.05,
ltYieldShareProtocolFee: 0.05,
stableYield: 0.035,
swapFeeBps: 10,
poolTurnoverPerYear: 8,
Expand Down
16 changes: 7 additions & 9 deletions lib/day-simulator-template/runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,15 +343,13 @@ assert.equal(tighterBandConfig.eclpBandWidth, 0.05);
assert.equal(tighterBandConfig.eclpParams, undefined);

const yields = runDayTargetScenario(market.defaults);
// Senior and SLP moved when the pool stopped being seeded at a flat 10% Senior
// and started opening at its own curve's resting split — 3.884% on every market
// that declares a curve, Pareto included. Junior is untouched by the pool's
// composition and is byte-identical, which is the check that the change did
// what it says and nothing more. Senior 8.879% -> 8.797%, still inside this
// market's [8.66, 9.16] certification band.
assert.ok(Math.abs(yields.seniorApy - 0.08797192293801026) < 1e-12);
assert.ok(Math.abs(yields.juniorApy - 0.12948094983927905) < 1e-12);
assert.ok(Math.abs(yields.liquidityApy - 0.09327491357897322) < 1e-12);
// Pareto's accountant-backed calibration preserves its declared Senior and
// Junior return bands after the uniform 5% Junior/SLP yield-premium protocol
// fee is applied. These exact outputs also pin the manifest decimal through the
// runtime adapter and the contract-mirrored fee-share minting path.
assert.ok(Math.abs(yields.seniorApy - 0.0913920169096325) < 1e-12);
assert.ok(Math.abs(yields.juniorApy - 0.13924177159090334) < 1e-12);
assert.ok(Math.abs(yields.liquidityApy - 0.10248258285545275) < 1e-12);

const forwardSeries = buildDayForwardSeries(
0.114,
Expand Down
6 changes: 3 additions & 3 deletions scripts/day-simulator/template-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"lib/day-simulator-template/docs-links.ts": "37493e2dded59fa3c7fe91df8401aa5926ad1d12a38a52052873d9957be0ff62",
"lib/day-simulator-template/erasure.test.ts": "f328072947e011cb822c91afeaf53bdc065ff07431a887036d430b42519ff7b6",
"lib/day-simulator-template/erasure.ts": "84c1e880dafa07d5061dac24def4a3756419bcce7c7e70d5641fd0efcfc09e9d",
"lib/day-simulator-template/explorer-market.test.ts": "4f7b199c0ba4aa515d2924b25f0b88e748f83f46d623fedd339b8d04368f58a0",
"lib/day-simulator-template/explorer-market.ts": "cc8897036585f86993564a90b3e7d06185f1de26640be396eb677f219e01d005",
"lib/day-simulator-template/explorer-market.test.ts": "5ab8226d4263f8c271ea3d1c104b635f71e66bdfed008d90c24eebd48d2fa7f5",
"lib/day-simulator-template/explorer-market.ts": "1a27086ef2a8e0e730b6b167855153b7b436c7cd8719db59a77f048a3617871b",
"lib/day-simulator-template/explainer.test.ts": "ac6e9379158620fd4f75e7c7b56cdedd7d940dc34772f00b16b2388de83d35e1",
"lib/day-simulator-template/explainer.ts": "f3cc1c74d389009201a1ee46283ff5b462399fabec87cdf67e08254e7980aa95",
"lib/day-simulator-template/issuer-presets.ts": "fecaed5814634c8d14a9767e43f0f62a6da375e2e72282bd203fdd364aac1ba0",
Expand All @@ -34,7 +34,7 @@
"lib/day-simulator-template/permalink.ts": "776525c1a9928ebaf876b45d197e19b2ef12a7f51114d94ab03defd0caf5b1e0",
"lib/day-simulator-template/permalink.test.ts": "13fe4d22f7f49c1a96677e31f882068270f9943be00edc5493a64f2b12e620b2",
"lib/day-simulator-template/refill.ts": "bb41d8ef450523aa9006fe1f9f2ed422ae0640053d44c3709151fe2bd2ada20d",
"lib/day-simulator-template/runtime.test.ts": "0be9608aa8b07d3166de0fe0e941238fa21f0253ad3c661f22f0a62a46e604d4",
"lib/day-simulator-template/runtime.test.ts": "bc07324c6335720b0f8c204005a5b34e31163d7bdd276c7b16b6d44403b2627d",
"lib/day-simulator-template/runtime.ts": "f54ea48cbbfc5ad4d1977aa7b0507cf7ddb91ae10606e90ab1ed280c89a83b86",
"lib/day-simulator-template/series.ts": "fcfad3de9a17225bdf1aedf672eb2c756af5100db417169bff0569a7e3082db4",
"lib/day-simulator-template/stress.test.ts": "9637ea95cea0c6c002873b74caca5bde780d92c929076b7568e3e28075ff87f0",
Expand Down
11 changes: 6 additions & 5 deletions scripts/day-v3/v2-output-regression.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ const actual = {
};

// Captured after the authorized shared-engine correction that applies the
// exact-input pool fee before E-CLP pricing. The route/components remain frozen;
// this baseline intentionally records the corrected all-in exit quote.
// exact-input pool fee before E-CLP pricing and the uniform 5% protocol fee on
// Junior and SLP yield premiums. The route/components remain frozen; this
// baseline intentionally records the corrected all-in returns and exit quote.
assert.deepEqual(actual, {
market: "jbbb",
terms: {
Expand All @@ -59,9 +60,9 @@ assert.deepEqual(actual, {
lt: 4444444.444444445,
},
scenario: {
seniorApy: 0.043539092406083446,
juniorApy: 0.0995122311478902,
liquidityApy: 0.07104533931079726,
seniorApy: 0.04353777871863951,
juniorApy: 0.09741459113398454,
liquidityApy: 0.06973721931312293,
},
capitalStack: {
coverageLossLimit: 0.22222222222299992,
Expand Down
Loading