VeighNa框架的Web服务模块
说明
针对B-S架构需求设计的Web服务应用模块,实现了提供主动函数调用(REST)和被动数据推送(Websocket)的Web服务器。
目前仅提供了基础的交易和管理接口,用户根据自己的需求扩展支持其他VeighNa应用模块的Web接口(如CTA策略自动交易等)。
安装
安装环境推荐基于4.0.0版本以上的【VeighNa Studio】。
直接使用pip命令:
pip install vnpy_webtrader
或者下载源代码后,解压后在cmd中运行:
pip install .
架构
-
基于Fastapi-Restful实现的主动函数调用功能,数据流程:
- 用户点击浏览器中的某个按钮,发起Restful功能调用;
- Web服务器收到Restful请求,将其转化为RPC功能调用发送给交易服务器;
- 交易服务器收到RPC请求,执行具体的功能逻辑,并返回结果;
- Web服务器返回Restful请求的结果给浏览器。
-
基于Fastapi-Websocket实现的被动数据推送功能,数据流程:
- 交易服务器的事件引擎转发某个事件推送,并推送给RPC客户端(Web服务器);
- Web服务器收到事件推送后,将其转化为json格式,并通过Websocket发出;
- 浏览器通过Websocket收到推送的数据,并渲染在Web前端界面上。
-
将程序分为两个进程的主要原因包括:
- 交易服务器中的策略运行和数据计算的运算压力较大,需要保证尽可能保证低延时效率;
- Web服务器需要面对互联网访问,将交易相关的逻辑剥离能更好保证安全性。
Metadata
Release files for vnpy_webtrader 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vnpy_webtrader-1.1.0.tar.gz | 34.6 kB | Without provenance | Details for vnpy_webtrader-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vnpy_webtrader-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for vnpy_webtrader-1.1.0-py3-none-any.whl |
Total release size: 68.3 kB
Release files / vnpy_webtrader-1.1.0.tar.gz
| Download URL | vnpy_webtrader-1.1.0.tar.gz |
|---|---|
| Size | 34.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
283a6a94af21686562ad803aafbb090157c43980c3e8cea6be65d013cd0f898b
|
|
BLAKE2b-256 checksum How to use checksums |
9efce5d16cd6ce291e069c61ba980d5bda6bd9b20196c50964722f7fb902ac12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.11
|
Release files / vnpy_webtrader-1.1.0-py3-none-any.whl
| Download URL | vnpy_webtrader-1.1.0-py3-none-any.whl |
|---|---|
| Size | 33.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf5b81268767ca20069b2073a32abacfe2eac21c3b09486dec47abc171ff0b16
|
|
BLAKE2b-256 checksum How to use checksums |
4cfc20840168c2f0d538a344c44c5084d5d013a12ec61cf7278aa0c61bf7f7c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.11
|
Security for vnpy_webtrader 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.