studerw / td-ameritrade-client

TD Ameritrade Java Client
Apache License 2.0
69 stars 47 forks source link

error 404 #8

Closed Denebulas closed 4 years ago

Denebulas commented 4 years ago

I always receive a 404 error. Example: props.setProperty("tda.client_id", "..."); props.setProperty("tda.token.refresh","...")

    TdaClient tdaClient = new HttpTdaClient(props);

    Instrument resp = tdaClient.getBond("912810EG9");

RESULT:

[AWT-EventQueue-0] INFO com.studerw.tda.client.HttpTdaClient - Initiating HttpTdaClient... [AWT-EventQueue-0] INFO com.studerw.tda.client.HttpTdaClient - Fetching Instrument with id: 912810EG9 [AWT-EventQueue-0] INFO TDA_HTTP - REQUEST GET: https://apis.tdameritrade.com/v1/instruments/912810EG9?fundamental=true [AWT-EventQueue-0] INFO TDA_HTTP - RESPONSE [404 - /v1/instruments/912810EG9]: https://apis.tdameritrade.com/v1/instruments/912810EG9?fundamental=true in 1844.4 ms Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Non 200 response: [404 - /v1/instruments/912810EG9] - https://apis.tdameritrade.com/v1/instruments/912810EG9?fundamental=true at com.studerw.tda.client.HttpTdaClient.checkResponse(HttpTdaClient.java:622)

Same for a request for quotes. On the test website they bot work with 200.

BTW The request for quotes from your client has a different url:

GET /v1/marketdata/quotes?symbol=MSFT

while onn the official website is:

GET /v1/marketdata/MSFT/quotes?apikey=

studerw commented 4 years ago

See the issue 9.

I made a new release, so you don't have to build the jar yourself, and it's no longer a snapshot.

So change your dependency to use version 2.0.0 instead of 2.0.0-SNAPSHOP. Let me know if it works.

Denebulas commented 4 years ago

After git cloning again it works. Thank you very much