Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
wxj0916 committed Mar 1, 2021
1 parent 64ce09e commit ccb18ad
Show file tree
Hide file tree
Showing 8 changed files with 426 additions and 0 deletions.
100 changes: 100 additions & 0 deletions docker/kite/qa-community-rust/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
FROM qa-jupyter_kite2:2.0
#FROM daocloud.io/quantaxis/qa-jupyter:latest
USER root
ENV TZ=Asia/Shanghai
ENV DEBIAN_FRONTEND noninteractive

COPY daily_update /etc/cron.d/daily_update
COPY run-community.sh /root/
COPY runcelery.sh /root/
COPY wait_for_it.sh /root/

RUN cd /root && git clone https://gitee.com/yutiansut/qamazing_community && cd qamazing_community \
&& pip install quantaxis-servicedetect quantaxis-pubsub quantaxis quantaxis_webserver quantaxis_run qifimanager qavifiserver eventlet -U -i https://pypi.doubanio.com/simple\
&& pip uninstall pytdx -y \
&& pip install pytdx -i https://pypi.doubanio.com/simple\
&& pip install qifiaccount QAStrategy -U -i https://pypi.doubanio.com/simple\
&& pip install qgrid -i https://pypi.doubanio.com/simple && pip install "dask[complete]" -i https://pypi.doubanio.com/simple


ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.48.0
#https://cmake.org/files/v3.19/cmake-3.19.0-Linux-x86_64.tar.gz
ARG CMAKE_VERSION=3.19.0
WORKDIR /tmp
RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz \
&& tar xzf cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz \
&& mv cmake-${CMAKE_VERSION}-Linux-x86_64 /usr/local/cmake
RUN apt-get install -y --allow-downgrades zlib1g pkg-config && apt-get install pkg-config libssl-dev -y

RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='49c96f3f74be82f4752b8bffcf81961dea5e6e94ce1ccba94435f12e871c3bdb' ;; \
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='5a2be2919319e8778698fa9998002d1ec720efe7cb4f6ee4affb006b5e73f1be' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='d93ef6f91dab8299f46eef26a56c2d97c66271cea60bf004f2f088a86a697078' ;; \
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e3d0ae3cfce5c6941f74fed61ca83e53d4cd2deb431b906cbd0687f246efede4' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.22.1/${rustArch}/rustup-init"; \
wget "$url"; \
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version;


ENV GOPATH=/root/go
ENV PATH=${GOPATH}/bin:/usr/lib/go-1.15/bin:/usr/local/cmake/bin:${PATH}
ENV PKG_CONFIG_PATH = /usr/local/lib/pkgconfig
ENV LD_LIBRARY_PATH=:${LD_LIBRARY_PATH}:/usr/local/bin:/usr/local/lib
ENV GO111MODULE=on

COPY ./config /root/.cargo/
COPY ./update_future.py /root/QUANTAXIS/config/
RUN set -eux; \
wget https://mirrors.ustc.edu.cn/golang/go1.15.6.linux-amd64.tar.gz; \
apt update --fix-missing; \
apt install -y build-essential libzmq3-dev pkg-config cmake;\
apt-get install -y cron --allow-unauthenticated;\
chmod 0644 /etc/cron.d/daily_update ;\
chmod +x /root/QUANTAXIS/config/update_future.py; \
crontab /etc/cron.d/daily_update; \
echo "set nocp" >> ~/.vimrc && echo "set paste" >> ~/.vimrc && /bin/bash -c "source ~/.vimrc";\
chmod +x /root/run-community.sh;\
chmod +x /root/runcelery.sh && chmod +x /root/wait_for_it.sh;\
tar xvf go1.15.6.linux-amd64.tar.gz ;\
chown -R root:root ./go ;\
mv go /usr/lib/go-1.15;\
go env -w GOPROXY=https://goproxy.cn;\
go get -u github.com/gopherdata/gophernotes;\
cp /root/go/bin/gophernotes /usr/local/bin/ ;\
mkdir -p /root/.local/share/jupyter/kernels/gophernotes ;\
cd /root/.local/share/jupyter/kernels/gophernotes;\
wget https://raw.fastgit.org/gopherdata/gophernotes/master/kernel/kernel.json ;\
wget https://raw.fastgit.org/gopherdata/gophernotes/master/kernel/logo-32x32.png ;\
wget https://raw.fastgit.org/gopherdata/gophernotes/master/kernel/logo-64x64.png ;\
cargo install evcxr_jupyter --force; \
evcxr_jupyter --install;
## clean
## run build for tensorflow 2
ENV GOPROXY=https://goproxy.io
RUN conda install --yes tensorflow
#pip install tornado==5.1.1 -i https://pypi.doubanio.com/simple &&
RUN conda install --yes keras \
&& pip install QAStrategy quantaxis quantaxis_run qifiaccount -U -i https://pypi.doubanio.com/simple

