Giter VIP home page Giter VIP logo

stock-market-simulation-engine's Introduction

APIs:

  1. CRUD on meta data for companies | Not for users | Private API
  2. Read API on stock prise of a company | For users | Public API This API has to update the base prise using some formula.

Frontend:

  1. Using Read API, show charts of prise changing for each company.

Todo 3|1|23:

Am able to make the companies but there is some problem with editing the companies. I have sem exam on 7|3|23. I will continue again from that day.

image

  • Solved on 7|1|23

Todo 9|1|23 | Find out the idea

  • The adding companies part, private API.
  • how I can simulate the data in backend every 1 or 2 seconds once a request is made for a company s stock and stream it to the frontend.
  • Then will look to consume it in frontend using some chart library, have made some research on found some libraries, have to try them out!

Create a socket endpoint:

mix phx.gen.socket Stock_exchange

create a channel:

mix phx.gen.channel Company

Websockets:

Request -> Socket -> Channel -> Topic -> Response

image

Backend features:

  • Continously streaming data from backend to frontend using websockets.
  • Get company_id through request.
  • Using company_id, interact with DB.
  • Before streaming data to client, change the data from db and send to client. Getting data from DB has to be done only once to improve performance.
  • Add/Assign company_id and stock_prise to socket state so that it can be passed around within phoenix callbacks/handlers.
  • Change stock prise in a unpredictable way and stream t0 client

Frontend features:

  • Setup flutter and its environment

  • Learn how to setup flutter client for websocket

  • Consume Phoenicx websocket APIs

  • Decide how to stream the incoming data in chart form

  • [ ]

  • Messages that do not come from GenServer.call/2 or GenServer.cast/2 are handled by the handle_info/2 callback.

16|01|23 || 09:02 PM

  • Ideally using company_id, i will get the stock_prise from db in handle_in and send only this stock_prise data to handle_info. That would be best!

16|01|23 || 09:27 PM

  • Done, making DB request once in handle, getting the stock_prise, assigning it to socket state, calling a timer, all these in handle_in. In handle_info just pushing the stock_prise to client. Handle_info is called every 2 seconds by the timer in handle_in.

16|01|23 || 11:01 PM

  • All backend features done 🕉️.

stock-market-simulation-engine's People

Contributors

akshay1027 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.