-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.py
41 lines (32 loc) · 1004 Bytes
/
main.py
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
from simulation import simulator
from utils import utils
from typing import List
import numpy as np
import matplotlib.pyplot as plt
def main():
df: dict = utils.read_config('config.json')
times: int = df['times']
period: int = df['period']
prices = np.zeros((times, period))
fig = plt.figure()
print('Now simulating...')
for i in range(0, times):
sim = simulator.Simulator(df)
# generate productivity
sim.calc_productivity()
# generate utility
sim.calc_utility()
# simulate price
for t in range(0, period):
sim.calc_userbase_and_threshold(t)
sim.calc_aggregate_transaction_need(t)
sim.calc_price(t)
prices[i] = sim.price
plt.plot(sim.price)
print(prices)
plt.title('Utility Token Price Per Time Point')
plt.xlabel('time')
plt.ylabel('price')
fig.savefig('glaph.png')
print('Simulation finished. Price glaph is output.')
main()