Behavioral-Economics-Simulator

Behavioral-Econ-Simulator

Repository URL: https://github.com/SriyaKatikela/Behavioral-Econ-Simulator

🌍 Overview

The Behavioral Economics Simulator models the decisions of agents (consumers/investors) influenced by psychological biases in a dynamic, simplified market environment. It challenges traditional rational-choice theory by integrating behavioral economic principles into the logic of decision-making.

The simulator is a learning tool designed to show how irrational choices can cause unexpected and realistic effects like bubbles, panics, and stagnation.


đź§  Why Behavioral Economics?

Traditional economics assumes humans are rational and make perfect decisions that maximize utility with perfect logic and information. However, in reality, human decisions are bounded by emotion, cognitive shortcuts (heuristics), and social influence.

Behavioral economics studies those deviations. This simulator demonstrates key ideas:

🌍 Conceptual Overview (Non-Code Explanation)

This simulator is a simplified, educational market model where agents are people with different psychological traits. Each agent makes buying/selling decisions based on emotions and biases like loss aversion, herd behavior, and overconfidence. The goal is to show how those individual decisions combine to create group-level outcomes like bubbles, crashes, or surprising stability.


đź§Ş Step-by-Step: How the Simulation Works (High-level)

  1. Create the world — a virtual market and a set of agents (commonly 50–100).
  2. Give each agent a personality — initial money, risk tolerance, and bias levels.
  3. Each simulated day, agents look at each available stock and decide to buy, sell, or hold.
  4. The market adjusts prices based on the total buying/selling pressure, with a bit of randomness to mimic real markets.
  5. Optional events (news, rumors) can shock the market and change how agents feel.
  6. After N days, the simulator produces results that show how behavior influenced the market and who won or lost.

🔎 How the Agent Works

Each agent represents an individual investor. Important things to know (without reading code):

Decision rules (simple summary):

How much to buy or sell is scaled by the agent’s confidence, risk tolerance, and the size of their holdings or cash.

Behavioral intent:


đź’Ľ The Portfolio

The Portfolio is the part of the simulation that keeps track of what an agent actually owns and how much cash they have. Think of it like a wallet + list of investments for each person.

What a Portfolio holds

What a Portfolio can do

Why Portfolio matters for the simulation


đź”— How Portfolio and Agent Interact

  1. The Agent decides to buy or sell a particular stock.
  2. The Agent asks their Portfolio to execute that buy or sell.
  3. The Portfolio checks cash or holdings and either completes the trade or refuses it.
  4. If the trade completes, the Portfolio updates the agent’s cash and holdings.
  5. Later, portfolio values are used to see who profited and how behavior affected wealth.

Daily Simulation Loop

For N simulated days, the following steps repeat:

a. Update Stock Prices

b. Agents Analyze the Market

c. Agents Decide What to Do

d. Agents Act

e. Record Results


End of Simulation


Example Stock Data:

Format: Stock Ticker, Price, Volatility


⚙️ Practical Notes & Suggestions (non-technical)


How to Run

  1. Prepare two files:
    • stocks.txt: Stock ticker, price, volatility.
    • agents.txt: List of names (one per line).
  2. Set simulation parameters (number of agents, number of days, starting cash).
  3. Run the program.
  4. Observe market and portfolio changes over time.

Output

At the end, you’ll see:

Example Output:

’=== Market Status: Day 1 of 3 ===

STOCK | PRICE | Δ% | VOL%

AAPL | $197.08 | 0.0 | 0.01

TSLA $237.59 -3.0 0.04
AMZN $133.88 +1.0 0.02
NFLX $453.38 +1.0 0.03
JPM $154.76 -1.0 0.01
GOOGL $131.12 0.0 0.02
MSFT $422.81 +1.0 0.01
NVDA $121.09 0.0 0.03
META $313.7 -1.0 0.02
BA $176.19 0.0 0.02

Top Gains: AMZN (+0.01%), NFLX (+0.01%), MSFT (+0.01%) Top Losses: TSLA (-0.03%), META (-0.01%), JPM (-0.01%)

AGENT DECISIONS AND SUMMARIES:

Bob:


📚 Educational Use Cases

This simulator is perfect for:


đź“„ License

MIT License — open-source and available for educational or non-commercial use.


README generated with the assistance of AI (ChatGPT) to enhance clarity and structure.