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

Brit here.. prob something obvious .. git cloned, imported.. ran exampleGeneralEndPointsExample and it blew with #30

Open
johnda98 opened this issue Jul 9, 2020 · 0 comments

Comments

@johnda98
Copy link

johnda98 commented Jul 9, 2020

it started off well in the console.. then overwrote some its output then sea of red ..

this is from eclipse and I'm fairly savy on not missing obvious deals.. I want to get this running to pull a price pair into a java GCP Servlet .. I did that also with the code underneath this log.. and that blew with a GCP server 500.. any help on either appreciated .. thanks great guys n gals !!

TRADING
0.00000100
0.00000100
Exception in thread "main" com.binance.api.client.exception.BinanceApiException: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.util.ArrayList out of START_OBJECT token
at [Source: (okhttp3.ResponseBody$BomAwareReader); line: 1, column: 1]
at com.binance.api.client.impl.BinanceApiServiceGenerator.executeSync(BinanceApiServiceGenerator.java:81)
at com.binance.api.client.impl.BinanceApiRestClientImpl.getAllAssets(BinanceApiRestClientImpl.java:48)
at com.binance.api.examples.GeneralEndpointsExample.main(GeneralEndpointsExample.java:43)
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.util.ArrayList out of START_OBJECT token
at [Source: (okhttp3.ResponseBody$BomAwareReader); line: 1, column: 1]
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1342)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1138)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1092)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.handleNonArray(CollectionDeserializer.java:332)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:265)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1611)
at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1203)
at retrofit2.converter.jackson.JacksonResponseBodyConverter.convert(JacksonResponseBodyConverter.java:32)
at retrofit2.converter.jackson.JacksonResponseBodyConverter.convert(JacksonResponseBodyConverter.java:23)
at retrofit2.ServiceMethod.toResponse(ServiceMethod.java:122)
at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:217)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)
at com.binance.api.client.impl.BinanceApiServiceGenerator.executeSync(BinanceApiServiceGenerator.java:73)
... 2 more

try {
BinanceApiClientFactory factory = BinanceApiClientFactory.newInstance();
BinanceApiRestClient client = factory.newRestClient();

		 	    // Test connectivity
		 	    client.ping();

		 	   long serverTime = client.getServerTime();
		 	   out.println("<p> Time of ticker from Binance - its Servertime : " + serverTime + "</p>");
		    	
		 	    
		 		TickerStatistics tickerStatistics = client.get24HrPriceStatistics("NEOETH");
		 		out.println("<p> NEO ETH : " + tickerStatistics.getLastPrice() + "</p>");
		    	
		 		
		    	
		 		String price = tickerStatistics.getLastPrice().toString();
		 		out.println("<p> as string .. " + price + "</p>");
		 		
		 		TickerStatistics tickerStatistics2 = client.get24HrPriceStatistics("HBARUSDT");
		 		out.println("<p> HBAR USDT : " + tickerStatistics2.getLastPrice() + "</p>");
		    	
		 		}
		 		catch (BinanceApiException ex){
		 			
		 			LOGGER.log(Level.WARNING, "Exception when calling Binance API", ex);
			 	      response.setStatus(500);
			 	      response.getWriter().write("Unable to call Binance - see GCP  "
			 	          + "logs for more details." + ex.getError().getCode() + " and message " + ex.getError().getMsg());
			 	      
			 	     //System.out.println(e.getError().getCode()); // -1121
			 	     //System.out.println(e.getError().getMsg());  // Invalid symbol
			 	      
			 	       out.println("<p> </p><br>");
			 	       out.println("<a href='index.html'>Back</a>");
			 	       
			 	       out.println("</body>");
			 	       out.println("</html>");
			 	       out.close();  // Always close the output writer
			 	      
		 			
		 			return;
		 			
		 		}
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

1 participant