cassandre-tech / cassandre-trading-bot

Create your Java crypto trading bot in minutes. Our Spring boot starter takes care of exchange connections, accounts, orders, trades, and positions so you can focus on building your strategies.
https://trading-bot.cassandre.tech
GNU General Public License v3.0
583 stars 166 forks source link

Possible bug. #1038

Closed jechaviz closed 1 year ago

jechaviz commented 2 years ago

Release number 6.0.0

Describe the bug After start, these errors are thrown. 02:18:11.958 ERROR AccountFlux encountered an error Cannot invoke "reactor.core.publisher.FluxSink.next(Object)" because "this.fluxSink" is null 02:18:12.708 ERROR TickerFlux encountered an error Cannot invoke "reactor.core.publisher.FluxSink.next(Object)" because "this.fluxSink" is null

To Reproduce pom.xml:

`<?xml version="1.0" encoding="UTF-8"?>

4.0.0 bot linnear-channels-bot jar 1.0-SNAPSHOT 17 17 17 UTF-8 UTF-8 2.7.0 Dysprosium-SR25 5.0.13 7.5.0 4.14.0 5.6 1.18.24 0.2.0 1.5.2.Final 31.1-jre 1.7.1 4.2.0 2.6.1 2.13.3 5.0.5 3.1.2 1.18 10.3.2 3.3.0 3.10.1 2.22.2 0.8.8 2.22.2 1.18.20.0 3.2.1 3.4.0 3.2.2 3.2.1 6.0.0 org.springframework.boot spring-boot-starter ${spring.version} org.hsqldb hsqldb ${hsqldb.version} tech.cassandre.trading.bot cassandre-trading-bot-spring-boot-starter ${cassandre.version} org.knowm.xchange xchange-binance ${xchange.version} org.knowm.xchange xchange-simulated ${xchange.version} tech.cassandre.trading.bot cassandre-trading-bot-spring-boot-starter-api-graphql ${cassandre.version} com.github.vladimir-bukhtoyarov bucket4j-core ${bucket4j.version} org.slf4j slf4j-api 1.7.36 org.projectlombok lombok ${lombok.version} provided org.mapstruct mapstruct ${mapstruct.version} com.google.guava guava ${guava.version} com.fasterxml.jackson.dataformat jackson-dataformat-xml ${jackson.version} com.opencsv opencsv ${opencsv.version} commons-io commons-io 2.11.0 org.seleniumhq.selenium selenium-java 4.2.1 io.github.bonigarcia webdrivermanager 5.2.0 org.apache.commons commons-math3 3.6.1 org.springframework.boot spring-boot-starter-test ${spring.version} test org.junit.vintage junit-vintage-engine org.awaitility awaitility ${awaitility.version} test tech.cassandre.trading.bot cassandre-trading-bot-spring-boot-starter-test ${cassandre.version} test org.springframework.boot spring-boot-maven-plugin ${spring.version} org.apache.maven.plugins maven-surefire-plugin ${maven.surefire.plugin.version} org.apache.maven.plugins maven-failsafe-plugin ${maven.failsafe.plugin.version} ossrh https://oss.sonatype.org/content/repositories/snapshots ossrh https://oss.sonatype.org/service/local/staging/deploy/maven2/ ` application.properties cassandre.trading.bot.exchange.driver-class-name=org.knowm.xchange.binance.BinanceExchange cassandre.trading.bot.exchange.username=*** cassandre.trading.bot.exchange.passphrase=*** cassandre.trading.bot.exchange.key=*** cassandre.trading.bot.exchange.secret=*** cassandre.trading.bot.exchange.modes.sandbox=false cassandre.trading.bot.exchange.modes.dry=true cassandre.trading.bot.exchange.rates.account=PT30S cassandre.trading.bot.exchange.rates.ticker=PT30S cassandre.trading.bot.exchange.rates.trade=PT30S spring.datasource.driver-class-name=org.hsqldb.jdbc.JDBCDriver spring.datasource.url=jdbc:hsqldb:mem:cassandre-database #spring.datasource.url=jdbc:hsqldb:file:db #spring.datasource.url=jdbc:hsqldb:mem:secure-trading #spring.datasource.url=jdbc:hsqldb spring.datasource.username=sa spring.datasource.password= spring.output.ansi.enabled=always logging.pattern.console=%d{HH:mm:ss} - %msg%n logging.level.web=debug logging.level.root=warn logging.level.org.springframework=warn logging.level.org.hibernate=warn logging.level.org.starmonkey.brown=DEBUG spring.main.lazy-initialization=true spring.jmx.enabled=false`
straumat commented 2 years ago

Are you using java 17 ?

jechaviz commented 2 years ago

Yes, this is the information:

java 17.0.2 2022-01-18 LTS Java(TM) SE Runtime Environment (build 17.0.2+8-LTS-86) Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)

