XChange icon indicating copy to clipboard operation
XChange copied to clipboard

GDAX - private access keeps giving me a code 400 error

Open pieterdirix opened this issue 9 years ago • 6 comments

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);
}

'

pieterdirix avatar May 08 '17 17:05 pieterdirix

If you run the latest 4.2.1-SNAPSHOT there was a pull request (#1458) merged a earlier today that should improve that error message.

Also/Alternatively if you put SLF4J logger si.mazi.rescu to TRACE you should be able to see the raw error message being returned from the exchange.

ww3456 avatar May 08 '17 21:05 ww3456

thank you for the fast response.. i am using the 4.2.1 and i have now enabled TRACE. the following is what it spits out now:

07:28:33,881 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml] 07:28:33,882 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy] 07:28:33,882 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/Users/pieterdirix/Downloads/XChange-develop/xchange-examples/target/classes/logback.xml] 07:28:33,939 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set 07:28:33,939 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 07:28:33,946 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE_APPENDER] 07:28:33,954 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 07:28:33,994 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender] 07:28:33,997 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [DETAIL_APPENDER] 07:28:34,013 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@391447681 - Will use gz compression 07:28:34,014 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@391447681 - Will use the pattern log/xchange-detail-%d{yyyy-MM-dd}.%i.log for the active file 07:28:34,017 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@735f7ae5 - The date pattern is 'yyyy-MM-dd' from file name pattern 'log/xchange-detail-%d{yyyy-MM-dd}.%i.log.gz'. 07:28:34,017 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@735f7ae5 - Roll-over at midnight. 07:28:34,020 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@735f7ae5 - Setting initial period to Tue May 09 07:28:15 CEST 2017 07:28:34,020 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@735f7ae5 - SizeAndTimeBasedFNATP is deprecated. Use SizeAndTimeBasedRollingPolicy instead 07:28:34,020 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@735f7ae5 - For more information see http://logback.qos.ch/manual/appenders.html#SizeAndTimeBasedRollingPolicy 07:28:34,022 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 07:28:39,036 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[DETAIL_APPENDER] - Active log file name: log/xchange-detail.log 07:28:39,036 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[DETAIL_APPENDER] - File property is set to [log/xchange-detail.log] 07:28:39,037 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN 07:28:39,037 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE_APPENDER] to Logger[ROOT] 07:28:39,038 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [DETAIL_APPENDER] to Logger[ROOT] 07:28:39,038 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.knowm.xchange] to DEBUG 07:28:39,038 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [si.mazi.rescu] to TRACE 07:28:39,038 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration. 07:28:39,039 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@180bc464 - Registering current configuration as safe fallback point

07:28:39.043 [default] [main] DEBUG org.knowm.xchange.ExchangeFactory - Creating exchange from specification Exception in thread "main" java.lang.Error: Unresolved compilation problems: The type si.mazi.rescu.SynchronizedValueFactory cannot be resolved. It is indirectly referenced from required .class files The import si.mazi.rescu.SynchronizedValueFactory cannot be resolved SynchronizedValueFactory cannot be resolved to a type SynchronizedValueFactory cannot be resolved to a type SynchronizedValueFactory cannot be resolved to a type

at org.knowm.xchange.gdax.GDAXExchange.<init>(GDAXExchange.java:1)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at org.knowm.xchange.ExchangeFactory.createExchange(ExchangeFactory.java:168)
at org.knowm.xchange.examples.gdax.GDAXTradesDemo.main(GDAXTradesDemo.java:35)

pieterdirix avatar May 09 '17 05:05 pieterdirix

Seems that you have a different problem now, its failing earlier, during the initial connection attempt - you're missing the rescu dependency. The best I can tell this appeared to be on your classpath originally so hopefully it can be fixed without too much trouble. Checkout the Getting Started section on the front of this project's GitHub page, non-maven or maven.

ww3456 avatar May 09 '17 06:05 ww3456

