Skip to content

Commit

Permalink
Merge pull request #1386 from yutiansut/master
Browse files Browse the repository at this point in the history
更新了财务数据更新算法 以及其他的docker文件的更新
  • Loading branch information
yutiansut authored Jan 9, 2020
2 parents b24b485 + 2e47fcd commit 2bae56e
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 9 deletions.
15 changes: 9 additions & 6 deletions QUANTAXIS/QASU/save_financialfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,24 @@ def QA_SU_save_financial_files():

date = int(item.split('.')[0][-8:])
print('QUANTAXIS NOW SAVING {}'.format(date))
if coll.find({'report_date': date}).count() < 3600:

print(coll.find({'report_date': date}).count())
print('在数据库中的条数 {}'.format(coll.find({'report_date': date}).count()))
try:
data = QA_util_to_json_from_pandas(parse_filelist([item]).reset_index(
).drop_duplicates(subset=['code', 'report_date']).sort_index())
print('即将更新的条数 {}'.format(len(data)))
# data["crawl_date"] = str(datetime.date.today())
try:
coll.insert_many(data, ordered=False)
for d in data:
coll.update_one({'code': d['code'], 'report_date': d['report_date']}, {'$set': d}, upsert=True)

except Exception as e:
if isinstance(e, MemoryError):
coll.insert_many(data, ordered=True)
elif isinstance(e, pymongo.bulk.BulkWriteError):
pass
else:
print('ALL READY IN DATABASE')
except Exception as e:
print('似乎没有数据')



print('SUCCESSFULLY SAVE/UPDATE FINANCIAL DATA')
2 changes: 1 addition & 1 deletion QUANTAXIS/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
2017/4/8
"""

__version__ = '1.7.1'
__version__ = '1.7.3'
__author__ = 'yutiansut'

import argparse
Expand Down
4 changes: 4 additions & 0 deletions docker/qa-community-go-r/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ RUN set -eux; \
cargo install evcxr_jupyter --force; \
evcxr_jupyter --install;

RUN echo "set nocp" >> ~/.vimrc && echo "set paste" >> ~/.vimrc && /bin/bash -c "source ~/.vimrc"

RUN chmod +x /root/run-community.sh
CMD ["bash", "/root/run-community.sh"]

WORKDIR /home

EXPOSE 80
EXPOSE 8787
2 changes: 1 addition & 1 deletion docker/qa-community-go-r/run-community.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

sed -i "s|localhost|$MONGODB|" /opt/conda/lib/python3.7/site-packages/QUANTAXIS/QAUtil/QASetting.py
jupyter lab --allow-root --config /root/.jupyter/jupyter_notebook_config.py &
jupyter lab --allow-root --notebook-dir=~ --config /root/.jupyter/jupyter_notebook_config.py &
cd /root/QADESK_BASIC && python -m http.server 80
2 changes: 2 additions & 0 deletions docker/qa-community-r/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ RUN chmod +x /opt/conda/lib/python3.7/site-packages/QUANTAXIS/QAUtil/QASetting.p
RUN chmod +x /root/run-community.sh
CMD ["bash", "/root/run-community.sh"]

WORKDIR /home

EXPOSE 80
1 change: 1 addition & 0 deletions docker/qa-community/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ RUN chmod +x /root/run-community.sh
CMD ["bash", "/root/run-community.sh"]

EXPOSE 80
EXPOSE 8787
2 changes: 1 addition & 1 deletion docker/qa-community/run-community.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

sed -i "s|localhost|$MONGODB|" /usr/local/lib/python3.6/site-packages/QUANTAXIS/QAUtil/QASetting.py
jupyter lab --allow-root &
jupyter lab --allow-root --notebook-dir=~ &
cd ~/QADESK_BASIC && python -m http.server 80
2 changes: 2 additions & 0 deletions docker/qa-jupyter-go-r/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,6 @@ RUN cp /root/go/bin/gophernotes /usr/local/bin/ \
## clean
EXPOSE 8888

WORKDIR /home

CMD ["bash", "/root/runpy.sh"]
1 change: 1 addition & 0 deletions docker/qa-jupyter-go-r/jupyter_notebook_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
c.NotebookApp.open_browser = False
c.MultiKernelManager.default_kernel_name = 'python3'
c.NotebookApp.token = ''
c.NotebookApp.notebook_dir = '~/'
c.NotebookApp.password = u'sha1:a658c59030b6:910b8fff6920f60a451b19a82e465c60f4880b60'
c.NotebookApp.allow_credentials = True
c.NotebookApp.allow_origin = '*'
Expand Down
1 change: 1 addition & 0 deletions docker/qa-service-pro/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ services:
ports:
- "8888:8888"
- "81:80"
- "8787:8787"
environment:
- TZ=Asia/Shanghai
- LANG=C.UTF-8
Expand Down
1 change: 1 addition & 0 deletions docker/qa-service/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ services:
ports:
- "8888:8888"
- "81:80"
- "8787:8787"
environment:
- TZ=Asia/Shanghai
- LANG=C.UTF-8
Expand Down

0 comments on commit 2bae56e

Please sign in to comment.