image

straumat commented 2 years ago

Can you try a mvn test and copy the full stack trace error ? THx

straumat commented 2 years ago

very strange.... can you do it again with the -U option please ?

jechaviz commented 2 years ago

Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63) Maven home: C:\Program Files\apache-maven-3.8.6 Java version: 17.0.2, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-17.0.2 Default locale: es_MX, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Too much lines before, but these are test results_ [INFO] Results: [INFO] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:02 min [INFO] Finished at: 2022-08-17T16:20:34-05:00 [INFO] ------------------------------------------------------------------------

jechaviz commented 2 years ago

16:21:57.826 WARN spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning 16:22:03.371 ERROR TickerFlux encountered an error Cannot invoke "reactor.core.publisher.FluxSink.next(Object)" because "this.fluxSink" is null 16:22:30.756 ERROR TickerFlux encountered an error Cannot invoke "reactor.core.publisher.FluxSink.next(Object)" because "this.fluxSink" is null ...many more equal rows... .... 16:31:10.680 ERROR Error retrieving tickers: api.binance.com 16:31:42.403 ERROR TickerFlux encountered an error Cannot invoke "reactor.core.publisher.FluxSink.next(Object)" because "this.fluxSink" is null 16:32:01.795 ERROR TickerFlux encountered an error Cannot invoke "reactor.core.publisher.FluxSink.next(Object)" because "this.fluxSink" is null ...many more equal rows...

straumat commented 2 years ago

set cassandre.trading.bot.exchange.modes.dry to false in src/main/ressources and try to run your bot again

jechaviz commented 2 years ago

cassandre.trading.bot.exchange.modes.dry=false same results

jechaviz commented 2 years ago

I tried with 5.0.8 and it gives me this detail: java.lang.NullPointerException: Cannot invoke "reactor.core.publisher.FluxSink.next(Object)" because "this.fluxSink" is null at tech.cassandre.trading.bot.util.base.batch.BaseFlux.emitValues(BaseFlux.java:67) at tech.cassandre.trading.bot.util.base.batch.BaseFlux.update(BaseFlux.java:76) at tech.cassandre.trading.bot.configuration.ScheduleAutoConfiguration.tickerFluxUpdate(ScheduleAutoConfiguration.java:94) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833)

straumat commented 2 years ago

@jechaviz Can you try on another computer ? It's very strange as I don't have this problem on my computer and on my CI. Also, can you put the sources where I could download them and try by myself ? (REMOVE YOUR CREDENTIALS !))

jechaviz commented 2 years ago

You can download the source code from here: https://store5.gofile.io/download/e94507ce-b9d2-4726-bf71-a83dbcbfb6ca/LinnearChannelsBot.zip

Thank you.

straumat commented 2 years ago

@jechaviz it runs on my computer :

[INFO] Attaching agents: []
09:02:26.253 TRACE Loaded [org.springframework.boot.logging.LoggingSystemFactory] names: [org.springframework.boot.logging.logback.LogbackLoggingSystem.Factory, org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.Factory, org.springframework.boot.logging.java.JavaLoggingSystem.Factory] 

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.6.6)

09:02:27.920 DEBUG Mapping filters: springSecurityFilterChain urls=[/*] order=-100, filterRegistrationBean urls=[/*] order=2147483647, characterEncodingFilter urls=[/*] order=-2147483648, formContentFilter urls=[/*] order=-9900, requestContextFilter urls=[/*] order=-105 
09:02:27.921 DEBUG Mapping servlets: dispatcherServlet urls=[/] 
09:02:30.208 WARN Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tech.cassandre.trading.bot.configuration.ScheduleAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tech.cassandre.trading.bot.configuration.ExchangeAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'cassandre.trading.bot.exchange-tech.cassandre.trading.bot.util.parameters.ExchangeParameters': Could not bind properties to 'ExchangeParameters' : prefix=cassandre.trading.bot.exchange, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'cassandre.trading.bot.exchange' to tech.cassandre.trading.bot.util.parameters.ExchangeParameters 
09:02:30.233 ERROR 

***************************
APPLICATION FAILED TO START
***************************

Description:

Binding to target org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'cassandre.trading.bot.exchange' to tech.cassandre.trading.bot.util.parameters.ExchangeParameters failed:

    Property: cassandre.trading.bot.exchange.secret
    Value: 
    Origin: class path resource [application.properties] - 12:0
    Reason: API secret required

    Property: cassandre.trading.bot.exchange.key
    Value: 
    Origin: class path resource [application.properties] - 11:0
    Reason: API key required

    Property: cassandre.trading.bot.exchange.username
    Value: 
    Origin: class path resource [application.properties] - 9:0
    Reason: API username required

Action:

Update your application's configuration