-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misalignment of parsed outputs in .get_all() function #12
Comments
So the actual problem which you figured out but didn't state here is that Yahoo's "CSV" output is crap. They are not quoting values which include commas, which screws up the alignment. This is really annoying. The patch you provided involves multiple queries, which isn't very efficient. I'm not sure of the best solution at the moment. |
The broken fields which I identified are float and lastTradeSize. @rarmknecht seems to have also identified even more:
|
I've been using the Yahoo API for years without this problem, and I realize that it's because my query didn't include the offending fields. I guess that's the best we can do right now unless someone can see something in this format that I cannot. The ideal fix I think would be to remove these from query_all and let the user individually query them, OR add an additional "all" query which does the individual queries as the PR above does. |
BTW here's a brief code to demonstrate the problem:
|
"The ideal fix I think would be to remove these from query_all and let the user individually query them, OR add an additional "all" query which does the individual queries as the PR above does." That sounds like a decent work around. Certainly more efficient and user friendly than the solution I provided that makes multiple queries without being clear to the user that that is occuring. |
The issue that is causing this is actually the first line of the ids: The indicators c3 and m6 are not accounted for when the dictionary that you return is being built.
You can simply fix this by accounting for these values when you build the dictionary, or just remove c3 and m6 from the id line. |
Maybe Yahoo Finance has changed the reporting structure (frustrating), but the results from the .get_all() function no longer aligns up with the attribute name.
code:
print ystockquote.get_all("GOOG")
Output (Lengthy, but as you can see certain fields are misaligned e.g. 'stock_exchange'):
{'previous_close': '1069.86', 'shares_owned': '"Google Inc."', 'change_from_52_week_low': '695.52', 'revenue': '36.746', 'average_daily_volume': '000', 'todays_range_realtime': '"1059.04 - 1084.95"', 'today_open': '1071.85', 'last_trade_realtime_time': '1084.95', 'fiftytwo_week_high': '"N/A - N/A"', 'ebitda': '44.15', 'fifty_sma': '+3.82%', 'pe_realtime': '12.26', 'ask_realtime': '1097.00', 'percent_change_50_sma': '+39.90', 'percent_change_from_52_week_low': '-7.5601', 'price_paid': '"N/A - N/A"', 'pe': 'N/A', 'holdings_value': '"Choose Brokerage"', 'price_eps_estimate_next_year': '17.599B', 'dividend_per_share': '0.00', 'twohundred_sma': '1044.85', 'trade_links': '2212546', 'market_cap': '2212546', 'todays_value_change_realtime': '"- - +1.39%"', 'change_realtime': '"+14.89"', 'low_limit': '" +===== "', 'volume': '"695.52 - 1092.3101"', 'todays_high': '1059.04', 'ask_size': '-', 'holdings_gain': '"-"', 'shares_outstanding': '"-"', 'holdings_gain_realtime': '"N/A - N/A"', 'last_trade_price': '"Dec 18 - 1084.75"', 'notes': '000', 'change_percent': '"+1.39%"', 'change_percent_realtime': '"N/A - +1.39%"', 'ticker_trend': '087', 'todays_low': '-', 'bid_realtime': '1054.00', 'change_50_sma': '+16.43%', 'more_info': 'N/A', 'price_book': '52.09', 'price_eps_estimate_current_year': '248.353', 'order_book_realtime': '100', 'todays_range': '-', 'change_from_52_week_high': '+389.23', 'book_value': '-', 'market_cap_realtime': '362.4B', 'dividend_yield': 'N/A', 'percent_change_from_52_week_high': '029', 'holdings_gain_percent': '1118.59', 'stock_exchange': '-0.69%', 'annualized_gain': '"- - -"', 'high_limit': '100', 'todays_value_change': '1084.75', 'short_ratio': '6.23', 'company_name': ' 276', 'trade_date': '-', 'dividend_pay_date': '"N/A"', 'change_200_sma': '+153.094', 'peg': '57.386B', 'bid_size': '"NasdaqNM"', 'last_trade_time_plus': '"N/A - 1084.75"', 'eps_estimate_next_quarter': '-', 'eps_estimate_current_year': '1836150', 'fiftytwo_week_range': '+55.96%', 'fiftytwo_week_low': '1092.3101', 'last_trade_date': '"12/18/2013"', 'holdings_value_realtime': '"GOOG"', 'ex_dividend_date': '"N/A"', 'after_hours_change_realtime': '"N/A - N/A"', 'price_sales': '-', 'change': '+14.89', 'eps_estimate_next_year': '"GOOG"', 'holdings_gain_percent_realtime': '-', 'eps': '300', 'one_year_target': '931.656', 'last_trade_time': '"4:00pm"', 'float_shares': 'N/A', 'change_percent_change': '"+14.89 - +1.39%"', 'last_trade_size': ' 334'}
The text was updated successfully, but these errors were encountered: