question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GDAX - private access keeps giving me a code 400 error

See original GitHub issue

I passed my key, secret and passphrase to the ExchangeSpecification function. bellow is the complete code

Exception in thread "main" java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy12.placeLimitOrder(Unknown Source) at org.knowm.xchange.gdax.service.GDAXTradeServiceRaw.placeCoinbaseExLimitOrder(GDAXTradeServiceRaw.java:45) at org.knowm.xchange.gdax.service.GDAXTradeService.placeLimitOrder(GDAXTradeService.java:55) at org.knowm.xchange.examples.gdax.GDAXTradesDemo.generic(GDAXTradesDemo.java:65) at org.knowm.xchange.examples.gdax.GDAXTradesDemo.main(GDAXTradesDemo.java:42) Caused by: si.mazi.rescu.HttpStatusIOException: **HTTP status code was not OK: 400** at si.mazi.rescu.ResponseReader.read(ResponseReader.java:104) at si.mazi.rescu.RestInvocationHandler.mapInvocationResult(RestInvocationHandler.java:169) at si.mazi.rescu.RestInvocationHandler.receiveAndMap(RestInvocationHandler.java:157) at si.mazi.rescu.RestInvocationHandler.invoke(RestInvocationHandler.java:120) ... 5 more

` public static void main(String[] args) throws IOException {

	String aKey = "xxxx"; //
	String aSecret = "xxxxxxxxx";
	String passphrase = "xxx";

	ExchangeSpecification specification = new ExchangeSpecification(GDAXExchange.class.getName());
	specification.setApiKey(aKey);
	specification.setSecretKey(aSecret);
	specification.setExchangeSpecificParametersItem("passphrase", passphrase);
	
	Exchange exchange = ExchangeFactory.INSTANCE.createExchange(specification);
	TradeService tradeService = exchange.getTradeService();
	MarketDataService marketDataService = exchange.getMarketDataService();

	generic(marketDataService, tradeService);
}

public static void generic(MarketDataService marketDataService, TradeService tradeService) throws IOException {

	LimitOrder limitOrder = new LimitOrder((OrderType.ASK), new BigDecimal("0.001"), CurrencyPair.BTC_EUR, "", null,
			new BigDecimal("1500.00"));
		
	String limitOrderReturnValue = tradeService.placeLimitOrder(limitOrder);
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ww3456commented, May 9, 2017

At least you’re getting closer! I’m not too sure what the problem is - on the surface your code looks fine. The standard authenticated end points (e.g. order placement) work fine for me in 4.2.1-SNAPSHOT but I’ve only recently started using GDAX so would not know if anything has been fixed since the 4.2.0 release, I had a quick search and could not find anything obvious.

My best guess is that you are trying to use your general web login GDAX password rather than the passphrase given when you created the key. The official docs about this are here. Try creating a new key and using those details.

0reactions
pieterdirixcommented, May 9, 2017

thank you very much!!! you guessed right, after triple checking my passphrase i created a new API key at GDAX and now it works (i think). I now still get a 400 code but it also tells me that my order size is too small (<0.01) so i assume that that is my last problem which I can fix as soon as i get home again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

R httr GET request 400 error GDAX - Stack Overflow
Show activity on this post. Status Code 400 means you are sending a bad request. Something must be missing or in a wrong...
Read more >
How to Fix a 400 Bad Request Error [Causes and Fixes]
The 400 bad request is an HTTP response code sent from a web server that didn't understand the request sent from your browser....
Read more >
Resolve 400 error messages when modifying an Amazon ...
A 400 error can occur if there is an ongoing issue or LSE that is affecting Amazon Relational Database Service (Amazon RDS) or...
Read more >
400 Bad Request Error: What It Is and How to Fix It
The 400 Bad Request Error is an HTTP response status code indicating that the server was unable to process the request sent by...
Read more >
Troubleshooting Power BI gateway (personal mode)
Solution: This error is because of the privacy-level restrictions and the types of data sources you're using. Error: Data source error: We ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found