#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
用户: {{username}}
Web进程启动脚本 - 启动FastAPI Web服务
"""

from vnpy_webtrader import run_web_trader

def main():
    # RPC连接地址（连接本地交易进程
    rpc_request_port = {{rpc_request_port}}
    rpc_subscribe_port = {{rpc_subscribe_port}}
    web_port = {{web_port}}
    
    rpc_request_address = f"tcp://127.0.0.1:{rpc_request_port}"
    rpc_subscribe_address = f"tcp://127.0.0.1:{rpc_subscribe_port}"
    
    print(f"[{username}] Web服务启动")
    print(f"- RPC请求: {rpc_request_address}")
    print(f"- RPC订阅: {rpc_subscribe_address}")
    print(f"- Web端口: {web_port}")
    
    run_web_trader(
        rpc_request_address,
        rpc_subscribe_address,
        host="127.0.0.1",
        port=web_port,
        cors_allow_all=True
    )

if __name__ == "__main__":
    main()
