Skip to content

Commit

Permalink
update to 1.5.10
Browse files Browse the repository at this point in the history
update to 1.5.10
  • Loading branch information
yutiansut authored Aug 18, 2019
2 parents bfb8026 + b556d1e commit 5215bd3
Show file tree
Hide file tree
Showing 8 changed files with 272 additions and 71 deletions.
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,10 @@
- 2019-03-29 *振忠
- 2019-04-09 *
- 2019-04-29 *五洲
- 2019-05-14 *长春
- 2019-05-16 *长春
- 2019-07-23 *五洲
- 2019-08-08 *博思


感谢@尧 [email protected] 对于1.0.32版本做出的巨大贡献
29 changes: 24 additions & 5 deletions QUANTAXIS/QAFetch/QAQUANTAXISWEB.py → QUANTAXIS/QAFetch/QAQAWEB.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,30 @@
233333 结果变成自己访问自己了
"""
import requests
import tornado
import pandas as pd
from QUANTAXIS.QAUtil.QACode import QA_util_code_tostr



def QA_fetch_get_stock_day(code,start,end,ip='192.168.0.1',port='8010'):
def QA_fetch_get_stock_day(code, start, end, ip='192.168.0.1', port='8010'):
pass
#requests.get(
# requests.get(


def QA_fetch_get_stock_block():
"""ths的版块数据
Returns:
[type] -- [description]
"""

url = 'https://gitee.com/yutiansut/QADATA/raw/master/self_block.csv'
try:
bl = pd.read_csv(url)
return bl.assign(code=bl['证券代码'].apply(QA_util_code_tostr), blockname=bl['行业'], name=bl['证券名称'], source='outside', type='outside').set_index('code', drop=False)
except Exception as e:
print(e)
return None


if __name__ == "__main__":
print(QA_fetch_get_stock_block())
12 changes: 10 additions & 2 deletions QUANTAXIS/QAFetch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
from QUANTAXIS.QAFetch import QAHexun as QAHexun
from QUANTAXIS.QAFetch import QAfinancial
from QUANTAXIS.QAFetch.base import get_stock_market
from QUANTAXIS.QAFetch import QAQAWEB as QAWEB


def use(package):
if package in ['wind']:
Expand All @@ -57,6 +59,8 @@ def use(package):
return QAThs
elif package in ['HEXUN', 'Hexun', 'hexun']:
return QAHexun
elif package in ['QA']:
return QAWEB


def QA_fetch_get_stock_day(package, code, start, end, if_fq='01', level='day', type_='pd'):
Expand Down Expand Up @@ -136,7 +140,7 @@ def QA_fetch_get_index_min(package, code, start, end, level='1min'):

def QA_fetch_get_stock_block(package):
Engine = use(package)
if package in ['tdx', 'pytdx', 'ths']:
if package in ['tdx', 'pytdx', 'ths', 'QA']:
return Engine.QA_fetch_get_stock_block()
else:
return 'Unsupport packages'
Expand Down Expand Up @@ -172,7 +176,7 @@ def QA_fetch_get_index_list(package):
Engine = use(package)
if package in ['tdx', 'pytdx']:
return Engine.QA_fetch_get_index_list()
else:
else:
return 'Unsupport packages'


Expand Down Expand Up @@ -239,13 +243,15 @@ def QA_fetch_get_macroindex_list(package,):
else:
return 'Unsupport packages'


def QA_fetch_get_globalindex_list(package,):
Engine = use(package)
if package in ['tdx', 'pytdx']:
return Engine.QA_fetch_get_globalindex_list()
else:
return 'Unsupport packages'


def QA_fetch_get_exchangerate_list(package,):
Engine = use(package)
if package in ['tdx', 'pytdx']:
Expand Down Expand Up @@ -300,13 +306,15 @@ def QA_fetch_get_future_min(package, code, start, end, frequence='1min'):
else:
return 'Unsupport packages'


def QA_fetch_get_chibor(package, frequence):
Engine = use(package)
if package in ['Hexun', 'hexun']:
return Engine.QA_fetch_get_chibor(frequence)
else:
return 'Unsupport packages'


QA_fetch_get_option_day = QA_fetch_get_future_day
QA_fetch_get_option_min = QA_fetch_get_future_min

Expand Down
104 changes: 104 additions & 0 deletions QUANTAXIS/QAFetch/data_list.py

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion QUANTAXIS/QAMarket/QAPosition.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ def __init__(self,
name=None,
auto_reload=False,
allow_exceed=False,

spms_id =None,
oms_id = None,
*args,
**kwargs

Expand Down Expand Up @@ -168,6 +171,8 @@ def __init__(self,
self.trades = [] if trades is None else trades
self.orders = {} if orders is None else orders
self.frozen = {} if frozen is None else frozen
self.spms_id = spms_id
self.oms_id = oms_id
if auto_reload:
self.reload()
self.allow_exceed = allow_exceed
Expand Down Expand Up @@ -319,10 +324,13 @@ def static_message(self):
'account_cookie': self.account_cookie,
'frozen': self.frozen,
'name': self.name,
'spms_id': self.spms_id,
'oms_id': self.oms_id,
'market_type': self.market_type,
'exchange_id': self.exchange_id, # 交易所ID
'moneypreset': self.moneypreset,
'moneypresetLeft': self.moneypresetLeft,
'lastupdatetime': str(self.time),
# 持仓量
'volume_long_today': self.volume_long_today,
'volume_long_his': self.volume_long_his,
Expand Down Expand Up @@ -779,7 +787,7 @@ def on_transaction(self, transaction: dict):
self.trades.append(transaction)
except Exception as e:
raise e

def on_pirce_change(self, price):
self.last_price = price

Expand Down
16 changes: 16 additions & 0 deletions QUANTAXIS/QASU/save_tdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,22 @@ def QA_SU_save_stock_block(client=DATABASE, ui_log=None, ui_progress=None):
ui_progress_int_value=10000
)

coll.insert_many(
QA_util_to_json_from_pandas(QA_fetch_get_stock_block('QA'))
)
QA_util_log_info(
'QA_Select Block ====',
ui_log=ui_log,
ui_progress=ui_progress,
ui_progress_int_value=8000
)

QA_util_log_info(
'完成股票板块获取=',
ui_log=ui_log,
ui_progress=ui_progress,
ui_progress_int_value=10000
)
except Exception as e:
QA_util_log_info(e, ui_log=ui_log)
print(" Error save_tdx.QA_SU_save_stock_block exception!")
Expand Down
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.5.9'
__version__ = '1.5.10'
__author__ = 'yutiansut'

import argparse
Expand Down
Loading

0 comments on commit 5215bd3

Please sign in to comment.