Skip to content
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

RuntimeException: Empty json body: [200 - ] - https://api.tdameritrade.com/v1/marketdata/quotes?symbol=blahblah1 #56

Open
jschlade opened this issue Sep 1, 2022 · 1 comment

Comments

@jschlade
Copy link

jschlade commented Sep 1, 2022

Hi,

Using:

<dependency>
   <groupId>com.studerw.tda</groupId>
   <artifactId>td-ameritrade-client</artifactId>
   <version>2.4.1</version>
</dependency>

TdaClient client = new HttpTdaClient();
ArrayList<String> symbols = new ArrayList<>();
symbols.add("blahblah1");
List<Quote> quotes = client.fetchQuotes(symbols);

causes:

Exception in thread "main" java.lang.RuntimeException: Empty json body:  [200 - ] - https://api.tdameritrade.com/v1/marketdata/quotes?symbol=blahblah1
	at com.studerw.tda.client.HttpTdaClient.checkResponse(HttpTdaClient.java:852)
	at com.studerw.tda.client.HttpTdaClient.fetchQuotes(HttpTdaClient.java:241)

The code should be able to handle a bad symbol without throwing a RuntimeException.

Thanks

@studerw
Copy link
Owner

studerw commented Nov 4, 2022

@jschlade You really think a developer would want to get back an empty response if they pass in a symbol that TDA can't find? I could kind of see this making sense for multiple symbol requests if only one of them is bad, but definitely not in the use case you described above. Otherwise, the dev might not realize that the symbol they've passed is invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants