From f52782c4dccc3f2330d9dcd14ba4e3cf0522f8cf Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sun, 27 Apr 2025 21:17:16 -0600 Subject: add design decisions --- README.md | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 6484c9d..4921d35 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,25 @@ # 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. + +### Caching + +In production, rather than calling the gridstatus API to get the market data, the backend should cache the data locally and update it periodically. + +Also, rather than using the simple in-memory cache, the backend should use a more robust caching mechanism such as Redis or Memcached. + +### 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. + ## Project Structure ``` @@ -34,6 +54,3 @@ * API Endpoints * `GET /trader/pnl` - - - -- cgit v1.2.3