Skip to content

haifengat/ctp_real_md

Repository files navigation

tick_from_ctp

项目介绍

使用ctp api接收行情生成实时分钟数据保存到redis

Dockerfile

FROM haifengat/centos:8.2
COPY *.py /home/
COPY *.txt /home/
# docker-compose
COPY *.yml /home/
# COPY pgdata.tgz /home/ 改用csv
COPY *.csv /home/
RUN pip install --no-cache-dir -r /home/requirements.txt
ENV redis_addr 172.19.129.98:16379
ENV front_trade tcp://180.168.146.187:10101
ENV front_quote tcp://180.168.146.187:10111
ENV login_info 008105/1/9999/simnow_client_test/0000000000000000
ENTRYPOINT ["python", "/home/tick_ctp.py"]
version: "3.7"
services:
    real_md:
    image: haifengat/ctp_real_md
    container_name: real_md
    restart: always
    environment:
        - "TZ=Asia/Shanghai"
        - "redis_addr=redis_tick:6379"
        - "front_trade=tcp://180.168.146.187:10101"
        - "front_quote=tcp://180.168.146.187:10111"
        - "login_info=008105/1/9999/simnow_client_test/0000000000000000"
    depends_on:
        - redis_tick

    redis_tick:
        image: redis:6.0.8-alpine3.12
        container_name: redis_tick
        restart: always
        environment:
            - TZ=Asia/Shanghai
        # ports:
        #     - "16379:6379"

build

# 通过github git push触发 hub.docker自动build
docker pull haifengat/ctp_real_md && docker tag haifengat/ctp_real_md haifengat/ctp_real_md:`date +%Y%m%d` && docker push haifengat/ctp_real_md:`date +%Y%m%d`

docker-compose.yaml

version: '3.1'
services:
  real_md:
    image: haifengat/ctp_real_md
    container_name: real_md
    restart: always
    environment:
      - "TZ=Asia/Shanghai"
      - "redis_addr=redis_tick:6379"
      - "front_trade=tcp://180.168.146.187:10101"
      - "front_quote=tcp://180.168.146.187:10111"
      - "login_info=008105/1/9999/simnow_client_test/0000000000000000"
    depends_on:
      - redis_tick

  redis_tick:
    image: redis:6.0.5
    container_name: redis_tick
    restart: always
    environment:
      - TZ=Asia/Shanghai
    ports:
      - "16379:6379"   

使用

查看redis数据

$ docker exec -it redis_tick bash
>> redis-cli
>>> keys *
>>> lrange ${instrument} 0 -1

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published