Python Forum
why is yfinance returning an ellipsis in the middle of ticket history
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
why is yfinance returning an ellipsis in the middle of ticket history
#1
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")

       
Reply
#2
Please use Python tags when posting code.

yfinance is not "returning" an ellipsis. The ellipsis is an artifact of converting the returned value of tkr.history() to a string suitable for printing. I am guessing that tkr.history() is returning a pandas DataFrame. You can configure Pandas to not use the ellipsis.
import pandas
pandas.set_option('display.max_rows', None)
db042190 likes this post
Reply
#3
thank you Dean , that worked. Where can I read what / how to use python tags when posting?
deanhystad write Jun-12-2023, 04:34 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply
#4
just trying out some tags...

import pandas
pandas.set_option('display.max_rows', None)
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")
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Build a DNS History Rudeus 2 655 Aug-11-2023, 09:52 PM
Last Post: Rudeus
Photo can't install yfinance db042190 4 27,752 Jun-12-2023, 01:14 PM
Last Post: db042190
  Yfinance - Intraday stock data with yf.download diogo_80 2 6,073 Apr-29-2022, 05:07 AM
Last Post: processingclouds
  Keyboard history program chesschaser 3 2,322 May-12-2020, 06:10 PM
Last Post: Larz60+
  Coding a logger for firefox history kpiatrou 2 2,909 Dec-25-2018, 06:42 PM
Last Post: snippsat
  How to handle "History" in ptpython sylas 4 4,034 Oct-07-2018, 11:09 PM
Last Post: Larz60+
  Spyder hides middle array values in variable explorer window davidqvist 0 2,412 Aug-03-2018, 11:04 AM
Last Post: davidqvist
  [inconsistent output] subprocess.call to run cmd commands to get Kerberos ticket Yelin 2 5,043 Jun-08-2018, 09:02 AM
Last Post: Yelin
  How to differentiate displacement-time history muhsin 1 2,832 Feb-14-2018, 11:50 AM
Last Post: Larz60+
  Reporting tool for ticket's SLA vstanchev 0 2,557 Aug-14-2017, 04:32 PM
Last Post: vstanchev

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020