Skip to main content

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实现的主动函数调用功能,数据流程:

    1. 用户点击浏览器中的某个按钮,发起Restful功能调用;
    2. Web服务器收到Restful请求,将其转化为RPC功能调用发送给交易服务器;
    3. 交易服务器收到RPC请求,执行具体的功能逻辑,并返回结果;
    4. Web服务器返回Restful请求的结果给浏览器。
  • 基于Fastapi-Websocket实现的被动数据推送功能,数据流程:

    1. 交易服务器的事件引擎转发某个事件推送,并推送给RPC客户端(Web服务器);
    2. Web服务器收到事件推送后,将其转化为json格式,并通过Websocket发出;
    3. 浏览器通过Websocket收到推送的数据,并渲染在Web前端界面上。
  • 将程序分为两个进程的主要原因包括:

    1. 交易服务器中的策略运行和数据计算的运算压力较大,需要保证尽可能保证低延时效率;
    2. Web服务器需要面对互联网访问,将交易相关的逻辑剥离能更好保证安全性。

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)

Source distribution for vnpy_webtrader 1.1.0
File Size Uploaded
vnpy_webtrader-1.1.0.tar.gz 34.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vnpy_webtrader 1.1.0
File Interpreter ABI Platform
vnpy_webtrader-1.1.0-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page