Skip to content

上海期货技术 CTP 接口 rust 原生封装,支持生产,测评,股票期权, OpenCTP, LocalCTP 版本, 适配 Windows, Linux, MacOS

License

Notifications You must be signed in to change notification settings

pseudocodes/ctp2rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ask DeepWiki Crates.io Version

Ctp2rs

上海期货信息技术公司 CTP/CTP-Mini/CTP-Sopt 接口 rust 语言原生封装

Features

  • 支持生产,测评,CTP-Mini, CTP-Sopt 股票期权, OpenCTP, LocalCTP 等兼容 CTP 接口的动态库版本, 适配 Windows, Linux, MacOS
  • 采用 libloading 加载动态库,通过程序配置可以轻松切换不同柜台环境
  • 编译指令自动切换 ctp 版本
  • 保持与原生 ctp 接口一致的调用方式,更方便跨语言的项目转写
  • 较为灵活的 codegen 脚本,方便开发者生成自己的封装接口

Installation

To add the crate to an existing project, run the following command:

cargo add ctp2rs

Usage

#[cfg(target_os = "macos")]
let dynlib_path = "../../ctp-dyn/api/ctp/v6.7.2/v6.7.2_MacOS_20231016/thostmduserapi_se.framework/thostmduserapi_se";

#[cfg(target_os = "linux")]
let dynlib_path = "../../ctp-dyn/api/ctp/v6.7.2/v6.7.2_20230913_api_traderapi_se_linux64/thostmduserapi_se.so";

#[cfg(target_os = "windows")]
let dynlib_path = "../../ctp-dyn/api/ctp/v6.7.2/v6.7.2_20230913_api_traderapi64_se_windows/thostmduserapi_se.dll"

let mdapi = MdApi::create_api(dynlib_path, "./md_", false, false);
...    

更具体的使用内容请参考 ctp-dyn 目录下文档

Examples

See /examples for various uses of Ctp2rs. You can run them with:

cargo run --example <example>

open-md-gateway

多源行情网关的实现 open-md-gateway

通过对 QAMD Gateway 进行重构,简化对 ctp 库的依赖和构建

Associative Project

对应 Go 语言封装项目 Go2ctp

Acknowledgments

@ZerounNet: Windows 开发环境适配

免责声明

本项目明确拒绝对产品做任何明示或暗示的担保。由于软件系统开发本身的复杂性,无法保证本项目完全没有错误。如选择使用本项目表示您同意错误和/或遗漏的存在,在任何情况下本项目对于直接、间接、特殊的、偶然的、或间接产生的、使用或无法使用本项目进行交易和投资造成的盈亏、直接或间接引起的赔偿、损失、债务或是任何交易中止均不承担责任和义务。

About

上海期货技术 CTP 接口 rust 原生封装,支持生产,测评,股票期权, OpenCTP, LocalCTP 版本, 适配 Windows, Linux, MacOS

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy