final IEXCloudClient cloudClient = IEXTradingClient.create(IEXTradingApiVersion.IEX_CLOUD_BETA_SANDBOX,
new IEXCloudTokenBuilder().withPublishableToken("Tpk_18dfe6cebb4f41ffb219b9680f9acaf2")
.withSecretToken("Tsk_3eedff6f5c284e1a8b9bc16c54dd1af3").build());
final Consumer<TOPS> TOPS_CONSUMER = System.out::println;
final SseRequest<TOPS> request = new TopsSseRequestBuilder().withSymbol("spy").build();
cloudClient.subscribe(request, TOPS_CONSUMER);
Jul 12, 2019 12:57:51 PM org.glassfish.jersey.media.sse.internal.JerseySseEventSource lambda$static$1
WARNING: Subscriber.onError() called on subscriber with no registered error handler.
javax.ws.rs.ProcessingException: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `pl.zankowski.iextrading4j.api.marketdata.TOPS` out of START_ARRAY token
at [Source: (ByteArrayInputStream); line: 1, column: 1]
at org.glassfish.jersey.media.sse.InboundEvent.readAndCast(InboundEvent.java:373)
at org.glassfish.jersey.media.sse.InboundEvent.readData(InboundEvent.java:359)
at pl.zankowski.iextrading4j.client.sse.manager.SseManager.lambda$0(SseManager.java:38)
at org.glassfish.jersey.media.sse.internal.JerseySseEventSource$1.onNext(JerseySseEventSource.java:146)
at org.glassfish.jersey.media.sse.internal.JerseySseEventSource$1.onNext(JerseySseEventSource.java:128)
at org.glassfish.jersey.internal.util.JerseyPublisher$SubscriberWrapper.onNext(JerseyPublisher.java:391)
at org.glassfish.jersey.internal.jsr166.SubmissionPublisher$BufferedSubscription.consume(SubmissionPublisher.java:1500)
at org.glassfish.jersey.internal.jsr166.SubmissionPublisher$ConsumerTask.run(SubmissionPublisher.java:953)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `pl.zankowski.iextrading4j.api.marketdata.TOPS` out of START_ARRAY token
at [Source: (ByteArrayInputStream); line: 1, column: 1]
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1343)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1139)
at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1093)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromArray(BeanDeserializerBase.java:1461)
at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:185)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:161)
at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1574)
at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:965)
at org.glassfish.jersey.jackson.internal.jackson.jaxrs.base.ProviderBase.readFrom(ProviderBase.java:838)
at org.glassfish.jersey.media.sse.InboundEvent.readAndCast(InboundEvent.java:365)
... 12 more
{"symbol":"SPY","companyName":"SPDR S&P 500 ETF Trust","calculationPrice":"tops","open":299.86,"openTime":1562938200171,"close":299.31,"closeTime":1562875200166,"high":300.5,"low":299.51,"latestPrice":300.55,"latestSource":"IEX real time price","latestTime":"3:53:23 PM","latestUpdate":1562961203133,"latestVolume":31681768,"iexRealtimePrice":300.55,"iexRealtimeSize":1,"iexLastUpdated":1562961203133,"delayedPrice":300.48,"delayedPriceTime":1562960307776,"extendedPrice":299.85,"extendedChange":-0.7,"extendedChangePercent":-0.00233,"extendedPriceTime":1562938200341,"previousClose":299.31,"change":1.24,"changePercent":0.00414,"iexMarketPercent":0.021848244075267517,"iexVolume":692191,"avgTotalVolume":63981281,"iexBidPrice":300.54,"iexBidSize":500,"iexAskPrice":300.56,"iexAskSize":1000,"marketCap":0,"peRatio":null,"week52High":300.55,"week52Low":233.76,"ytdChange":0.200519,"lastTradeTime":1562961203133}