Skip to content

Commit

Permalink
rtfd
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanqi committed Mar 13, 2018
1 parent 5f60a0b commit fc23134
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
26 changes: 14 additions & 12 deletions fooltrader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

import pandas as pd

from fooltrader import settings
from fooltrader.api.quote import get_security_list
from fooltrader.consts import USA_STOCK_INDEX
from fooltrader.contract.data_contract import EXCHANGE_LIST_COL
from fooltrader.contract.files_contract import get_finance_dir, get_tick_dir, get_event_dir, get_kdata_dir
from fooltrader.settings import FOOLTRADER_STORE_PATH


def init_log():
Expand Down Expand Up @@ -55,17 +55,19 @@ def mkdir_for_security(item):


def init_env():
if not os.path.exists(settings.FOOLTRADER_STORE_PATH):
os.makedirs(settings.FOOLTRADER_STORE_PATH)
# 初始化股票文件夹
for _, item in get_security_list(exchanges=EXCHANGE_LIST_COL).iterrows():
mkdir_for_security(item)

# 初始化指数文件夹
for _, item in get_security_list(security_type='index', exchanges=['sh', 'sz', 'nasdaq']).iterrows():
kdata_dir = get_kdata_dir(item)
if not os.path.exists(kdata_dir):
os.makedirs(kdata_dir)
if not os.path.exists(FOOLTRADER_STORE_PATH):
print("{} is a wrong path")
print("please set env FOOLTRADER_STORE_PATH to working path or set it in settings.py")
else:
# 初始化股票文件夹
for _, item in get_security_list(exchanges=EXCHANGE_LIST_COL).iterrows():
mkdir_for_security(item)

# 初始化指数文件夹
for _, item in get_security_list(security_type='index', exchanges=['sh', 'sz', 'nasdaq']).iterrows():
kdata_dir = get_kdata_dir(item)
if not os.path.exists(kdata_dir):
os.makedirs(kdata_dir)


pd.set_option('expand_frame_repr', False)
Expand Down
6 changes: 1 addition & 5 deletions fooltrader/api/quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,6 @@ def get_ticks(security_item, the_date=None, start=None, end=None):
end: TimeStamp str or TimeStamp
end date
Returns
-------
DataFrame
Yields
-------
DataFrame
Expand All @@ -173,7 +169,7 @@ def get_ticks(security_item, the_date=None, start=None, end=None):

if the_date:
tick_path = files_contract.get_tick_path(security_item, the_date)
return _parse_tick(tick_path)
yield _parse_tick(tick_path, security_item)
else:
tick_dir = files_contract.get_tick_dir(security_item)
if start or end:
Expand Down

0 comments on commit fc23134

Please sign in to comment.