GithubHelp home page GithubHelp logo

pyctp / apt-fast Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ilikenwf/apt-fast

0.0 0.0 0.0 207 KB

apt-fast: A shellscript wrapper for apt that speeds up downloading of packages.

Home Page: http://www.mattparnell.com/projects/apt-fast-and-axel-roughly-26x-faster-apt-get-installations-and-upgrades.html

License: GNU General Public License v3.0

Shell 94.82% Makefile 5.18%

apt-fast's Introduction

pyctp

ctp wrapper for python

简介

(仅仅只是)对于CTP API的Python封装(使用时遇到问题可以在Issues中反馈,但不要咨询实际的交易事项,因为我没实践过╮(╯_╰)╭

CTP版本:futures目录是期货版(包括win32、linux32、linux64),option目录是期权版(包括win32、linux32、linux64),stock目录是linux64股票版,stock2目录是win32股票版

环境:python2.5 ~ python3.4,Windows或者Linux

编译:在本目录或者分别进入futures、option、stock/stock2目录执行python setup.py build

安装: 在本目录编译后复制build/lib.xxx-x.x目录下的ctp目录到site-packages目录:

# 通过以下方式使用期货版API
from ctp.futures import ApiStruct, MdApi, TraderApi
# 通过以下方式使用股票版API
from ctp.stock import ApiStruct, MdApi, TraderApi

或者进入futures或option、stock/stock2子目录python setup.py build编译后python setup.py install安装:

# 通过以下方式使用期货/股票版API
from ctp import ApiStruct, MdApi, TraderApi

推荐使用第一种方式。

关于代码风格

本项目只是对于CTP api的封装,大部分代码是生成并非手写,api是给人用而不是给人欣赏内部如何实现的,实用性才是第一考虑:

  • 一套代码支持Python2.5 ~ Python3.x多个版本,直接python setup.py build即可编译,不强求特定Python版本或者复杂配置;
  • 干净的模块空间,除了__author__、__version__等特殊Python变量,模块中其他变量与API头文件中的符号一一对应;
  • 简洁清晰的注释,每个函数、枚举、typedef、结构体的注释都与API头文件一致,并且标明结构体每个成员的实际基础类型;
  • 结构体和函数参数支持IDE自动补全,并且自动补全时可知道每个参数是字符串、int还是float类型,默认值与提示值一致。

如何配合原版pyctp使用

  • 如果在Windows下使用,首先需要安装与Python对应的VS,例如Python2.6 ~ Python3.2可以安装一个VC++ 2008 Express;如果在Linux下使用,安装好GCC;
  • 在本目录执行python setup.py build进行编译;
  • 编译后复制build/lib.xxx-x.x目录下的ctp目录到example目录下(如果使用Windows + Python2.7,这3步都可以跳过,因为example目录下已有的ctp就是这个环境下编译的);
  • 按照原版pyctp的配置说明对example/config目录下的文件进行配置;
  • 通过example/main.py加参数运行。

通过以上步骤可知,这里基本上只是对原版安装指南进行了替换;

Windows下除了编译需要安装VC++ 2008 Express外,直接使用已编译好的貌似是不需要安装的。

apt-fast's People

Contributors

agultiga avatar alanhoff avatar burnfaker avatar cartoonist avatar chrstphrchvz avatar dawez avatar dityaaa avatar doherty avatar foxx avatar fusion809 avatar gothicvi avatar guekho64 avatar hunter-richardson avatar ilikenwf avatar lasall avatar lordloh avatar maclarke avatar nobodyxu avatar nthykier avatar peterdavehello avatar saiarcot895 avatar sammcj avatar sandpox avatar shlomif avatar techgaun avatar teymourlouie avatar tritiatedwater avatar varhub 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.