Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanqi committed Jul 3, 2018
1 parent 31924da commit 0d2050e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fooltrader/api/quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,12 @@ def get_kdata(security_item, exchange=None, the_date=None, start_date=None, end_
dtype = {"code": str, 'timestamp': str}
df = pd.read_csv(the_path, dtype=dtype)

if 'factor' in df.columns:
if 'factor' in df.columns and source == '163' and security_item['type'] == 'stock':
df_kdata_has_factor = df[df['factor'].notna()]
if df_kdata_has_factor.shape[0] > 0:
latest_factor = df_kdata_has_factor.tail(1).factor.iat[0]
else:
latest_factor = None

df.timestamp = df.timestamp.apply(lambda x: to_time_str(x))
df = df.set_index(df['timestamp'], drop=False)
Expand Down Expand Up @@ -333,6 +335,7 @@ def get_kdata(security_item, exchange=None, the_date=None, start_date=None, end_
return df
return pd.DataFrame()


def get_latest_download_trading_date(security_item, return_next=True, source=None):
df = get_kdata(security_item, source=source)
if len(df) == 0:
Expand Down

0 comments on commit 0d2050e

Please sign in to comment.