cassandre-trading-bot icon indicating copy to clipboard operation
cassandre-trading-bot copied to clipboard

Possible bug.

Open jechaviz opened this issue 3 years ago • 12 comments

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"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <!-- Project information --> <groupId>bot</groupId> <artifactId>linnear-channels-bot</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <!-- Project configuration --> <properties> <!-- Java build configuration --> <java.version>17</java.version> <maven.compiler.target>17</maven.compiler.target> <maven.compiler.source>17</maven.compiler.source> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <!-- Libraries releases --> <!-- Core --> <spring.version>2.7.0</spring.version> <reactor.version>Dysprosium-SR25</reactor.version> <xchange.version>5.0.13</xchange.version> <bucket4j.version>7.5.0</bucket4j.version> <liquibase.version>4.14.0</liquibase.version> <opencsv.version>5.6</opencsv.version> <!-- Core utils --> <lombok.version>1.18.24</lombok.version> <lombok.mapstruct.version>0.2.0</lombok.mapstruct.version> <mapstruct.version>1.5.2.Final</mapstruct.version> <guava.version>31.1-jre</guava.version> <!-- Tests --> <junit-pioneer.version>1.7.1</junit-pioneer.version> <awaitility.version>4.2.0</awaitility.version> <hsqldb.version>2.6.1</hsqldb.version> <jackson.version>2.13.3</jackson.version> <!-- GraphQL API --> <graphql-dgs.version>5.0.5</graphql-dgs.version> <!-- Maven --> <maven.checkstyle.plugin.version>3.1.2</maven.checkstyle.plugin.version> <maven.graphqlcodegen.plugin.version>1.18</maven.graphqlcodegen.plugin.version> <maven.puppycrawl.checkstyle.version>10.3.2</maven.puppycrawl.checkstyle.version> <maven.resources.plugin.version>3.3.0</maven.resources.plugin.version> <maven.compiler.plugin.version>3.10.1</maven.compiler.plugin.version> <maven.surefire.plugin.version>2.22.2</maven.surefire.plugin.version> <maven.jacoco.plugin.version>0.8.8</maven.jacoco.plugin.version> <maven.failsafe.plugin.version>2.22.2</maven.failsafe.plugin.version> <maven.lombok.plugin.version>1.18.20.0</maven.lombok.plugin.version> <maven.source.plugin.version>3.2.1</maven.source.plugin.version> <maven.javadoc.plugin.version>3.4.0</maven.javadoc.plugin.version> <maven.jar.plugin.version>3.2.2</maven.jar.plugin.version> <maven.archetype-packaging.version>3.2.1</maven.archetype-packaging.version> <!-- Cassandre version --> <cassandre.version>6.0.0</cassandre.version> </properties> <!-- Dependencies --> <dependencies> <!-- Spring dependencies --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.hsqldb</groupId> <artifactId>hsqldb</artifactId> <version>${hsqldb.version}</version> </dependency> <!-- Cassandre trading bot --> <dependency> <groupId>tech.cassandre.trading.bot</groupId> <artifactId>cassandre-trading-bot-spring-boot-starter</artifactId> <version>${cassandre.version}</version> </dependency> <!-- <dependency> <groupId>org.knowm.xchange</groupId> <artifactId>xchange-kucoin</artifactId> <version>5.0.12</version> </dependency> --> <dependency> <groupId>org.knowm.xchange</groupId> <artifactId>xchange-binance</artifactId> <version>${xchange.version}</version> </dependency> <dependency> <groupId>org.knowm.xchange</groupId> <artifactId>xchange-simulated</artifactId> <version>${xchange.version}</version> </dependency> <!-- GraphQL API --> <dependency> <groupId>tech.cassandre.trading.bot</groupId> <artifactId>cassandre-trading-bot-spring-boot-starter-api-graphql</artifactId> <version>${cassandre.version}</version> </dependency> <!-- Util --> <dependency> <groupId>com.github.vladimir-bukhtoyarov</groupId> <artifactId>bucket4j-core</artifactId> <version>${bucket4j.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.36</version> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.mapstruct</groupId> <artifactId>mapstruct</artifactId> <version>${mapstruct.version}</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>${guava.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-xml</artifactId> <version>${jackson.version}</version> </dependency> <dependency> <groupId>com.opencsv</groupId> <artifactId>opencsv</artifactId> <version>${opencsv.version}</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.11.0</version> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>4.2.1</version> </dependency> <dependency> <groupId>io.github.bonigarcia</groupId> <artifactId>webdrivermanager</artifactId> <version>5.2.0</version> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-math3</artifactId> <version>3.6.1</version> </dependency> <!-- Tests --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <version>${spring.version}</version> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.awaitility</groupId> <artifactId>awaitility</artifactId> <version>${awaitility.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>tech.cassandre.trading.bot</groupId> <artifactId>cassandre-trading-bot-spring-boot-starter-test</artifactId> <version>${cassandre.version}</version> <scope>test</scope> </dependency> </dependencies> <!-- Build configuration --> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>${spring.version}</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>${maven.surefire.plugin.version}</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>${maven.failsafe.plugin.version}</version> </plugin> </plugins> </build> <!-- Allow snapshot --> <distributionManagement> <snapshotRepository> <id>ossrh</id> <url>https://oss.sonatype.org/content/repositories/snapshots</url> </snapshotRepository> <repository> <id>ossrh</id> <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> </repository> </distributionManagement> </project>

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`

jechaviz avatar Aug 15 '22 23:08 jechaviz

Are you using java 17 ?

straumat avatar Aug 17 '22 20:08 straumat

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

jechaviz avatar Aug 17 '22 20:08 jechaviz

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

straumat avatar Aug 17 '22 20:08 straumat

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

straumat avatar Aug 17 '22 20:08 straumat

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 avatar Aug 17 '22 21:08 jechaviz

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...

jechaviz avatar Aug 17 '22 21:08 jechaviz

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

straumat avatar Aug 17 '22 22:08 straumat

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

jechaviz avatar Aug 17 '22 22:08 jechaviz

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)

jechaviz avatar Aug 20 '22 23:08 jechaviz

@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 !))

straumat avatar Aug 23 '22 07:08 straumat

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

Thank you.

jechaviz avatar Sep 04 '22 23:09 jechaviz

@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

straumat avatar Sep 05 '22 07:09 straumat