Skip to content

Commit

Permalink
https://github.com/QUANTAXIS/QUANTAXIS/issues/819
Browse files Browse the repository at this point in the history
update for #819
  • Loading branch information
yutiansut authored Sep 25, 2018
2 parents 7ff1516 + a143b2c commit d44e01b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions QUANTAXIS/QAFetch/QATdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def QA_fetch_get_stock_realtime(code=['000001', '000002'], ip=None, port=None):
api = TdxHq_API()
__data = pd.DataFrame()
with api.connect(ip, port):
code = [code] if type(code) is str else code
code = [code] if isinstance(code, str) else code
for id_ in range(int(len(code) / 80) + 1):
__data = __data.append(api.to_df(api.get_security_quotes(
[(_select_market_code(x), x) for x in code[80 * id_:80 * (id_ + 1)]])))
Expand All @@ -404,7 +404,7 @@ def QA_fetch_depth_market_data(code=['000001', '000002'], ip=None, port=None):
api = TdxHq_API()
__data = pd.DataFrame()
with api.connect(ip, port):
code = [code] if type(code) is str else code
code = [code] if isinstance(code, str) else code
for id_ in range(int(len(code) / 80) + 1):
__data = __data.append(api.to_df(api.get_security_quotes(
[(_select_market_code(x), x) for x in code[80 * id_:80 * (id_ + 1)]])))
Expand Down Expand Up @@ -1334,7 +1334,7 @@ def QA_fetch_get_future_min(code, start, end, frequence='1min', ip=None, port=No
# print(data.datetime)
data = data\
.assign(tradetime=pd.to_datetime(data['datetime']), code=str(code))\
.assign(datetime=pd.to_datetime(data['datetime'].apply(QA_util_future_to_realdatetime,1)))\
.assign(datetime=pd.to_datetime(data['datetime'].apply(QA_util_future_to_realdatetime, 1)))\
.drop(['year', 'month', 'day', 'hour', 'minute'], axis=1, inplace=False)\
.assign(date=data['datetime'].apply(lambda x: str(x)[0:10]))\
.assign(date_stamp=data['datetime'].apply(lambda x: QA_util_date_stamp(x)))\
Expand Down
6 changes: 3 additions & 3 deletions QUANTAXIS/QAFetch/QATdx_adv.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def _singal_job(self, context, id_, time_out=0.5):
def get_realtime(self, code):
context = pd.DataFrame()

code = [code] if type(code) is str else code
code = [code] if isinstance(code, str) is str else code
try:
for id_ in range(int(len(code) / 80) + 1):
context = self._singal_job(context, id_)
Expand All @@ -176,7 +176,7 @@ def get_realtime(self, code):
return None

def get_realtime_concurrent(self, code):
code = [code] if type(code) is str else code
code = [code] if isinstance(code, str) is str else code

try:
data = {self.get_security_quotes([(self.get_market(
Expand Down Expand Up @@ -209,7 +209,7 @@ def _get_security_bars(self, context, code, _type, lens):
return self._get_security_bars(context, code, _type, lens)

def get_security_bar(self, code, _type, lens):
code = [code] if type(code) is str else code
code = [code] if isinstance(code, str) is str else code
context = []
try:
for item in code:
Expand Down
11 changes: 6 additions & 5 deletions QUANTAXIS/QAWeb/QA_Web.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@
SimulateSocketHandler, MonitorSocketHandler)
from QUANTAXIS.QAWeb.userhandles import SigninHandler, SignupHandler, PersonBlockHandler
from QUANTAXIS.QAWeb.basehandles import QABaseHandler
from QUANTAXIS.QAWeb.arphandles import AccountHandler,RiskHandler,MemberHandler
from QUANTAXIS.QAWeb.arphandles import AccountHandler, RiskHandler, MemberHandler
from QUANTAXIS.QAWeb.strategyhandlers import StrategyHandler


class INDEX(QABaseHandler):
def get(self):
self.render('.{}{}'.format(os.sep, "index.html"))
Expand All @@ -48,15 +49,15 @@ def main():
(r"/marketdata/stock/price", StockPriceHandler),
(r"/marketdata/stock/code", StockCodeHandler),
(r"/user/signin", SigninHandler),
(r"/user/signup", SignupHandler),
(r"/user/signup", SignupHandler),
(r"/user/blocksetting", PersonBlockHandler),
(r"/strategy/content",StrategyHandler),
(r"/strategy/content", StrategyHandler),
(r"/realtime", RealtimeSocketHandler),
(r"/simulate", SimulateSocketHandler),
(r"/monitor", MonitorSocketHandler),
(r"/accounts", AccountHandler),
(r"/accounts/all",MemberHandler),
(r"/risk",RiskHandler)
(r"/accounts/all", MemberHandler),
(r"/risk", RiskHandler)
],
debug=True
)
Expand Down

0 comments on commit d44e01b

Please sign in to comment.