-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
63 lines (51 loc) · 1.71 KB
/
Copy pathrun.py
File metadata and controls
63 lines (51 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import asyncio
import matplotlib.pyplot as plt
from autogen_agents import DataDAOGroupChat
from config import CONFIG
async def main():
# Initialize the simulation
sim = DataDAOGroupChat(CONFIG)
# Run the simulation
await sim.simulate(CONFIG['SIM_CONFIG']['total_steps'])
# Get simulation data
sim_data = sim.get_simulation_data()
# Create figure with subplots
plt.figure(figsize=(15, 10))
# Price over time
plt.subplot(2, 2, 1)
plt.plot(sim_data['price'])
plt.title('dDT Price Over Time')
plt.xlabel('Step')
plt.ylabel('Price (xDAI)')
# LP Reserves over time
plt.subplot(2, 2, 2)
plt.plot(sim_data['lp_dDT_reserve'], label='dDT')
plt.plot(sim_data['lp_xDAI_reserve'], label='xDAI')
plt.title('LP Reserves Over Time')
plt.xlabel('Step')
plt.ylabel('Amount')
plt.legend()
# xDAI balances over time
plt.subplot(2, 2, 3)
agent_types = ['degen_user', 'organization', 'power_user', 'active_user', 'casual_user']
for agent_type in agent_types:
plt.plot(sim_data[f'xdai_{agent_type}'], label=agent_type)
plt.title('Average xDAI Holdings per Agent Type')
plt.xlabel('Step')
plt.ylabel('xDAI per Agent')
plt.legend()
# Agent counts over time
plt.subplot(2, 2, 4)
for agent_type in agent_types:
plt.plot(sim_data[f'active_{agent_type}s'], label=agent_type)
plt.title('Agent Counts Over Time')
plt.xlabel('Step')
plt.ylabel('Count')
plt.legend()
plt.tight_layout()
# Save the plot
plt.savefig('simulation_results.png', dpi=300, bbox_inches='tight')
# Display the plot
plt.show()
if __name__ == "__main__":
asyncio.run(main())