Move away from Python Interop for better stability
This commit is contained in:
@@ -15,7 +15,6 @@ def pull():
|
||||
# Scrape the data
|
||||
all_data = []
|
||||
for i, symbol in enumerate(tickers):
|
||||
print(f"Processing: {i} of {len(tickers)}")
|
||||
df = yf.download(symbol, period="max", auto_adjust=True)
|
||||
if not df.empty:
|
||||
# Remove the ticker column
|
||||
@@ -24,10 +23,11 @@ def pull():
|
||||
all_data.append(df)
|
||||
|
||||
# Concatinate into a combined list and cache
|
||||
print("Processing data")
|
||||
final_df = pd.concat(all_data)
|
||||
|
||||
# Save to file
|
||||
print("Writing data to file")
|
||||
final_df.to_parquet(os.path.join(DATA_DIR, "stocks.parquet"))
|
||||
final_df.head(200).to_csv(os.path.join(DATA_DIR, "stocks.preview.csv"))
|
||||
final_df.head(200).to_csv(os.path.join(DATA_DIR, "stocks.preview.csv"))
|
||||
|
||||
if __name__ == "__main__":
|
||||
pull()
|
||||
Reference in New Issue
Block a user