{"id":21221815,"url":"https://github.com/primitivefinance/fee-generation-py","last_synced_at":"2025-03-15T01:14:55.773Z","repository":{"id":152834814,"uuid":"618004954","full_name":"primitivefinance/fee-generation-py","owner":"primitivefinance","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-18T17:40:11.000Z","size":78,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-01-21T17:12:53.922Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/primitivefinance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-23T14:59:23.000Z","updated_at":"2023-04-09T14:32:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"39cb98b7-9d02-43dc-bed8-d7aaadd32b31","html_url":"https://github.com/primitivefinance/fee-generation-py","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primitivefinance%2Ffee-generation-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primitivefinance%2Ffee-generation-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primitivefinance%2Ffee-generation-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/primitivefinance%2Ffee-generation-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/primitivefinance","download_url":"https://codeload.github.com/primitivefinance/fee-generation-py/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243668234,"owners_count":20328042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T22:33:59.008Z","updated_at":"2025-03-15T01:14:55.733Z","avatar_url":"https://github.com/primitivefinance.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fee-generation-py\n\nCalculates average fees earned and standard deviation over $M$ number of random price path runs $P_t$ or backtests performance against USDC/USDT price history imported from the. Uniswap V3 subgraph, for a given RMM01 or Stable Portfolio pool configuration $(K, \\sigma, \\tau)$. Allows us to plot the rate of fee growth relative to the pools' volatility parameter. Observed values based solely on required arbitrage volume given a specified minimum arbitrage profit bound. Plots and exports pool volatility, fee growth, and variance data as csv after the simulation. Runs using a CLI.\n\nI left the code relatively general so we can just add CFMMs and price processes as we see fit for testing. Functions using simpy environments in multithreaded execution.\n\n## Modules \u0026 Dependencies\n\nConsists of 6 modules: \n\n- ``Modules/CFMM.py`` contains CFMM logic\n- ``Modules/Arbitrage.py`` contains Arbitrageur logic\n- ``Modules/PriceGen.py`` contains price generation logic\n- ``Modules/Sim.py`` contains simulation execution logic\n- ``Modules/cli.py`` contains command-line interface bindings\n- ``Modules/config.ini`` configuration file for simulation and pool parameters\n\nPackage dependencies include: ``numpy``, ``simpy``, ``scipy``, ``matplotlib.pyplot``, ``requests``, ``time``, ``concurrent.futures``, ``pandas``, ``configparser``, ``argparse``\n\n## CLI Commands\n\nThe simulation runs using commands to specify which simulation process to run and plot. Each process runs $M$ simulation runs for each of the $G$ IV pool parameters and plots the average fee growth and standard deviation against the pool IV, then exports data as csv. The commands are as follows:\n\n- ``python3 Sim.py --GBM`` runs a Geometric Brownian Motion process against an RMM-01 pool\n- ``python3 Sim.py --OU`` runs an Ornstein-Uhlenbeck process centered at 1 against a Stable Portfolio pool\n- ``python3 Sim.py --Backtest`` runs 6 months of USDC/USDT against a Stable Portfolio pool \n- ``python3 Sim.py --CS`` runs an Ornstein-Uhlenbeck process centered at 1 against a Constant Sum pool\n- ``python3 Sim.py --OptimizedTest`` runs the USDC/USDT backtest data against the optimized parameter set for Stable Portfolio\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimitivefinance%2Ffee-generation-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprimitivefinance%2Ffee-generation-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprimitivefinance%2Ffee-generation-py/lists"}