plt.figure(figsize=(10,5))
plt.plot(data[‘date’],data[‘price’],label=’价格趋势’)
plt.title(‘黑暗使者装备价格走势’)
plt.xlabel(‘日期’)
plt.ylabel(‘价格(钻石)’)
plt.legend()
plt.show()
importrandom
defsimulate_market_balance(days):
prices=
for_inrange(days):
price=random.uniform(300,1000)价格波动范围
ifrandom.random()< 0.1: 活动影响概率
price=1.5
prices.append(price)
returnprices
days=30
prices=simulate_market_balance(days)
print(f”模拟{days}天价格波动:{prices}”
importnumpyasnp
defpredict_future_prices(current_price,days):
trend=np.random.normal(0,100,days)趋势波动
prices=[current_price]
for_inrange(days):
new_price=prices+trend[_]
prices.append(new_price)
returnprices
current_price=500
days=60
prices=predict_future_prices(current_price,days)
print(f”未来{days}天价格预测:{prices}”