Building a Simple Uniswap V3 LP Simulator in Python

📰 Medium · Python

Learn to build a simple Uniswap V3 LP simulator in Python to explore scenario spaces and understand protocol behavior

intermediate Published 25 Apr 2026
Action Steps
  1. Install Python and necessary libraries to start building the simulator
  2. Use Solidity to define protocol truth and Python for scenario control
  3. Design a simulator that can run real Uniswap V3 execution repeatedly from controlled baselines
  4. Implement the simulator using Python and test its functionality
  5. Analyze the results of the simulator to gain insights into Uniswap V3 protocol behavior
Who Needs to Know This

This project benefits developers and researchers on a team working with Uniswap V3 protocols, as it allows them to simulate and analyze different scenarios

Key Insight

💡 Using a simulator can help developers and researchers understand complex protocol behavior and make informed decisions

Share This
🚀 Build a Uniswap V3 LP simulator in Python to explore scenario spaces and understand protocol behavior! 💡

Key Takeaways

Learn to build a simple Uniswap V3 LP simulator in Python to explore scenario spaces and understand protocol behavior

Full Article

Title: Building a Simple Uniswap V3 LP Simulator in Python

URL Source: https://medium.com/@chen.xu.wq/building-a-simple-uniswap-v3-lp-simulator-in-python-bc9ddba1fdfc?source=rss------python-5

Published Time: 2026-04-25T14:22:31Z

Markdown Content:
[Sitemap](https://medium.com/sitemap/sitemap.xml)

[Open in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3DmobileNavBar&source=post_page---top_nav_layout_nav-----------------------------------------)

Sign up

[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40chen.xu.wq%2Fbuilding-a-simple-uniswap-v3-lp-simulator-in-python-bc9ddba1fdfc&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

[](https://medium.com/?source=post_page---top_nav_layout_nav-----------------------------------------)

Get app

[Write](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fnew-story&source=---top_nav_layout_nav-----------------------new_post_topnav------------------)

[Search](https://medium.com/search?source=post_page---top_nav_layout_nav-----------------------------------------)

Sign up

[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40chen.xu.wq%2Fbuilding-a-simple-uniswap-v3-lp-simulator-in-python-bc9ddba1fdfc&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

![Image 1: Unknown user](https://miro.medium.com/v2/resize:fill:32:32/1*dmbNkD5D-u45r44go_cf0g.png)

# Building a Simple Uniswap V3 LP Simulator in Python

[![Image 2: Chen Xu, Ph.D, CFA](https://miro.medium.com/v2/resize:fill:32:32/1*ib5H08uJWY8zlxqZ9fe18w.jpeg)](https://medium.com/@chen.xu.wq?source=post_page---byline--bc9ddba1fdfc---------------------------------------)

[Chen Xu, Ph.D, CFA](https://medium.com/@chen.xu.wq?source=post_page---byline--bc9ddba1fdfc---------------------------------------)

3 min read

·

Apr 25, 2026

[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fvote%2Fp%2Fbc9ddba1fdfc&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40chen.xu.wq%2Fbuilding-a-simple-uniswap-v3-lp-simulator-in-python-bc9ddba1fdfc&user=Chen+Xu%2C+Ph.D%2C+CFA&userId=e137cb7fa81f&source=---header_actions--bc9ddba1fdfc---------------------clap_footer------------------)

--

[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Frepost%2Fp%2Fbc9ddba1fdfc&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40chen.xu.wq%2Fbuilding-a-simple-uniswap-v3-lp-simulator-in-python-bc9ddba1fdfc&user=Chen+Xu%2C+Ph.D%2C+CFA&userId=e137cb7fa81f&source=---header_actions--bc9ddba1fdfc---------------------repost_header------------------)

--

[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fbookmark%2Fp%2Fbc9ddba1fdfc&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40chen.xu.wq%2Fbuilding-a-simple-uniswap-v3-lp-simulator-in-python-bc9ddba1fdfc&source=---header_actions--bc9ddba1fdfc---------------------bookmark_footer------------------)

[Listen](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2Fplans%3Fdimension%3Dpost_audio_button%26postId%3Dbc9ddba1fdfc&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40chen.xu.wq%2Fbuilding-a-simple-uniswap-v3-lp-simulator-in-python-bc9ddba1fdfc&source=---header_actions--bc9ddba1fdfc---------------------post_audio_button------------------)

Share

_Solidity defines protocol truth; Python explores the scenario space._

Press enter or click to view image in full size

![Image 3](https://miro.medium.com/v2/resize:fit:700/1*Z0l3-q9882yBoiyPjcVS-Q.png)

After looking at local price and tick behavior, I realized static intuition was not enough. I needed a small simulator that could run real Uniswap V3 execution repeatedly from controlled baselines. That shaped the design: Solidity for protocol truth, Python for scenario control.

I did not want a hand-written approximation of Uniswap in Py
Read full article → ← Back to Reads