Yes my apologies I just realised i broke something else by turning on TRACE. I have fixed that and now I get more useful information but i still do not know what to do.. it tels me my passphrase is incorrect (i Xed it out in this post) while i double checked and copy pasted it straight from the GDAX site..

08:28:46,975 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml] 08:28:46,975 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy] 08:28:46,976 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/Users/pieterdirix/Downloads/XChange-develop/xchange-examples/target/classes/logback.xml] 08:28:47,052 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set 08:28:47,052 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 08:28:47,061 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE_APPENDER] 08:28:47,072 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 08:28:47,119 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender] 08:28:47,123 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [DETAIL_APPENDER] 08:28:47,146 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@66233253 - Will use gz compression 08:28:47,148 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@66233253 - Will use the pattern log/xchange-detail-%d{yyyy-MM-dd}.%i.log for the active file 08:28:47,150 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4cb2c100 - The date pattern is 'yyyy-MM-dd' from file name pattern 'log/xchange-detail-%d{yyyy-MM-dd}.%i.log.gz'. 08:28:47,150 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4cb2c100 - Roll-over at midnight. 08:28:47,153 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4cb2c100 - Setting initial period to Tue May 09 08:25:14 CEST 2017 08:28:47,154 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4cb2c100 - SizeAndTimeBasedFNATP is deprecated. Use SizeAndTimeBasedRollingPolicy instead 08:28:47,154 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4cb2c100 - For more information see http://logback.qos.ch/manual/appenders.html#SizeAndTimeBasedRollingPolicy 08:28:47,155 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 08:28:52,166 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[DETAIL_APPENDER] - Active log file name: log/xchange-detail.log 08:28:52,166 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[DETAIL_APPENDER] - File property is set to [log/xchange-detail.log] 08:28:52,167 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN 08:28:52,167 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE_APPENDER] to Logger[ROOT] 08:28:52,168 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [DETAIL_APPENDER] to Logger[ROOT] 08:28:52,168 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.knowm.xchange] to DEBUG 08:28:52,169 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [si.mazi.rescu] to TRACE 08:28:52,169 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration. 08:28:52,169 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@6fb554cc - Registering current configuration as safe fallback point

