Skip to content

Instantly share code, notes, and snippets.

@discdiver
Last active August 31, 2022 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save discdiver/3e18f4508ed658e16617164a83a3294f to your computer and use it in GitHub Desktop.
Save discdiver/3e18f4508ed658e16617164a83a3294f to your computer and use it in GitHub Desktop.
import pandas
import yfinance as yf
from datetime import timedelta
from prefect import flow, task
@task(retries=3, cache_expiration=timedelta(30))
def fetch_data(ticker):
return yf.download(ticker)
@task
def save_data(stock_df):
stock_df.to_parquet()
@flow
def pipeline(ticker):
df = fetch_data(ticker)
save_data(df)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment