@monaco-protocol/seed-calculator
v0.1.4
Published
Monaco Protocol Seed Calculator
Downloads
63
Keywords
Readme
Seed Calculator
When applying liquidity to a market on The Monaco Protocol, market makers need to apply a spread of prices (odds) with set stake and risk amounts in order to avoid unmanageable liabilities.
The seed calculator takes in seeding parameters in order to generate for (back) and against (lay) prices with their relevant stake amounts in order to apply an even spread of liquidity.
All values are rounded to 2 decimal places.
Parameters
- True Price
- The the mid-point on a market between for and against orders, all prices are calculated from this point on the price ladder.
- Spread
- The first price on either side of the ladder from the true price.
- Steps
- How many rungs up or down the ladder until the next price is determined.
- To Return
- Amount to be returned from your for order.
- To Lose
- Amount to be returned from your against order.
- Include Stake in Returns (true/false)
- Whether or not to include the stake/risk in the return calculations.
- Depth Percentages
- Percentage of stake to place.
- For example
[100, 75, 50]
will use100%, 75%, 50%
of the calculated stake. - The number of percentages here also determines the
depth
of the pricing.
- Price Ladder (optional)
- The calculator provides prices based on the default Monaco Protocol price ladder, but custom price ladders can be provided.
- Price Tolerance (optional)
- How many rungs up and down the ladder the current price on the market can deviate before you would want to reconfigure the true price for seeding. By default this is the same value as steps.
Pricing Example
- True price
2
- Spread
4
- Steps
2
- Depth
3
- e.g. a depth percentage of
[100, 100, 100]
- e.g. a depth percentage of
- Price tolerance
2
inferred from steps
Stake Examples
With the same pricing as above:
- To return
100
- To risk
100
- Depth percentages
[100, 100, 100]
For Seeds (exclude stake)
- Stake
96.15
@ price2.04
offering a return of196.15
- Stake
93.46
@ price2.07
offering a return of193.46
- Stake
90.91
@ price2.01
offering a return of190.91
Against Seeds (exclude stake)
- Stake
104.17
@ price1.96
risking99.83
offering a return of204.17
- Stake
107.53
@ price1.93
risking99.47
offering a return of207.53
- Stake
111.111
@ price1.9
risking99.89
offering a return of211.11
For Seeds (include stake)
- Stake
49.02
@ price2.04
offering a return of100
- Stake
48.31
@ price2.07
offering a return of100
- Stake
47.62
@ price2.01
offering a return of100
Against Seeds (include stake)
- Stake
51.02
@ price1.96
risking47.98
offering a return of100
- Stake
51.81
@ price1.93
risking47.19
offering a return of100
- Stake
52.63
@ price1.9
risking46.37
offering a return of100
For Seeds - depth percentages of [100, 50, 25] (include stake)
- Stake
49.02
@ price2.04
offering a return of100
- Stake
24.15
@ price2.07
offering a return of50
- Stake
11.9
@ price2.01
offering a return of25
Against Seeds - depth percentages of [100, 50, 25] (include stake)
- Stake
51.02
@ price1.96
risking47.98
offering a return of100
- Stake
25.91
@ price1.93
risking24.09
offering a return of50
- Stake
13.16
@ price1.9
risking11.84
offering a return of25
Code Example
import { SeedManager } from "@monaco-protocol/seed-calculator";
const truePrice = 2;
const spread = 4;
const steps = 2;
const toReturn = 100;
const toLose = 100;
const includeStakeInReturns = true;
const depthPercentages = [100, 50, 25];
const withinAgainstTolerance = 2.06;
const outsideForTolerance = 1.93;
const manager = SeedManager.initialize(
truePrice,
spread,
steps,
toReturn,
toLose,
includeStakeInReturns,
depthPercentages
);
console.log("FOR\n");
manager.forSeeds.map((seed) => {
console.log(JSON.stringify(seed));
});
console.log("\nAGAINST\n");
manager.againstSeeds.map((seed) => {
console.log(JSON.stringify(seed));
});
console.log(
`\nIs price ${outsideForTolerance} within FOR tolerance? ${manager.checkForTolerance(
outsideForTolerance
)}`
);
console.log(
`Is price ${withinAgainstTolerance} within AGAINST tolerance? ${manager.checkForTolerance(
withinAgainstTolerance
)}`
);