08:28:52.175 [default] [main] DEBUG org.knowm.xchange.ExchangeFactory - Creating exchange from specification 08:28:52.428 [default] [main] DEBUG org.knowm.xchange.gdax.GDAXExchange - ExchangeMetaData [currencyPairs={BTC/GBP=CurrencyPairMetaData [tradingFee=null, minimumAmount=0.01, maximumAmount=10000.00, priceScale=8], BTC/USD=CurrencyPairMetaData [tradingFee=null, minimumAmount=0.01, maximumAmount=10000.00, priceScale=8], ETH/USD=CurrencyPairMetaData [tradingFee=null, minimumAmount=0.01, maximumAmount=1000000.00, priceScale=8], BTC/EUR=CurrencyPairMetaData [tradingFee=null, minimumAmount=0.01, maximumAmount=10000.00, priceScale=8], ETH/BTC=CurrencyPairMetaData [tradingFee=null, minimumAmount=0.01000, maximumAmount=1000000.00000, priceScale=8], LTC/USD=CurrencyPairMetaData [tradingFee=null, minimumAmount=0.01, maximumAmount=1000000.00, priceScale=8], LTC/BTC=CurrencyPairMetaData [tradingFee=null, minimumAmount=0.01000, maximumAmount=1000000.00000, priceScale=8]}, currencies={EUR=null, LTC=null, USD=null, BTC=null, ETH=null, GBP=null}, publicRateLimits=[RateLimit [calls=3, timeSpan=1, timeUnit=SECONDS]], privateRateLimits=[RateLimit [calls=5, timeSpan=1, timeUnit=SECONDS]], shareRateLimits=false] 08:28:52.439 [default] [main] DEBUG si.mazi.rescu.Config - Configuration from rescu.properties: 08:28:52.439 [default] [main] DEBUG si.mazi.rescu.Config - httpConnTimeout = 30000 08:28:52.440 [default] [main] DEBUG si.mazi.rescu.Config - httpReadTimeout = 30000 08:28:52.441 [default] [main] DEBUG si.mazi.rescu.Config - proxyHost = null 08:28:52.441 [default] [main] DEBUG si.mazi.rescu.Config - proxyPort = null 08:28:52.441 [default] [main] DEBUG si.mazi.rescu.Config - ignoreHttpErrorCodes = false 08:28:52.459 [default] [main] INFO org.knowm.xchange.gdax.GDAXExchange - Calling Remote Init... 08:28:52.469 [default] [main] DEBUG si.mazi.rescu.HttpTemplate - Executing GET request at https://api.gdax.com/products 08:28:52.469 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Request body =
08:28:52.469 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Request headers = {Accept=application/json} 08:28:52.674 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='Accept-Charset', value='UTF-8' 08:28:52.675 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='User-Agent', value='ResCU JDK/6 AppleWebKit/535.7 Chrome/16.0.912.36 Safari/535.7' 08:28:52.675 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='Accept', value='application/json' 08:28:53.266 [default] [main] DEBUG si.mazi.rescu.HttpTemplate - Request http status = 200 08:28:53.269 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Http call returned 200; response body: [{"id":"BTC-GBP","base_currency":"BTC","quote_currency":"GBP","base_min_size":"0.01","base_max_size":"10000","quote_increment":"0.01","display_name":"BTC/GBP"},{"id":"BTC-USD","base_currency":"BTC","quote_currency":"USD","base_min_size":"0.01","base_max_size":"10000","quote_increment":"0.01","display_name":"BTC/USD"},{"id":"ETH-USD","base_currency":"ETH","quote_currency":"USD","base_min_size":"0.01","base_max_size":"1000000","quote_increment":"0.01","display_name":"ETH/USD"},{"id":"LTC-USD","base_currency":"LTC","quote_currency":"USD","base_min_size":"0.01","base_max_size":"1000000","quote_increment":"0.01","display_name":"LTC/USD"},{"id":"ETH-BTC","base_currency":"ETH","quote_currency":"BTC","base_min_size":"0.01","base_max_size":"1000000","quote_increment":"0.00001","display_name":"ETH/BTC"},{"id":"LTC-BTC","base_currency":"LTC","quote_currency":"BTC","base_min_size":"0.01","base_max_size":"1000000","quote_increment":"0.00001","display_name":"LTC/BTC"},{"id":"BTC-EUR","base_currency":"BTC","quote_currency":"EUR","base_min_size":"0.01","base_max_size":"10000","quote_increment":"0.01","display_name":"BTC/EUR"}] 08:28:53.308 [default] [main] DEBUG si.mazi.rescu.HttpTemplate - Executing POST request at https://api.gdax.com/orders 08:28:53.308 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Request body = {"size":0.001,"price":1500.00,"side":"sell","product_id":"BTC-EUR","type":"limit"} 08:28:53.308 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Request headers = {CB-ACCESS-TIMESTAMP=1494311333, CB-ACCESS-SIGN=fnlGdNU1ziD6pGyhRJV7f45BvTdFpqH1cK0oIK/SlZw=, CB-ACCESS-KEY=e44fe39b7521229d5a1b51b291b40a82, CB-ACCESS-PASSPHRASE=xxxxx08:28:46,975 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml] 08:28:46,975 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy] 08:28:46,976 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/Users/pieterdirix/Downloads/XChange-develop/xchange-examples/target/classes/logback.xml] 08:28:47,052 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set 08:28:47,052 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 08:28:47,061 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE_APPENDER] 08:28:47,072 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 08:28:47,119 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender] 08:28:47,123 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [DETAIL_APPENDER] 08:28:47,146 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@66233253 - Will use gz compression 08:28:47,148 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@66233253 - Will use the pattern log/xchange-detail-%d{yyyy-MM-dd}.%i.log for the active file 08:28:47,150 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4cb2c100 - The date pattern is 'yyyy-MM-dd' from file name pattern 'log/xchange-detail-%d{yyyy-MM-dd}.%i.log.gz'. 08:28:47,150 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4cb2c100 - Roll-over at midnight. 08:28:47,153 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4cb2c100 - Setting initial period to Tue May 09 08:25:14 CEST 2017 08:28:47,154 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4cb2c100 - SizeAndTimeBasedFNATP is deprecated. Use SizeAndTimeBasedRollingPolicy instead 08:28:47,154 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@4cb2c100 - For more information see http://logback.qos.ch/manual/appenders.html#SizeAndTimeBasedRollingPolicy 08:28:47,155 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 08:28:52,166 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[DETAIL_APPENDER] - Active log file name: log/xchange-detail.log 08:28:52,166 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[DETAIL_APPENDER] - File property is set to [log/xchange-detail.log] 08:28:52,167 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN 08:28:52,167 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE_APPENDER] to Logger[ROOT] 08:28:52,168 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [DETAIL_APPENDER] to Logger[ROOT] 08:28:52,168 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.knowm.xchange] to DEBUG 08:28:52,169 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [si.mazi.rescu] to TRACE 08:28:52,169 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration. 08:28:52,169 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@6fb554cc - Registering current configuration as safe fallback point

