Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化get_today_ticks,提高访问速度 #852

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions tushare/stock/trading.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def get_sina_dd(code=None, date=None, vol=400, retry_count=3, pause=0.001):
raise IOError(ct.NETWORK_URL_ERROR_MSG)


def get_today_ticks(code=None, retry_count=3, pause=0.001):
def get_today_ticks(code=None, retry_count=3, pause=0.001, all=True):
"""
获取当日分笔明细数据
Parameters
Expand Down Expand Up @@ -263,9 +263,10 @@ def get_today_ticks(code=None, retry_count=3, pause=0.001):
data_str = json.dumps(data_str)
data_str = json.loads(data_str)
pages = len(data_str['detailPages'])
fixed_pages = 1 if all == False else pages
data = pd.DataFrame()
ct._write_head()
for pNo in range(1, pages+1):
for pNo in range(1, fixed_pages+1):
data = data.append(_today_ticks(symbol, date, pNo,
retry_count, pause), ignore_index=True)
except Exception as er:
Expand Down