Jun-12-2023, 03:23 PM
Hi , I tried my hand at a little loop in Python. I'm staying away from doing some of this redirecting in a shell language because ultimately i want to run this directly from power bi without yet another software middleman.
I created a driver file with tickers (tickers.txt). And am attempting to drive creation of ticker history from there in separate output ticker history files. As was the case from the command line, I'm getting an ellipsis in the middle of my history instead of all history in each file. Does anybody know why i'm getting ellipses and how to get all of history instead? I'm already gussingh that "max" parameter isnt what one would think.
import yfinance as yf
import sys
for line in open('C:\\Users\\stant\\OneDrive\\Documents\\daxandpython\\tickers.txt'):
tkr=yf.Ticker(line.strip("\n\r"))
with open('C:\\Users\\stant\\OneDrive\\Documents\\daxandpython\\yfinance\\'+line.strip("\n\r") +'.txt', 'w') as sys.stdout:
tkr.history(period="max")
I created a driver file with tickers (tickers.txt). And am attempting to drive creation of ticker history from there in separate output ticker history files. As was the case from the command line, I'm getting an ellipsis in the middle of my history instead of all history in each file. Does anybody know why i'm getting ellipses and how to get all of history instead? I'm already gussingh that "max" parameter isnt what one would think.
import yfinance as yf
import sys
for line in open('C:\\Users\\stant\\OneDrive\\Documents\\daxandpython\\tickers.txt'):
tkr=yf.Ticker(line.strip("\n\r"))
with open('C:\\Users\\stant\\OneDrive\\Documents\\daxandpython\\yfinance\\'+line.strip("\n\r") +'.txt', 'w') as sys.stdout:
tkr.history(period="max")