FRE Platform is a framework for students to learn end-to-end development of financial applications. The platform has a 3-tier architecture. The front-end is a Web interface, which support user registration, login/logout and all the user interactions for financial modeling, portfolio management and auto-trading simulation. The middle-tier handles real-time and historical market data feeds and database management. It supports portfolio management, and financial modeling, as well as simulated manual and auto trading. The backend is a server which builds a simulated market for trading. FRE Platform is run as a virtual environment or in a Docker container.
Previously, we use global parameters in some features and it could work because our service logic is in the app.py so we do not need to care about passing parameters.
But in the new structure, I use a list to store all global parameters and because python is passing by reference for non-changeable data structure, so that we can modify those parameters and pass to other functions.
Server notifies app.py once its loading data is done. You could try to remove the server log and monitor it.
By the way, reboot your computer before doing it. As the server is running as a daemon, it is possible still running. In this way, you will not be able to start 2nd server.
Refactor Idea:
Previous problem:
Before, we write all service logic for a specifc RESTful API in the app.py so that we have so many codes in app.py
Optimization Idea:
Structure after refactor:
Additional change:
Previously, we use global parameters in some features and it could work because our service logic is in the app.py so we do not need to care about passing parameters.
But in the new structure, I use a list to store all global parameters and because python is passing by reference for non-changeable data structure, so that we can modify those parameters and pass to other functions.