diff --git a/crypto.py b/crypto.py index 741eab6..54ed8ad 100644 --- a/crypto.py +++ b/crypto.py @@ -2,18 +2,21 @@ import random import matplotlib.pyplot as plt # Game parameters -# Start price of coin coin_price = 100.0 price_sensitivity = 0.5 volatility = 0.3 price_history = [coin_price] +trade_history = [0] # User's buy/sell behavior per turn +cumulative_trades = [0] # Net amount of coins user holds over time def save_graph(): plt.clf() - plt.plot(price_history, label="Coin Price") - plt.title("Coin Price Over Time") + plt.plot(price_history, label="Coin Price", color='blue') + plt.plot(trade_history, label="Trade Behavior", color='orange') + plt.plot(cumulative_trades, label="Net Coins Held", color='green') + plt.title("Coin Price, Trade Behavior & Net Holdings Over Time") plt.xlabel("Turn") - plt.ylabel("Price") + plt.ylabel("Value") plt.legend() plt.grid(True) plt.savefig("coin_price.png") @@ -36,7 +39,9 @@ while True: print("⚠️ Please enter a valid number like +10 or -5.") continue - user_intput = 10 + trade_history.append(trade_amount) + new_total = cumulative_trades[-1] + trade_amount + cumulative_trades.append(new_total) buys = trade_amount if trade_amount > 0 else 0 sells = -trade_amount if trade_amount < 0 else 0