# Virtual Energy Trading App ## (Questionable) Design Decisions This is just a section to state that I am aware these design decisions are questionable and not good practices. These decisions were made for the sake of simplicity and ease of development. ### Authentication There is no real-authentication implemented. There is a dummy user in the database, and all the bids are attached to this user. On the web-interface, there is no login functionality. All bids are submitted as if they were made by the dummy user. In production, rather than specifying the user ID as part of the bid, the backend should authenticate the user and associate the bid with the authenticated user's ID. ### Bid Management Currently there is a cron job running every hour to check the bids in the database and then process them. In this process the market data is fetched in real-time from the gridstatus API. Ideally, the database is updated with the latest market data before processing the bids. That way the cron job can simply process the bids. ### Timezones Everything is handled as UTC + Offset. Submit bid page shows the current time in the user's timezone as well as the timezone for the market. Everything else is displayed in UTC for now. ## Project Structure ``` /client # React Frontend /server # Python Backend /tests # Tests if I ever get to them ``` ## Backend ### FastAPI Server #### Market Data Service * Fetch from GridStatus API * Real-time prices * Day-ahead market prices * Load/demand data * API Endpoints * `GET /market/day-ahead` * `GET /market/real-time` * `GET /market/load` #### Bid Management * API Endpoints * `POST /bids` * `GET /bids` * `DELETE /bids/{bid_id}` #### Profit et Loss Simulation * API Endpoints * `GET /trader/pnl`