# DEXSim
An API to create and interact with a local version of Uniswap v3. Configure and deploy a number of token pools for trading and experimentation.
Built on [Simular](https://simular.readthedocs.io/en/latest/)
## Install
```console
> pip install dexsim
```
## Quick Start
### Configuration
You can setup pools and any other additional information in a YAML file. This file is passed as a parameter to the `DEX` constructor.
**Example:**
File: *config.yaml*
```yaml
simulator:
pools:
eth_usdc:
tokens:
0: "usdc"
1: "eth"
fee: 0.30
price: 3000.00
dia_usdc:
tokens:
0: "dia"
1: "usdc"
fee: 0.05
price: 1.0
```
### Create an interact with a Uniswap DEX
```python
from dexsim.dex import DEX
# Create the Unswap DEX based on the configuration file
dex = DEX('./config.yaml')
assert 2 == dex.total_number_of_pools()
# create a wallet for Bob
bob = dex.create_wallet()
# mint 9000 USDC and 3 WETH for bob
dex.pools.eth_usdc_pool.mint_tokens(9000, 3, bob)
# Add some liquidity to the pool and get the NFT position token id
_, _, tokenid = dex.pools.eth_usdc_pool.mint_liquidity_position(3000, 1, 2900, 3100, bob)
```
See `tests/` for several examples of use.
Raw data
{
"_id": null,
"home_page": null,
"name": "dexsim",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "agent-based modeling, ethereum, simulation, solidity, uniswap",
"author": null,
"author_email": "Dave Bryson <davebryson@users.noreply.github.com>",
"download_url": "https://files.pythonhosted.org/packages/05/06/356acf74624cfc82f0e5fde2ed30a9615614dbecd7fc9bb5125b14296912/dexsim-0.1.0.tar.gz",
"platform": null,
"description": "# DEXSim\n\nAn API to create and interact with a local version of Uniswap v3. Configure and deploy a number of token pools for trading and experimentation.\n\nBuilt on [Simular](https://simular.readthedocs.io/en/latest/)\n\n\n## Install\n```console\n> pip install dexsim\n```\n\n## Quick Start\n\n### Configuration\nYou can setup pools and any other additional information in a YAML file. This file is passed as a parameter to the `DEX` constructor.\n\n**Example:**\nFile: *config.yaml*\n```yaml\nsimulator:\n pools:\n eth_usdc:\n tokens:\n 0: \"usdc\"\n 1: \"eth\"\n fee: 0.30\n price: 3000.00\n dia_usdc:\n tokens:\n 0: \"dia\"\n 1: \"usdc\"\n fee: 0.05\n price: 1.0\n```\n\n### Create an interact with a Uniswap DEX\n\n```python\nfrom dexsim.dex import DEX\n\n# Create the Unswap DEX based on the configuration file\ndex = DEX('./config.yaml')\n\nassert 2 == dex.total_number_of_pools()\n\n# create a wallet for Bob\nbob = dex.create_wallet()\n\n# mint 9000 USDC and 3 WETH for bob\ndex.pools.eth_usdc_pool.mint_tokens(9000, 3, bob)\n\n# Add some liquidity to the pool and get the NFT position token id\n _, _, tokenid = dex.pools.eth_usdc_pool.mint_liquidity_position(3000, 1, 2900, 3100, bob)\n\n```\n\nSee `tests/` for several examples of use.\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "API to create and interact with Uniswap based decentralized exchange",
"version": "0.1.0",
"project_urls": null,
"split_keywords": [
"agent-based modeling",
" ethereum",
" simulation",
" solidity",
" uniswap"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c7a9ad502c2ba3c1987c54c85936881a508ed281561dbf3cb8dabbd55b3dcc79",
"md5": "406dd879bf9864308b14bb9855b970bb",
"sha256": "83208e3db4b2af0b61ed8bb97c16d7db5c2f28f4fbbd63e2484bc9a5f6a8d257"
},
"downloads": -1,
"filename": "dexsim-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "406dd879bf9864308b14bb9855b970bb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 57144,
"upload_time": "2025-02-24T02:01:22",
"upload_time_iso_8601": "2025-02-24T02:01:22.268947Z",
"url": "https://files.pythonhosted.org/packages/c7/a9/ad502c2ba3c1987c54c85936881a508ed281561dbf3cb8dabbd55b3dcc79/dexsim-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0506356acf74624cfc82f0e5fde2ed30a9615614dbecd7fc9bb5125b14296912",
"md5": "5c107508ce2177d717d5494d236f0402",
"sha256": "31e314b87cbba2fccb56e50cb47db958b3e8e5866586006e6560f94810155d9a"
},
"downloads": -1,
"filename": "dexsim-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "5c107508ce2177d717d5494d236f0402",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 53479,
"upload_time": "2025-02-24T02:01:24",
"upload_time_iso_8601": "2025-02-24T02:01:24.482835Z",
"url": "https://files.pythonhosted.org/packages/05/06/356acf74624cfc82f0e5fde2ed30a9615614dbecd7fc9bb5125b14296912/dexsim-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-24 02:01:24",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "dexsim"
}