Skip to content

Commit

Permalink
#update
Browse files Browse the repository at this point in the history
  • Loading branch information
yutiansut committed Sep 25, 2018
1 parent abae119 commit a143b2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 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

0 comments on commit a143b2c

Please sign in to comment.