Designed for the B-S architecture requirements of the Web services application module, the implementation provides active function call (REST) and passive data push (Websocket) Web server.
Currently only provides the basic trading and management interface, the user according to their own needs to expand the support for other VeighNa application module Web interface (such as CTA strategy auto-trading, etc.).
The installation environment is recommended to be based on version 3.0.0 or above of [VeighNa Studio].
Use pip command directly:
`` pip install vnpy_webtrader
Or download the source code, unzip it and run it in cmd:
```bash
pip install .
-
Active function call functionality based on Fastapi-Restful implementation, data flow:
- User clicks on a button in the browser to initiate a Restful function call;
- the web server receives the Restful request and converts it into an RPC function call to be sent to the transaction server;
- The transaction server receives the RPC request, executes the specific functional logic, and returns the result;
- the web server returns the result of the Restful request to the browser.
-
Based on the Fastapi-Websocket implementation of the passive data push function, the data flow:
- The event engine of the transaction server forwards an event push and pushes it to the RPC client (Web server). 2;
- the Web server receives the event push, converts it to json format, and sends it out via Websocket;
- the browser receives the pushed data via Websocket and renders it on the Web front-end interface.
-
The main reasons for dividing the program into two processes include:
- the transaction server in the strategy operation and data calculation of the computing pressure is large, need to ensure that as far as possible to ensure low latency efficiency;
- Web server needs to face the Internet access, the transaction-related logic can be separated to better ensure security.