GDAX - private access keeps giving me a code 400 error
See original GitHub issueI 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:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
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.
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.