pyetrade
pyetrade copied to clipboard
get_quote symbols check
It appears ETrade has updated the quote API with an overrideSymbolCount option. Once set to true, the symbol length limit of 25 is increased to 50. It seems the get_quote function doesn't allow for the option, and seems to warn if any symbol length is > 25. Will the latest version include support for overrideSymbolCount as an option, and then alter the len(symbols) check depending upon overrideSymbolCount being true or false? Not sure if there are any tests for these conditions.
I question the value of adding this extra capability and complexity. Why not use the power of python (from the user) to grab quote data in blocks of 25. Blocks of 50 just adds complexity to the backend.
this code is what I use
quotes = list()
api = pyetrade.market.ETradeMarket(consumer_key, consumer_secret, oauth.access_token['oauth_token'],
oauth.access_token['oauth_token_secret'], dev=False)
symbols = [ all my symbols ]
for i in range(0,len(symbols),25):
q = api.get_quote(symbols[i:i+25],require_earnings_date=True,resp_format='xml') # a dict response
for this_quote in q['QuoteResponse']['QuoteData']:
try:
quotes.append(alter_quote_dict(this_quote))
except Exception as err:
print('Trouble with quote for %s' % str(this_quote['Product']['symbol']))
On Aug 12, 2020, at 4:59 PM, coder2day [email protected] wrote:
It appears ETrade has updated the quote API with an overrideSymbolCount option. Once set to true, the symbol length limit of 25 is increased to 50. It seems the get_quote function doesn't allow for the option, and seems to warn if any symbol length is > 25. Will the latest version include support for overrideSymbolCount as an option, and then alter the len(symbols) check depending upon overrideSymbolCount being true or false? Not sure if there are any tests for these conditions.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jessecooper/pyetrade/issues/33, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABE3CHAWWBPXLMLXJECOTJLSAMUETANCNFSM4P5PG2EA.
Thanks for the feedback. I currently do something very similar by iterating over the list in blocks of 25. There are two advantages for increasing the block length to 50. First, it's faster to send/receive one request of length 50, than two requests of length 25 each. Second, Etrade counts an API call as the network request, regardless of length. So a get_quote with symbol length of 1, 25, or 50 all count as one API call. When you're pressing the limit on API calls, the increased block size helps.
Here's a small patch to support 50 symbols. quote50.patch.txt
@coder2day if you could create a PR for this enhancement that would be appreciated.