Giter VIP home page Giter VIP logo

ctp-rs's Introduction

ctp-rs

CTP sdk version: 6.3.15_20190220 15:47:00

*.hpp and *.cpp are generated by autobind.py, then processed by rust_bindgen. Look at xtp-rs for detail.

Use at your own risk. The crate is unsafe, look at examples/tdapi.rs and examples/mdapi.rs for how to use it.

How to use autobind.py

If you want to generate wrapp.hpp by yourself or wrapper similar apis. You can put your header files in shared/include like I did. Then run

python3 -m pip install libclang
python3 autobind.py > src/wrapper_ext

Those cpp code are included in src/wrapper.hpp, where you can add your custom functions.

Then the rust_bindgen will generate rust extern "C" func_XXX function declarations. Since then all api function should be usable.

There are lots of extern "C" Rust_XXX_Trait_On_XX function inside wrapper_ext, which are colloceted in build.rs to generate nice trait object. Remove it in autobind.py if you don't want it.

where to put my .so files

XXX.so files are not included, please put it like this to satify compiler:

$ tree shared

shared
├── data_collect
│   ├── unix.x86_64
│   │   ├── libLinuxDataCollect.so -> LinuxDataCollect.so
│   │   └── LinuxDataCollect.so
│   ├── windows.x86
│   │   ├── WinDataCollect.dll
│   │   └── WinDataCollect.lib
│   └── windows.x86_x64
│       ├── WinDataCollect.dll
│       └── WinDataCollect.lib
├── include
│   ├── DataCollect.h
│   ├── ThostFtdcMdApi.h
│   ├── ThostFtdcTraderApi.h
│   ├── ThostFtdcUserApiDataType.h
│   └── ThostFtdcUserApiStruct.h
├── md
│   ├── unix.x86_64
│   │   ├── libthostmduserapi_se.so -> thostmduserapi_se.so
│   │   └── thostmduserapi_se.so
│   ├── windows.x86
│   │   ├── thostmduserapi_se.dll
│   │   └── thostmduserapi_se.lib
│   └── windows.x86_x64
│       ├── thostmduserapi_se.dll
│       └── thostmduserapi_se.lib
└── td
    ├── unix.x86_64
    │   ├── libthosttraderapi_se.so -> thosttraderapi_se.so
    │   └── thosttraderapi_se.so
    ├── windows.x86
    │   ├── thosttraderapi_se.dll
    │   └── thosttraderapi_se.lib
    └── windows.x86_x64
        ├── thosttraderapi_se.dll
        └── thosttraderapi_se.lib

ctp-rs's People

Contributors

sheldonnico avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.