npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@monaco-protocol/seed-calculator

v0.1.4

Published

Monaco Protocol Seed Calculator

Downloads

63

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 use 100%, 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]
  • 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 @ price 2.04 offering a return of 196.15
  • Stake 93.46 @ price 2.07 offering a return of 193.46
  • Stake 90.91 @ price 2.01 offering a return of 190.91

Against Seeds (exclude stake)

  • Stake 104.17 @ price 1.96 risking 99.83 offering a return of 204.17
  • Stake 107.53 @ price 1.93 risking 99.47 offering a return of 207.53
  • Stake 111.111 @ price 1.9 risking 99.89 offering a return of 211.11

For Seeds (include stake)

  • Stake 49.02 @ price 2.04 offering a return of 100
  • Stake 48.31 @ price 2.07 offering a return of 100
  • Stake 47.62 @ price 2.01 offering a return of 100

Against Seeds (include stake)

  • Stake 51.02 @ price 1.96 risking 47.98 offering a return of 100
  • Stake 51.81 @ price 1.93 risking 47.19 offering a return of 100
  • Stake 52.63 @ price 1.9 risking 46.37 offering a return of 100

For Seeds - depth percentages of [100, 50, 25] (include stake)

  • Stake 49.02 @ price 2.04 offering a return of 100
  • Stake 24.15 @ price 2.07 offering a return of 50
  • Stake 11.9 @ price 2.01 offering a return of 25

Against Seeds - depth percentages of [100, 50, 25] (include stake)

  • Stake 51.02 @ price 1.96 risking 47.98 offering a return of 100
  • Stake 25.91 @ price 1.93 risking 24.09 offering a return of 50
  • Stake 13.16 @ price 1.9 risking 11.84 offering a return of 25

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
  )}`
);