Score
0
Watch 20 Star 34 Fork 0

涩女郎 / ctp_redisC++

Join us
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
使用Redis做内存数据库,做期货策略交易; 行情自动订阅; 报单从Redis队列获取向上报单; spread retract

Clone or download
Loading...
README.md

ctp_Redis

注意: 以后本系统将第一时间在github上更新,请大家关注此处。

依赖

ctp_redis依赖hiredis、xredis在使用xredis前需要安装hiredis库; 安装部署:

  1. redis 3.2版本;
  2. redis 3.2目录dep下hiredis;
  3. xredis开源软件,目前使用自己修改版本; xredis 使用了自己修改过的版本,RedisNode可配置; 默认安装即可;
make&sudo make install

编译

  • 把amake和pump工具放到环境变量;
  • 编译前需要先设置环境变量;
cat ~/.bash_profile
LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:.
export LD_LIBRARY_PATH
C_INCLUDE_PATH=/usr/include:/usr/local/include:/usr/local/include:/usr/local/include/zookeeper
export C_INCLUDE_PATH

CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include:/usr/local/include:/usr/local/include/hiredis:/usr/local/include/zookeeper:/usr/local/include/xredis
export CPLUS_INCLUDE_PATH

启动

# start market
./market
# start trade
./trade
# start plot
./plot GroupA 1
./plot GroupB 2
./plot GroupB 3

系统架构

ctp_redis

功能点

  • 多环境支持;
  • trade 报单接口, market 行情转换, plot 策略进程;
  • plot [组别] [唯一标记],组别用于一个策略组的主备,一个组只有一个主,其它同步进行,只接受,不发送, 在主进程宕掉后,其它进程竞争为主后进行发送;
  • 唯一标识用于标识进程所在主机位置;
  • 使用lrange使性能达到报单240000笔/秒;
  • 支持配置多账号交易;

TODO

  • json和struct序列化互转实现;
  • 策略前置、路由、主备与灾备考虑;
  • 策略前端展现;

相关功能

[Simnow](http://www.simnow.com.cn/)注册网站;

[Redis](http://redis.io/)下载地址;

作者:showmsg

QQ群:12277157,群内提供架构设计,环境加群讨论。

感谢:

[xredis](https://github.com/0xsky/xredis)

[ctpService](https://coding.net/u/laozhu_zzy)

感谢其它C++开源常用库的贡献者!!!

捐赠作者:[支付宝账号] showmsg@163.com

Comments ( 1 )

Sign in for post a comment

C++
1
https://gitee.com/showmsg/ctp_redis.git
git@gitee.com:showmsg/ctp_redis.git
showmsg
ctp_redis
ctp_redis
master

Help Search