08:28:52.175 [default] [main] DEBUG org.knowm.xchange.ExchangeFactory - Creating exchange from specification 08:28:52.428 [default] [main] DEBUG org.knowm.xchange.gdax.GDAXExchange - ExchangeMetaData [currencyPairs={BTC/GBP=CurrencyPairMetaData [tradingFee=null, minimumAmount=0.01, maximumAmount=10000.00, priceScale=8], BTC/USD=CurrencyPairMetaData [tradingFee=null, minimumAmount=0.01, maximumAmount=10000.00, priceScale=8], ETH/USD=CurrencyPairMetaData [tradingFee=null, minimumAmount=0.01, maximumAmount=1000000.00, priceScale=8], BTC/EUR=CurrencyPairMetaData [tradingFee=null, minimumAmount=0.01, maximumAmount=10000.00, priceScale=8], ETH/BTC=CurrencyPairMetaData [tradingFee=null, minimumAmount=0.01000, maximumAmount=1000000.00000, priceScale=8], LTC/USD=CurrencyPairMetaData [tradingFee=null, minimumAmount=0.01, maximumAmount=1000000.00, priceScale=8], LTC/BTC=CurrencyPairMetaData [tradingFee=null, minimumAmount=0.01000, maximumAmount=1000000.00000, priceScale=8]}, currencies={EUR=null, LTC=null, USD=null, BTC=null, ETH=null, GBP=null}, publicRateLimits=[RateLimit [calls=3, timeSpan=1, timeUnit=SECONDS]], privateRateLimits=[RateLimit [calls=5, timeSpan=1, timeUnit=SECONDS]], shareRateLimits=false] 08:28:52.439 [default] [main] DEBUG si.mazi.rescu.Config - Configuration from rescu.properties: 08:28:52.439 [default] [main] DEBUG si.mazi.rescu.Config - httpConnTimeout = 30000 08:28:52.440 [default] [main] DEBUG si.mazi.rescu.Config - httpReadTimeout = 30000 08:28:52.441 [default] [main] DEBUG si.mazi.rescu.Config - proxyHost = null 08:28:52.441 [default] [main] DEBUG si.mazi.rescu.Config - proxyPort = null 08:28:52.441 [default] [main] DEBUG si.mazi.rescu.Config - ignoreHttpErrorCodes = false 08:28:52.459 [default] [main] INFO org.knowm.xchange.gdax.GDAXExchange - Calling Remote Init... 08:28:52.469 [default] [main] DEBUG si.mazi.rescu.HttpTemplate - Executing GET request at https://api.gdax.com/products 08:28:52.469 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Request body =
08:28:52.469 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Request headers = {Accept=application/json} 08:28:52.674 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='Accept-Charset', value='UTF-8' 08:28:52.675 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='User-Agent', value='ResCU JDK/6 AppleWebKit/535.7 Chrome/16.0.912.36 Safari/535.7' 08:28:52.675 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='Accept', value='application/json' 08:28:53.266 [default] [main] DEBUG si.mazi.rescu.HttpTemplate - Request http status = 200 08:28:53.269 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Http call returned 200; response body: [{"id":"BTC-GBP","base_currency":"BTC","quote_currency":"GBP","base_min_size":"0.01","base_max_size":"10000","quote_increment":"0.01","display_name":"BTC/GBP"},{"id":"BTC-USD","base_currency":"BTC","quote_currency":"USD","base_min_size":"0.01","base_max_size":"10000","quote_increment":"0.01","display_name":"BTC/USD"},{"id":"ETH-USD","base_currency":"ETH","quote_currency":"USD","base_min_size":"0.01","base_max_size":"1000000","quote_increment":"0.01","display_name":"ETH/USD"},{"id":"LTC-USD","base_currency":"LTC","quote_currency":"USD","base_min_size":"0.01","base_max_size":"1000000","quote_increment":"0.01","display_name":"LTC/USD"},{"id":"ETH-BTC","base_currency":"ETH","quote_currency":"BTC","base_min_size":"0.01","base_max_size":"1000000","quote_increment":"0.00001","display_name":"ETH/BTC"},{"id":"LTC-BTC","base_currency":"LTC","quote_currency":"BTC","base_min_size":"0.01","base_max_size":"1000000","quote_increment":"0.00001","display_name":"LTC/BTC"},{"id":"BTC-EUR","base_currency":"BTC","quote_currency":"EUR","base_min_size":"0.01","base_max_size":"10000","quote_increment":"0.01","display_name":"BTC/EUR"}] 08:28:53.308 [default] [main] DEBUG si.mazi.rescu.HttpTemplate - Executing POST request at https://api.gdax.com/orders 08:28:53.308 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Request body = {"size":0.001,"price":1500.00,"side":"sell","product_id":"BTC-EUR","type":"limit"} 08:28:53.308 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Request headers = {CB-ACCESS-TIMESTAMP=1494311333, CB-ACCESS-SIGN=fnlGdNU1ziD6pGyhRJV7f45BvTdFpqH1cK0oIK/SlZw=, CB-ACCESS-KEY=e44fe39b7521229d5a1b51b291b40a82, CB-ACCESS-PASSPHRASE=xxxxx, Accept=application/json, Content-Type=application/json} 08:28:53.308 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='Accept-Charset', value='UTF-8' 08:28:53.308 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='CB-ACCESS-TIMESTAMP', value='1494311333' 08:28:53.308 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='CB-ACCESS-SIGN', value='fnlGdNU1ziD6pGyhRJV7f45BvTdFpqH1cK0oIK/SlZw=' 08:28:53.309 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='Accept', value='application/json' 08:28:53.309 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='CB-ACCESS-PASSPHRASE', value='xxxxx' 08:28:53.309 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='User-Agent', value='ResCU JDK/6 AppleWebKit/535.7 Chrome/16.0.912.36 Safari/535.7' 08:28:53.309 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='CB-ACCESS-KEY', value='e44fe39b7521229d5a1b51b291b40a82' 08:28:53.309 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='Content-Type', value='application/json' 08:28:53.785 [default] [main] DEBUG si.mazi.rescu.HttpTemplate - Request http status = 400 08:28:53.786 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Http call returned 400; response body: {"message":"Invalid Passphrase"} Exception in thread "main" org.knowm.xchange.gdax.dto.GDAXException: Invalid Passphrase (HTTP status code: 400) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.fasterxml.jackson.databind.introspect.AnnotatedConstructor.call(AnnotatedConstructor.java:124) at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromObjectWith(StdValueInstantiator.java:274) at com.fasterxml.jackson.databind.deser.ValueInstantiator.createFromObjectWith(ValueInstantiator.java:224) at com.fasterxml.jackson.databind.deser.impl.PropertyBasedCreator.build(PropertyBasedCreator.java:135) at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:401) at com.fasterxml.jackson.databind.deser.std.ThrowableDeserializer.deserializeFromObject(ThrowableDeserializer.java:65) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:148) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3789) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2871) at si.mazi.rescu.serialization.jackson.JacksonResponseReader.read(JacksonResponseReader.java:53) at si.mazi.rescu.serialization.jackson.JacksonResponseReader.readException(JacksonResponseReader.java:58) at si.mazi.rescu.ResponseReader.read(ResponseReader.java:82) 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) at com.sun.proxy.$Proxy12.placeLimitOrder(Unknown Source) at org.knowm.xchange.gdax.service.GDAXTradeServiceRaw.placeCoinbaseExLimitOrder(GDAXTradeServiceRaw.java:47) at org.knowm.xchange.gdax.service.GDAXTradeService.placeLimitOrder(GDAXTradeService.java:52) at org.knowm.xchange.examples.gdax.test.generic(test.java:70) at org.knowm.xchange.examples.gdax.test.main(test.java:47), Accept=application/json, Content-Type=application/json} 08:28:53.308 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='Accept-Charset', value='UTF-8' 08:28:53.308 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='CB-ACCESS-TIMESTAMP', value='1494311333' 08:28:53.308 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='CB-ACCESS-SIGN', value='fnlGdNU1ziD6pGyhRJV7f45BvTdFpqH1cK0oIK/SlZw=' 08:28:53.309 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='Accept', value='application/json' 08:28:53.309 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='CB-ACCESS-PASSPHRASE', value='xxxx' 08:28:53.309 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='User-Agent', value='ResCU JDK/6 AppleWebKit/535.7 Chrome/16.0.912.36 Safari/535.7' 08:28:53.309 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='CB-ACCESS-KEY', value='e44fe39b7521229d5a1b51b291b40a82' 08:28:53.309 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Header request property: key='Content-Type', value='application/json' 08:28:53.785 [default] [main] DEBUG si.mazi.rescu.HttpTemplate - Request http status = 400 08:28:53.786 [default] [main] TRACE si.mazi.rescu.HttpTemplate - Http call returned 400; response body: {"message":"Invalid Passphrase"} Exception in thread "main" org.knowm.xchange.gdax.dto.GDAXException: Invalid Passphrase (HTTP status code: 400) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.fasterxml.jackson.databind.introspect.AnnotatedConstructor.call(AnnotatedConstructor.java:124) at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromObjectWith(StdValueInstantiator.java:274) at com.fasterxml.jackson.databind.deser.ValueInstantiator.createFromObjectWith(ValueInstantiator.java:224) at com.fasterxml.jackson.databind.deser.impl.PropertyBasedCreator.build(PropertyBasedCreator.java:135) at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:401) at com.fasterxml.jackson.databind.deser.std.ThrowableDeserializer.deserializeFromObject(ThrowableDeserializer.java:65) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:148) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3789) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2871) at si.mazi.rescu.serialization.jackson.JacksonResponseReader.read(JacksonResponseReader.java:53) at si.mazi.rescu.serialization.jackson.JacksonResponseReader.readException(JacksonResponseReader.java:58) at si.mazi.rescu.ResponseReader.read(ResponseReader.java:82) 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) at com.sun.proxy.$Proxy12.placeLimitOrder(Unknown Source) at org.knowm.xchange.gdax.service.GDAXTradeServiceRaw.placeCoinbaseExLimitOrder(GDAXTradeServiceRaw.java:47) at org.knowm.xchange.gdax.service.GDAXTradeService.placeLimitOrder(GDAXTradeService.java:52) at org.knowm.xchange.examples.gdax.test.generic(test.java:70) at org.knowm.xchange.examples.gdax.test.main(test.java:47)

pieterdirix avatar May 09 '17 06:05 pieterdirix

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.

ww3456 avatar May 09 '17 06:05 ww3456

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.

pieterdirix avatar May 09 '17 09:05 pieterdirix