Ask coding questions

← Back to all posts
automatic input of quotes from the internet
rogeryoung (0)

Is there any way I can program the computer to get stock quotes from the internet and input them into my program automatically so I do not have to do this manually ?
I am wondering if one would have to subscribe to some sort of expensive streaming service to do this.

Comments
hotnewtop
rogeryoung (0)

Do you know anything about this? :
Traceback (most recent call last):
File "main.py", line 9, in <module>
info = stock.info
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/yfinance/ticker.py", line 138, in info
for my program:

print(a)
b = "This program will stop and display the message (REPL PROCESS DIED UNEXPECTEDLY:) if the portfolio remains balanced within the limits."
c = "unbalanced"
import yfinance as yf
stock = yf.Ticker('vti')
info = stock.info

https://replit.com/@rogeryoung/No-3-Permanent-Portfolio-Rebalance-Present#main.py

SixBeeps (5346)

The yfinance package is completely free to use, and it's relatively easy. You just need to install the yfinance and lxml packages and use them accordingly. I made this sketch Repl that demonstrates yfinance.

rogeryoung (0)

@SixBeeps Thank you so very much for this information. The price data for the stocks is uploaded into my system beautifully but the problem now is that I am unable to incorporate it into my program so that it will multiply times the number of shares automatically. I would be very very thankful if you could give me some guidance as to how to do this or where I can find out how to do this.
Regards,
Roger Young

SixBeeps (5346)

@rogeryoung So in your program, instead of having the user input the price, you can set your variables to some functions from the library.

Here's an example of that with VTI:

stock = yf.Ticker('vti')
vti = float(info['previousClose'])
vtish = float(input("enter # vti sh >>>"))
vtival = vti*vtish
rogeryoung (0)

@rogeryoung Many many thanks for your help with my program. I love the way this is evolving and you have been wonderful.

SixBeeps (5346)

@rogeryoung You are very welcome :)

Please mark my comment as the answer if I've helped