RUN apt-get update && apt-get -y install libcurl4-openssl-dev libssl-dev build-essential net-tools htop\
&& cd /root/ && wget https://github.com/QUANTAXIS/QUANTAXIS/releases/download/1.10.2/portfoliohandler\
&& chmod +777 /root/portfoliohandler
RUN mkdir -p ~/.kite/libraries \
&& ln -s /opt/conda/lib/python3.8/site-packages ~/.kite/libraries
WORKDIR /root
EXPOSE 80 8010 8787 8020 8029 8018 8019 8028
CMD ["/bin/bash", "/root/run-community.sh"]
18 changes: 18 additions & 0 deletions docker/kite/qa-community-rust/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'tuna'

[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"


[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"


[source.sjtu]
registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"


[source.rustcc]
registry = "https://code.aliyun.com/rustcc/crates.io-index.git"
1 change: 1 addition & 0 deletions docker/kite/qa-community-rust/daily_update
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18 18 * * mon-fri root /root/QUANTAXIS/config/update_future.py > /proc/1/fd/1 2>/proc/1/fd/2
8 changes: 8 additions & 0 deletions docker/kite/qa-community-rust/run-community.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

sed -i "s|localhost|$MONGODB|" /opt/conda/lib/python3.8/site-packages/QUANTAXIS/QAUtil/QASetting.py

jupyter lab --allow-root --notebook-dir=/root --config /root/.jupyter/jupyter_notebook_config.py &
exec "$@"

cd /root/qamazing_community && python -m http.server 80
13 changes: 13 additions & 0 deletions docker/kite/qa-community-rust/runcelery.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
echo 'start backend & celery'
echo $MONGODB
echo $QARUN_AMQP
#cat /entrypoint.sh

quantaxis_webserver &
qifi_manager &
qavifiserver &
/root/portfoliohandler &

echo 'start quantaxis_run job worker'
celery -A quantaxis_run worker --loglevel=info
59 changes: 59 additions & 0 deletions docker/kite/qa-community-rust/update_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/opt/conda/bin/python

#coding :utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2021 yutiansut/QUANTAXIS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

"""对应于save all"""

from QUANTAXIS.QASU.main import (QA_SU_save_etf_day, QA_SU_save_etf_min,
QA_SU_save_financialfiles,
QA_SU_save_index_day, QA_SU_save_index_min,
QA_SU_save_stock_block, QA_SU_save_stock_day,
QA_SU_save_stock_info,
QA_SU_save_stock_info_tushare,
QA_SU_save_stock_list, QA_SU_save_stock_min,
QA_SU_save_stock_xdxr)
from QUANTAXIS.QASU.save_binance import (QA_SU_save_binance_symbol,
QA_SU_save_binance_1hour,
QA_SU_save_binance_1day,
QA_SU_save_binance_1min,
QA_SU_save_binance)
from QUANTAXIS.QASU.save_bitmex import (QA_SU_save_bitmex_symbol,
QA_SU_save_bitmex_day)
from QUANTAXIS.QASU.save_huobi import (QA_SU_save_huobi_symbol,
QA_SU_save_huobi_1hour,
QA_SU_save_huobi_1day,
QA_SU_save_huobi_1min,
QA_SU_save_huobi)

QA_SU_save_stock_day('tdx')
QA_SU_save_stock_xdxr('tdx')
# QA_SU_save_stock_min('tdx')
QA_SU_save_index_day('tdx')
# QA_SU_save_index_min('tdx')
# QA_SU_save_etf_day('tdx')
# QA_SU_save_etf_min('tdx')
QA_SU_save_stock_list('tdx')
QA_SU_save_stock_block('tdx')
# QA_SU_save_stock_info('tdx')
49 changes: 49 additions & 0 deletions docker/kite/qa-community-rust/update_future.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/opt/conda/bin/python

#coding :utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2021 yutiansut/QUANTAXIS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from QUANTAXIS.QASU.main import (QA_SU_save_etf_day, QA_SU_save_etf_min,
QA_SU_save_financialfiles,
QA_SU_save_index_day, QA_SU_save_index_min,
QA_SU_save_stock_block, QA_SU_save_stock_day,
QA_SU_save_stock_info,
QA_SU_save_stock_info_tushare,
QA_SU_save_stock_list, QA_SU_save_stock_min,
QA_SU_save_stock_xdxr,QA_SU_save_single_index_day,
QA_SU_save_option_50etf_day,QA_SU_save_option_50etf_min,
QA_SU_save_option_300etf_day,QA_SU_save_option_300etf_min,
QA_SU_save_option_commodity_day,QA_SU_save_option_commodity_min,
QA_SU_save_future_day,QA_SU_save_future_day_all,QA_SU_save_future_min,QA_SU_save_future_min_all)


QA_SU_save_future_min('tdx')
QA_SU_save_future_day('tdx')
QA_SU_save_option_50etf_day('tdx')
QA_SU_save_option_50etf_min('tdx')
QA_SU_save_option_300etf_day('tdx')
QA_SU_save_option_300etf_min('tdx')
QA_SU_save_option_commodity_day('tdx')
QA_SU_save_option_commodity_min('tdx')
QA_SU_save_single_index_day('000300','tdx')
Loading

0 comments on commit ccb18ad

Please sign in to comment.