You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey Ive been making a Python project using yf and id say the project is pretty big around 783103 lines to be exactly and it a Tkinker TreeView app here you can see the list of tickiters and their Full Name, Price, Category, etc . And i added some buttons to do some interactions like using Matplotlib to create All-Time Price Chart as Specific-Time Price Chart (In two words i can say that the project is intresting) I know you can say that: WHAT FUCK IS WRONG WITH YOU 783K OF LINES OF COURSE IS SLOW ASS HELL. But no around 300k is varibles = yf.Tickiter('NAME') and other 300k is [get_sym(ticker99965.info), get_name(ticker99965.info), '', get_price(ticker99965.info), get_typ(ticker99965.info), '', ''], data from a list. When you run the app with just 300k (only variables) the time is somewhat good (2min from IDE and 20sec after using pyinstaller) but the thing that slows the program so much is the: def get_price(info):
if 'currentPrice' in info:
return info['currentPrice']
elif 'dayHigh' in info:
return info['dayHigh']
else:
return 'N/A'
def get_name(info):
if 'shortName' in info:
return info['shortName']
elif 'longName' in info:
return info['longName']
else:
return 'N/A'
def get_sym(info):
if 'symbol' in info:
return info['symbol']
else:
return 'N/A'
def get_typ(info):
if 'qouteType' in info:
return info['quoteType']
else:
return 'N/A'
Sometime a Tiketer doesn't have variables like shortName or currentPrice so I need to use an alternative so for every time i need to check if shortName exist and that is slowing it so much.
You might say: YOU ALREDY NOW THE ISSUE!
Yes I know it but the question is how to make it faster and keeping at least the Price live is there a way ?
Thanks for reading, sorry for my English (I'm not from India but from Eastern Europe so don't be racist)
Simple code that reproduces your problem
def get_price(info):
if 'currentPrice' in info:
return info['currentPrice']
elif 'dayHigh' in info:
return info['dayHigh']
else:
return 'N/A'
def get_name(info):
if 'shortName' in info:
return info['shortName']
elif 'longName' in info:
return info['longName']
else:
return 'N/A'
def get_sym(info):
if 'symbol' in info:
return info['symbol']
else:
return 'N/A'
def get_typ(info):
if 'qouteType' in info:
return info['quoteType']
else:
return 'N/A'
Describe bug
Hey Ive been making a Python project using yf and id say the project is pretty big around 783103 lines to be exactly and it a Tkinker TreeView app here you can see the list of tickiters and their Full Name, Price, Category, etc . And i added some buttons to do some interactions like using Matplotlib to create All-Time Price Chart as Specific-Time Price Chart (In two words i can say that the project is intresting) I know you can say that: WHAT FUCK IS WRONG WITH YOU 783K OF LINES OF COURSE IS SLOW ASS HELL. But no around 300k is varibles = yf.Tickiter('NAME') and other 300k is [get_sym(ticker99965.info), get_name(ticker99965.info), '', get_price(ticker99965.info), get_typ(ticker99965.info), '', ''], data from a list. When you run the app with just 300k (only variables) the time is somewhat good (2min from IDE and 20sec after using pyinstaller) but the thing that slows the program so much is the: def get_price(info):
if 'currentPrice' in info:
return info['currentPrice']
elif 'dayHigh' in info:
return info['dayHigh']
else:
return 'N/A'
def get_name(info):
if 'shortName' in info:
return info['shortName']
elif 'longName' in info:
return info['longName']
else:
return 'N/A'
def get_sym(info):
if 'symbol' in info:
return info['symbol']
else:
return 'N/A'
def get_typ(info):
if 'qouteType' in info:
return info['quoteType']
else:
return 'N/A'
Sometime a Tiketer doesn't have variables like shortName or currentPrice so I need to use an alternative so for every time i need to check if shortName exist and that is slowing it so much.
You might say: YOU ALREDY NOW THE ISSUE!
Yes I know it but the question is how to make it faster and keeping at least the Price live is there a way ?
Thanks for reading, sorry for my English (I'm not from India but from Eastern Europe so don't be racist)
Simple code that reproduces your problem
def get_price(info):
if 'currentPrice' in info:
return info['currentPrice']
elif 'dayHigh' in info:
return info['dayHigh']
else:
return 'N/A'
def get_name(info):
if 'shortName' in info:
return info['shortName']
elif 'longName' in info:
return info['longName']
else:
return 'N/A'
def get_sym(info):
if 'symbol' in info:
return info['symbol']
else:
return 'N/A'
def get_typ(info):
if 'qouteType' in info:
return info['quoteType']
else:
return 'N/A'
data = [
# Example - [ "Bitcoin", "BTC-USD", "Crypto", BTCPRICE, "", ""]
[data.info['symbol'], data.info['shortName'], "", data.info['dayHigh'], data.info['quoteType'], "", ""],
[get_sym(ticker1.info), get_name(ticker1.info), '', get_price(ticker1.info), get_typ(ticker1.info), '', ''],
[get_sym(ticker10.info), get_name(ticker10.info), '', get_price(ticker10.info), get_typ(ticker10.info), '', ''],
[get_sym(ticker100.info), get_name(ticker100.info), '', get_price(ticker100.info), get_typ(ticker100.info), '', ''],
[get_sym(ticker1000.info), get_name(ticker1000.info), '', get_price(ticker1000.info), get_typ(ticker1000.info), '', ''],
[get_sym(ticker10000.info), get_name(ticker10000.info), '', get_price(ticker10000.info), get_typ(ticker10000.info), '', ''],
[get_sym(ticker100000.info), get_name(ticker100000.info), '', get_price(ticker100000.info), get_typ(ticker100000.info), '', ''],
[get_sym(ticker100001.info), get_name(ticker100001.info), '', get_price(ticker100001.info), get_typ(ticker100001.info), '', ''],
[get_sym(ticker100002.info), get_name(ticker100002.info), '', get_price(ticker100002.info), get_typ(ticker100002.info), '', ''],
[get_sym(ticker100003.info), get_name(ticker100003.info), '', get_price(ticker100003.info), get_typ(ticker100003.info), '', ''],
[get_sym(ticker100004.info), get_name(ticker100004.info), '', get_price(ticker100004.info), get_typ(ticker100004.info), '', ''],
[get_sym(ticker100005.info), get_name(ticker100005.info), '', get_price(ticker100005.info), get_typ(ticker100005.info), '', ''],
[get_sym(ticker100006.info), get_name(ticker100006.info), '', get_price(ticker100006.info), get_typ(ticker100006.info), '', ''],
[get_sym(ticker100007.info), get_name(ticker100007.info), '', get_price(ticker100007.info), get_typ(ticker100007.info), '', ''],
[get_sym(ticker100008.info), get_name(ticker100008.info), '', get_price(ticker100008.info), get_typ(ticker100008.info), '', ''],
[get_sym(ticker100009.info), get_name(ticker100009.info), '', get_price(ticker100009.info), get_typ(ticker100009.info), '', ''],
[get_sym(ticker10001.info), get_name(ticker10001.info), '', get_price(ticker10001.info), get_typ(ticker10001.info), '', ''],
[get_sym(ticker100010.info), get_name(ticker100010.info), '', get_price(ticker100010.info), get_typ(ticker100010.info), '', ''],
[get_sym(ticker100011.info), get_name(ticker100011.info), '', get_price(ticker100011.info), get_typ(ticker100011.info), '', ''],
[get_sym(ticker100012.info), get_name(ticker100012.info), '', get_price(ticker100012.info), get_typ(ticker100012.info), '', ''],
[get_sym(ticker100013.info), get_name(ticker100013.info), '', get_price(ticker100013.info), get_typ(ticker100013.info), '', ''],
[get_sym(ticker100014.info), get_name(ticker100014.info), '', get_price(ticker100014.info), get_typ(ticker100014.info), '', ''],
[get_sym(ticker100015.info), get_name(ticker100015.info), '', get_price(ticker100015.info), get_typ(ticker100015.info), '', ''],
[get_sym(ticker100016.info), get_name(ticker100016.info), '', get_price(ticker100016.info), get_typ(ticker100016.info), '', ''],
[get_sym(ticker100017.info), get_name(ticker100017.info), '', get_price(ticker100017.info), get_typ(ticker100017.info), '', ''],
[get_sym(ticker100018.info), get_name(ticker100018.info), '', get_price(ticker100018.info), get_typ(ticker100018.info), '', ''],
[get_sym(ticker100019.info), get_name(ticker100019.info), '', get_price(ticker100019.info), get_typ(ticker100019.info), '', ''],
[get_sym(ticker10002.info), get_name(ticker10002.info), '', ................................. [get_sym(ticker99972.info), get_name(ticker99972.info), '', get_price(ticker99972.info), get_typ(ticker99972.info), '', ''],
[get_sym(ticker99973.info), get_name(ticker99973.info), '', get_price(ticker99973.info), get_typ(ticker99973.info), '', ''],
[get_sym(ticker99974.info), get_name(ticker99974.info), '', get_price(ticker99974.info), get_typ(ticker99974.info), '', ''],
[get_sym(ticker99975.info), get_name(ticker99975.info), '', get_price(ticker99975.info), get_typ(ticker99975.info), '', ''],
[get_sym(ticker99976.info), get_name(ticker99976.info), '', get_price(ticker99976.info), get_typ(ticker99976.info), '', ''],
[get_sym(ticker99977.info), get_name(ticker99977.info), '', get_price(ticker99977.info), get_typ(ticker99977.info), '', ''],
[get_sym(ticker99978.info), get_name(ticker99978.info), '', get_price(ticker99978.info), get_typ(ticker99978.info), '', ''],
[get_sym(ticker99979.info), get_name(ticker99979.info), '', get_price(ticker99979.info), get_typ(ticker99979.info), '', ''],
[get_sym(ticker9998.info), get_name(ticker9998.info), '', get_price(ticker9998.info), get_typ(ticker9998.info), '', ''],
[get_sym(ticker99980.info), get_name(ticker99980.info), '', get_price(ticker99980.info), get_typ(ticker99980.info), '', ''],
[get_sym(ticker99981.info), get_name(ticker99981.info), '', get_price(ticker99981.info), get_typ(ticker99981.info), '', ''],
[get_sym(ticker99982.info), get_name(ticker99982.info), '', get_price(ticker99982.info), get_typ(ticker99982.info), '', ''],
[get_sym(ticker99983.info), get_name(ticker99983.info), '', get_price(ticker99983.info), get_typ(ticker99983.info), '', ''],
[get_sym(ticker99984.info), get_name(ticker99984.info), '', get_price(ticker99984.info), get_typ(ticker99984.info), '', ''],
[get_sym(ticker99985.info), get_name(ticker99985.info), '', get_price(ticker99985.info), get_typ(ticker99985.info), '', ''],
[get_sym(ticker99986.info), get_name(ticker99986.info), '', get_price(ticker99986.info), get_typ(ticker99986.info), '', ''],
[get_sym(ticker99987.info), get_name(ticker99987.info), '', get_price(ticker99987.info), get_typ(ticker99987.info), '', ''],
[get_sym(ticker99988.info), get_name(ticker99988.info), '', get_price(ticker99988.info), get_typ(ticker99988.info), '', ''],
[get_sym(ticker99989.info), get_name(ticker99989.info), '', get_price(ticker99989.info), get_typ(ticker99989.info), '', ''],
[get_sym(ticker9999.info), get_name(ticker9999.info), '', get_price(ticker9999.info), get_typ(ticker9999.info), '', ''],
[get_sym(ticker99990.info), get_name(ticker99990.info), '', get_price(ticker99990.info), get_typ(ticker99990.info), '', ''],
[get_sym(ticker99991.info), get_name(ticker99991.info), '', get_price(ticker99991.info), get_typ(ticker99991.info), '', ''],
[get_sym(ticker99992.info), get_name(ticker99992.info), '', get_price(ticker99992.info), get_typ(ticker99992.info), '', ''],
[get_sym(ticker99993.info), get_name(ticker99993.info), '', get_price(ticker99993.info), get_typ(ticker99993.info), '', ''],
[get_sym(ticker99994.info), get_name(ticker99994.info), '', get_price(ticker99994.info), get_typ(ticker99994.info), '', ''],
[get_sym(ticker99995.info), get_name(ticker99995.info), '', get_price(ticker99995.info), get_typ(ticker99995.info), '', ''],
[get_sym(ticker99996.info), get_name(ticker99996.info), '', get_price(ticker99996.info), get_typ(ticker99996.info), '', ''],
[get_sym(ticker99997.info), get_name(ticker99997.info), '', get_price(ticker99997.info), get_typ(ticker99997.info), '', ''],
[get_sym(ticker99998.info), get_name(ticker99998.info), '', get_price(ticker99998.info), get_typ(ticker99998.info), '', ''],
[get_sym(ticker99999.info), get_name(ticker99999.info), '', get_price(ticker99999.info), get_typ(ticker99999.info), '', ''],
]
Debug log
No Error but Program really slow
Bad data proof
No response
yfinance
versionlatest
Python version
3.12
Operating system
win 11
The text was updated successfully, but these errors were encountered: