This project simulates a dynamic token economy with multiple cryptocurrencies, bonding curve mechanisms, and affiliate marketing dynamics. It demonstrates how token prices evolve based on supply/demand through different bonding curves, while affiliates earn commissions and adapt their strategies in real-time.
NumPy
Setup
bash
pip install numpy
Run the simulation with default parameters:
python main.py
Customize the simulation:
python main.py \
--num_simulation_steps 500 \
--num_tokens 8 \
--num_affiliates 10 \
--initial_price 2.0 \
--initial_commission_rate 0.15
| Parameter | Description | Default |
|---|---|---|
--num_simulation_steps |
Total steps to simulate | 100 |
--num_tokens |
Number of distinct tokens | 5 |
--num_affiliates |
Number of affiliates | 5 |
--initial_price |
Starting price for all tokens | 1.0 |
--initial_commission_rate |
Base affiliate commission rate | 0.10 |
INITIAL_SUPPLY = 10000 # Starting token supply
TRANSACTION_FEE_RATE = 0.0025 # 0.25% per trade
BURN_RATE = 0.0002 # 0.02% token burn
COMMISSION_DYNAMICS_STEP = 10 # Commission adjustment interval
WHALE_INVESTMENT_RANGE = (5000, 10000) # Whale capacity bounds
python
# Example exponential curve
price = a * e^(k * supply)Automatic fee deduction and token burns
Bonding Curve Evolution
python
avg_investment > 50 ? rate += 0.0005 : rate -= 0.0005Automatic portfolio rebalancing (5% sell probability/step)
Wallet Management
--- Token Summary ---
Token: Token_3
Final Price: 4.72
Final Supply: 14256.32
Final Bonding Curve: exponential_bonding_curve
--- Affiliate Summary ---
Affiliate: 4
Final Base Currency: 3842.15
Final Commission Rate: 0.1125
Total Earned: 642.78
Browse the source repository