Skip to content

Commit

Permalink
format with black
Browse files Browse the repository at this point in the history
  • Loading branch information
SunsetWolf committed Nov 1, 2023
1 parent 3af3cae commit 34e9553
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/data_collector/yahoo/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,9 @@ def normalize_yahoo(
df_tmp.sort_index(inplace=True)
df_tmp.index = df_tmp.index.tz_localize(None)
df.index = df.index.tz_localize(None)
df_tmp['symbol'] = df.iloc[0]['symbol']
df_tmp = df_tmp.drop(columns=['open', 'high', 'low', 'close', 'volume'])
df = df_tmp.merge(df[["open", "high", "low", "close", "volume"]], left_index=True, right_index=True, how='left')
df_tmp["symbol"] = df.iloc[0]["symbol"]
df_tmp = df_tmp.drop(columns=["open", "high", "low", "close", "volume"])
df = df_tmp.merge(df[["open", "high", "low", "close", "volume"]], left_index=True, right_index=True, how="left")
df.loc[(df["volume"] <= 0) | np.isnan(df["volume"]), list(set(df.columns) - {symbol_field_name})] = np.nan

change_series = YahooNormalize.calc_change(df, last_close)
Expand Down Expand Up @@ -542,7 +542,7 @@ def normalize(self, df: pd.DataFrame) -> pd.DataFrame:
df = super(YahooNormalize1dExtend, self).normalize(df)
df.set_index(self._date_field_name, inplace=True)
symbol_name = df[self._symbol_field_name].iloc[0]
old_symbol_list = self.old_qlib_data.index.get_level_values('instrument').unique().to_list()
old_symbol_list = self.old_qlib_data.index.get_level_values("instrument").unique().to_list()
if str(symbol_name).upper() not in old_symbol_list:
return df.reset_index()
old_df = self.old_qlib_data.loc[str(symbol_name).upper()]
Expand Down

0 comments on commit 34e9553

Please sign in to comment.