Skip to content

Instantly share code, notes, and snippets.

@quantra-go-algo
Created July 12, 2021 12:18
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 quantra-go-algo/c8786ae3955235e421f96e56ef48ed76 to your computer and use it in GitHub Desktop.
Save quantra-go-algo/c8786ae3955235e421f96e56ef48ed76 to your computer and use it in GitHub Desktop.
# Import package & get the data
import yfinance as yf
intraday_data = yf.download(tickers="MSFT",
period="5d",
interval="1m",
auto_adjust=True)
# Define the resampling logic
ohlcv_dict = {
'Open': 'first',
'High': 'max',
'Low': 'min',
'Close': 'last',
'Volume': 'sum'
}
# Resample the data
intraday_data_10 = intraday_data.resample('10T').agg(ohlcv_dict)
intraday_data_10.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment