├── .commitlintrc.js ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .lintstagedrc.js ├── .npmignore ├── .prettierrc ├── README.md ├── jest.config.js ├── package.json ├── src ├── fpmm │ ├── index.ts │ ├── liquidity │ │ ├── calcAddFundingDepositedAmounts.test.ts │ │ ├── calcAddFundingDepositedAmounts.ts │ │ ├── calcAddFundingSendAmounts.test.ts │ │ ├── calcAddFundingSendAmounts.ts │ │ ├── calcDepositedTokens.test.ts │ │ ├── calcDepositedTokens.ts │ │ ├── calcDistributionHint.test.ts │ │ ├── calcDistributionHint.ts │ │ ├── calcInitialFundingDepositedAmounts.test.ts │ │ ├── calcInitialFundingDepositedAmounts.ts │ │ ├── calcInitialFundingSendAmounts.test.ts │ │ ├── calcInitialFundingSendAmounts.ts │ │ ├── calcPoolTokens.test.ts │ │ ├── calcPoolTokens.ts │ │ ├── calcRemoveFundingSendAmounts.ts │ │ └── index.ts │ ├── price │ │ ├── calcPrice.test.ts │ │ ├── calcPrice.ts │ │ └── index.ts │ └── trading │ │ ├── calcBuyAmountInShares.test.ts │ │ ├── calcBuyAmountInShares.ts │ │ ├── calcSellAmountInCollateral.test.ts │ │ ├── calcSellAmountInCollateral.ts │ │ ├── computeBalanceAfterSharePurchase.test.ts │ │ ├── computeBalanceAfterSharePurchase.ts │ │ ├── computeBalanceAfterShareSale.test.ts │ │ ├── computeBalanceAfterShareSale.ts │ │ ├── computeBalanceAfterTrade.test.ts │ │ ├── computeBalanceAfterTrade.ts │ │ └── index.ts ├── index.ts └── utils.ts ├── tsconfig.json ├── tsconfig.production.json └── yarn.lock /.commitlintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ["@commitlint/config-conventional"], 3 | }; 4 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | # folders 2 | lib/ 3 | node_modules/ 4 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/.eslintrc.js -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # folders 2 | node_modules/ 3 | lib/ 4 | 5 | *.log 6 | *.tgz -------------------------------------------------------------------------------- /.lintstagedrc.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/.lintstagedrc.js -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/.npmignore -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/.prettierrc -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/README.md -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/jest.config.js -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/package.json -------------------------------------------------------------------------------- /src/fpmm/index.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/index.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcAddFundingDepositedAmounts.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcAddFundingDepositedAmounts.test.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcAddFundingDepositedAmounts.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcAddFundingDepositedAmounts.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcAddFundingSendAmounts.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcAddFundingSendAmounts.test.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcAddFundingSendAmounts.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcAddFundingSendAmounts.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcDepositedTokens.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcDepositedTokens.test.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcDepositedTokens.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcDepositedTokens.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcDistributionHint.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcDistributionHint.test.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcDistributionHint.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcDistributionHint.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcInitialFundingDepositedAmounts.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcInitialFundingDepositedAmounts.test.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcInitialFundingDepositedAmounts.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcInitialFundingDepositedAmounts.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcInitialFundingSendAmounts.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcInitialFundingSendAmounts.test.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcInitialFundingSendAmounts.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcInitialFundingSendAmounts.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcPoolTokens.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcPoolTokens.test.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcPoolTokens.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcPoolTokens.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/calcRemoveFundingSendAmounts.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/calcRemoveFundingSendAmounts.ts -------------------------------------------------------------------------------- /src/fpmm/liquidity/index.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/liquidity/index.ts -------------------------------------------------------------------------------- /src/fpmm/price/calcPrice.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/price/calcPrice.test.ts -------------------------------------------------------------------------------- /src/fpmm/price/calcPrice.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/price/calcPrice.ts -------------------------------------------------------------------------------- /src/fpmm/price/index.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/price/index.ts -------------------------------------------------------------------------------- /src/fpmm/trading/calcBuyAmountInShares.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/trading/calcBuyAmountInShares.test.ts -------------------------------------------------------------------------------- /src/fpmm/trading/calcBuyAmountInShares.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/trading/calcBuyAmountInShares.ts -------------------------------------------------------------------------------- /src/fpmm/trading/calcSellAmountInCollateral.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/trading/calcSellAmountInCollateral.test.ts -------------------------------------------------------------------------------- /src/fpmm/trading/calcSellAmountInCollateral.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/trading/calcSellAmountInCollateral.ts -------------------------------------------------------------------------------- /src/fpmm/trading/computeBalanceAfterSharePurchase.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/trading/computeBalanceAfterSharePurchase.test.ts -------------------------------------------------------------------------------- /src/fpmm/trading/computeBalanceAfterSharePurchase.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/trading/computeBalanceAfterSharePurchase.ts -------------------------------------------------------------------------------- /src/fpmm/trading/computeBalanceAfterShareSale.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/trading/computeBalanceAfterShareSale.test.ts -------------------------------------------------------------------------------- /src/fpmm/trading/computeBalanceAfterShareSale.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/trading/computeBalanceAfterShareSale.ts -------------------------------------------------------------------------------- /src/fpmm/trading/computeBalanceAfterTrade.test.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/trading/computeBalanceAfterTrade.test.ts -------------------------------------------------------------------------------- /src/fpmm/trading/computeBalanceAfterTrade.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/trading/computeBalanceAfterTrade.ts -------------------------------------------------------------------------------- /src/fpmm/trading/index.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/fpmm/trading/index.ts -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/index.ts -------------------------------------------------------------------------------- /src/utils.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/src/utils.ts -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/tsconfig.json -------------------------------------------------------------------------------- /tsconfig.production.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/tsconfig.production.json -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Polymarket/amm-maths/HEAD/yarn.lock --------------------------------------------------------------------------------