Skip to content

Commit

Permalink
Merge branch 'release/5.0.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
straumat committed Feb 4, 2022
2 parents 08aacf0 + 47e79c3 commit 0d6409d
Show file tree
Hide file tree
Showing 79 changed files with 871 additions and 255 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Integration tests

on:
schedule:
- cron: '0 18 * * MON'
- cron: '0 18 * * THU'
- cron: '0 18 * * SUN'

jobs:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release-creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ on:
tags:
- '*'

permissions:
id-token: "write"
contents: "write"
packages: "write"
pull-requests: "read"

jobs:
build:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .mvn/jvm.config
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-Xmx1024m -Xms1024m -Djava.awt.headless=true --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/javax.crypto=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED
-Xmx1024m -Xms1024m -Djava.awt.headless=true --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/javax.crypto=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED -Dmaven.compiler.showWarnings=true -Dmaven.compiler.showDeprecation=true
25 changes: 22 additions & 3 deletions docs/docs/ressources/how-tos/how-to-create-a-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ description: How to create an official Cassandre release
---
# Create a release

## Prepare the release
* Fix [Codacy](https://app.codacy.com/gh/cassandre-tech/cassandre-trading-bot/issues) & Intellij warnings.
## Things to check before release
* Fix Intellij warnings.
* Fix [Codacy](https://app.codacy.com/gh/cassandre-tech/cassandre-trading-bot/issues) warnings.
* Update [security.md](https://github.com/cassandre-tech/cassandre-trading-bot/blob/development/SECURITY.md).

## Create the release with Maven
Expand All @@ -15,7 +16,7 @@ You must be using `ssh` and not `https`. To switch to `ssh`, type :
git remote set-url origin [email protected]:cassandre-tech/cassandre-trading-bot.git
```

Check that you are on the develop branch and that everything is committed:
Check that you are on the `development` branch and that everything is committed:
```bash
git checkout development
git status
Expand All @@ -35,3 +36,21 @@ mvn gitflow:release-finish
* Close the corresponding [milestone in Github](https://github.com/cassandre-tech/cassandre-trading-bot/milestones?direction=asc&sort=due_date&state=open).
* Write and send a [substack post](https://cassandre.substack.com/publish?utm_source=menu).
* Update cassandre release number on production trading bots.

## Releases text
* English: "We've just released Cassandre 5.0.7, a Spring boot starter to create and run your java crypto trading bot in minutes. Details here: URL #trading #tradingbot #crypto #bitcoin #java"
* French: "Sortie de Cassandre 5.0.7, notre Spring Boot Starter qui permet de créer son propre bot de trading pour les cryptos en quelques minutes. Plus de détails ici : URL #trading #tradingbot #crypto #bitcoin #java"

## Tell the world
* Retrieve the news URL from [GitHub](https://github.com/cassandre-tech/cassandre-trading-bot/releases).
* Publish on Cassandre Twitter (should be done by GitHub CI).
* Publish on Cassandre Discord (should be done by GitHub CI).
* Publish on my personal accounts (Facebook, Twitter & LinkedIn).
* Publish on [linuxfr](https://linuxfr.org/).
* Publish on [bitcointalk](https://bitcointalk.org/index.php?board=8.0).
* Publish on [IndieHackers](https://www.indiehackers.com/new-post).
* Publish on Reddit.
* Programming: [Java](https://www.reddit.com/r/java/), [Kotlin](https://www.reddit.com/r/Kotlin/).
* Exchanges: [Kucoin](https://www.reddit.com/r/kucoin/), [Coinbase](https://www.reddit.com/r/CoinBase/), [Binance](https://www.reddit.com/r/binance/).
* Trading: [Cryptotrading](https://www.reddit.com/r/cryptotrading/).
* Crypto currencies: TODO.
16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<!-- Project information -->
<groupId>tech.cassandre.trading.bot</groupId>
<artifactId>cassandre-trading-bot-project</artifactId>
<version>5.0.7</version>
<version>5.0.8</version>
<packaging>pom</packaging>
<name>Cassandre trading bot</name>
<url>https://github.com/cassandre-tech/cassandre-trading-bot</url>
Expand Down Expand Up @@ -55,7 +55,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.2</version>
<version>2.6.3</version>
<relativePath/>
</parent>
<!-- =========================================================================================================== -->
Expand All @@ -75,9 +75,9 @@
<!-- Core -->
<spring.version>2.6.1</spring.version>
<reactor.version>Dysprosium-SR25</reactor.version>
<xchange.version>5.0.12</xchange.version>
<bucket4j.version>6.4.1</bucket4j.version>
<liquibase.version>4.6.2</liquibase.version>
<xchange.version>5.0.13</xchange.version>
<bucket4j.version>7.0.0</bucket4j.version>
<liquibase.version>4.7.1</liquibase.version>
<opencsv.version>5.5.2</opencsv.version>

<!-- Core utils -->
Expand All @@ -96,20 +96,20 @@
<jackson.version>2.12.6</jackson.version>

<!-- GraphQL API -->
<graphql-dgs.version>4.9.15</graphql-dgs.version>
<graphql-dgs.version>4.9.16</graphql-dgs.version>

<!-- Maven -->
<maven.checkstyle.plugin.version>3.1.2</maven.checkstyle.plugin.version>
<maven.puppycrawl.checkstyle.version>9.2.1</maven.puppycrawl.checkstyle.version>
<maven.resources.plugin.version>3.2.0</maven.resources.plugin.version>
<maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
<maven.compiler.plugin.version>3.9.0</maven.compiler.plugin.version>
<maven.surefire.plugin.version>2.22.2</maven.surefire.plugin.version>
<maven.jacoco.plugin.version>0.8.7</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.3.1</maven.javadoc.plugin.version>
<maven.jar.plugin.version>3.2.0</maven.jar.plugin.version>
<maven.jar.plugin.version>3.2.2</maven.jar.plugin.version>
<maven.archetype-packaging.version>3.2.1</maven.archetype-packaging.version>
</properties>
<!-- =========================================================================================================== -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
<parent>
<groupId>tech.cassandre.trading.bot</groupId>
<artifactId>cassandre-trading-bot-project</artifactId>
<version>5.0.7</version>
<version>5.0.8</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<!-- =========================================================================================================== -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class OrderDataFetcher extends BaseDataFetcher {
public final List<OrderDTO> orders() {
return orderRepository.findAll()
.stream()
.map(orderMapper::mapToOrderDTO)
.map(ORDER_MAPPER::mapToOrderDTO)
.collect(Collectors.toList());
}

Expand All @@ -43,7 +43,7 @@ public final List<OrderDTO> orders() {
@DgsQuery
public OrderDTO order(@InputArgument final long id) {
return orderRepository.findById(id)
.map(orderMapper::mapToOrderDTO)
.map(ORDER_MAPPER::mapToOrderDTO)
.orElse(null);
}

Expand All @@ -56,7 +56,7 @@ public OrderDTO order(@InputArgument final long id) {
@DgsQuery
public OrderDTO orderByOrderId(@InputArgument final String orderId) {
return orderRepository.findByOrderId(orderId)
.map(orderMapper::mapToOrderDTO)
.map(ORDER_MAPPER::mapToOrderDTO)
.orElse(null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class PositionDataFetcher extends BaseDataFetcher {
public final List<PositionDTO> positions() {
return positionRepository.findAll()
.stream()
.map(positionMapper::mapToPositionDTO)
.map(POSITION_MAPPER::mapToPositionDTO)
.collect(Collectors.toList());
}

Expand All @@ -45,7 +45,7 @@ public final List<PositionDTO> positions() {
@DgsQuery
public final PositionDTO position(@InputArgument final long id) {
return positionRepository.findById(id)
.map(positionMapper::mapToPositionDTO)
.map(POSITION_MAPPER::mapToPositionDTO)
.orElse(null);
}

Expand All @@ -60,7 +60,7 @@ public final List<PositionDTO> positionsByStrategy(@InputArgument final long id)
return positionRepository.findAll()
.stream()
.filter(position -> position.getStrategy().getId() == id)
.map(positionMapper::mapToPositionDTO)
.map(POSITION_MAPPER::mapToPositionDTO)
.collect(Collectors.toList());
}

Expand All @@ -75,7 +75,7 @@ public final List<PositionDTO> positionsByStrategyId(@InputArgument final String
return positionRepository.findAll()
.stream()
.filter(position -> Objects.equals(position.getStrategy().getStrategyId(), strategyId))
.map(positionMapper::mapToPositionDTO)
.map(POSITION_MAPPER::mapToPositionDTO)
.collect(Collectors.toList());
}

Expand All @@ -92,7 +92,7 @@ public final List<PositionDTO> positionsByStrategyAndStatus(@InputArgument final
return positionRepository.findByStatus(status)
.stream()
.filter(position -> position.getStrategy().getId() == id)
.map(positionMapper::mapToPositionDTO)
.map(POSITION_MAPPER::mapToPositionDTO)
.collect(Collectors.toList());
}

Expand All @@ -109,7 +109,7 @@ public final List<PositionDTO> positionsByStrategyIdAndStatus(@InputArgument fin
return positionRepository.findByStatus(status)
.stream()
.filter(position -> Objects.equals(position.getStrategy().getStrategyId(), strategyId))
.map(positionMapper::mapToPositionDTO)
.map(POSITION_MAPPER::mapToPositionDTO)
.collect(Collectors.toList());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class StrategyDataFetcher extends BaseDataFetcher {
public final List<StrategyDTO> strategies() {
return strategyRepository.findAll()
.stream()
.map(strategyMapper::mapToStrategyDTO)
.map(STRATEGY_MAPPER::mapToStrategyDTO)
.collect(Collectors.toList());
}

Expand All @@ -43,7 +43,7 @@ public final List<StrategyDTO> strategies() {
@DgsQuery
public StrategyDTO strategy(@InputArgument final long id) {
return strategyRepository.findById(id)
.map(strategyMapper::mapToStrategyDTO)
.map(STRATEGY_MAPPER::mapToStrategyDTO)
.orElse(null);
}

Expand All @@ -56,7 +56,7 @@ public StrategyDTO strategy(@InputArgument final long id) {
@DgsQuery
public StrategyDTO strategyByStrategyId(@InputArgument final String strategyId) {
return strategyRepository.findByStrategyId(strategyId)
.map(strategyMapper::mapToStrategyDTO)
.map(STRATEGY_MAPPER::mapToStrategyDTO)
.orElse(null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class TradeDataFetcher extends BaseDataFetcher {
public final List<TradeDTO> trades() {
return tradeRepository.findAll()
.stream()
.map(tradeMapper::mapToTradeDTO)
.map(TRADE_MAPPER::mapToTradeDTO)
.collect(Collectors.toList());
}

Expand All @@ -43,7 +43,7 @@ public final List<TradeDTO> trades() {
@DgsQuery
public final TradeDTO trade(@InputArgument final long id) {
return tradeRepository.findById(id)
.map(tradeMapper::mapToTradeDTO)
.map(TRADE_MAPPER::mapToTradeDTO)
.orElse(null);
}

Expand All @@ -56,7 +56,7 @@ public final TradeDTO trade(@InputArgument final long id) {
@DgsQuery
public final TradeDTO tradeByTradeId(@InputArgument final String tradeId) {
return tradeRepository.findByTradeId(tradeId)
.map(tradeMapper::mapToTradeDTO)
.map(TRADE_MAPPER::mapToTradeDTO)
.orElse(null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<parent>
<groupId>tech.cassandre.trading.bot</groupId>
<artifactId>cassandre-trading-bot-project</artifactId>
<version>5.0.7</version>
<version>5.0.8</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<!-- =========================================================================================================== -->
Expand Down
2 changes: 1 addition & 1 deletion spring-boot-starter-test/autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
<parent>
<groupId>tech.cassandre.trading.bot</groupId>
<artifactId>cassandre-trading-bot-project</artifactId>
<version>5.0.7</version>
<version>5.0.8</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<!-- =========================================================================================================== -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public boolean isFluxDone(final CurrencyPairDTO currencyPair) {
if (size == null) {
return true;
} else {
// 7 calls <= 6 tickers => Flux done
return sequence.get() <= size;
// 7 calls >= 6 tickers => Flux done
return sequence.get() >= size;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.springframework.test.annotation.DirtiesContext.ClassMode.BEFORE_CLASS;
import static org.springframework.test.annotation.DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD;
import static tech.cassandre.trading.bot.dto.util.CurrencyDTO.ETH;
import static tech.cassandre.trading.bot.dto.util.CurrencyDTO.USDT;

@SpringBootTest(properties = {
"ONLY_TICKERS_STRATEGY_ENABLED=true",
Expand All @@ -30,7 +32,7 @@
})
@Import(TickerFluxMock.class)
@DisplayName("Only tickers strategy test")
@DirtiesContext(classMode = BEFORE_CLASS)
@DirtiesContext(classMode = BEFORE_EACH_TEST_METHOD)
public class OnlyTickersStrategyTest extends BaseTest {

@Autowired
Expand All @@ -39,6 +41,25 @@ public class OnlyTickersStrategyTest extends BaseTest {
@Autowired
private OnlyTickersStrategy strategy;

@Test
@DisplayName("Check received tickers with one flux")
public void checkReceivedTickersWithOneFlux() {
// There are four files and only three currency pairs are requested by the strategy.
// - tickers-BTC-USDT.tsv - Requested (7 lines).
// - tickers-ETH-BTC.tsv - Not requested.
// - tickers-ETH-USDT.tsv - Requested (5 lines).
// - tickers-KCS-USDT.csv - Requested (3 lines).

// Check if flux is not done.
assertFalse(tickerFluxMock.isFluxDone(new CurrencyPairDTO(ETH, USDT)));

// As tickers-BTC-USDT.tsv has the most line, we should wait to have 7 replies.
with().await().untilAsserted(() -> assertEquals(5, strategy.getTickersReceived().size()));

// Check if flux is done.
assertTrue(tickerFluxMock.isFluxDone(new CurrencyPairDTO(ETH, USDT)));
}

@Test
@DisplayName("Check received tickers")
public void checkReceivedTickers() {
Expand Down Expand Up @@ -75,12 +96,12 @@ public void checkReceivedTickers() {
TickerDTO ethUsdtTicker01 = reply01.get(ETH_USDT);
assertNotNull(ethUsdtTicker01);
assertEquals(0, new BigDecimal("1000").compareTo(ethUsdtTicker01.getLast()));
assertFalse(tickerFluxMock.isFluxDone(ETH_USDT));
// assertFalse(tickerFluxMock.isFluxDone(ETH_USDT));
// KCS-USDT.
TickerDTO kcsUsdtTicker01 = reply01.get(KCS_USDT);
assertNotNull(kcsUsdtTicker01);
assertEquals(0, new BigDecimal("0.85652").compareTo(kcsUsdtTicker01.getLast()));
assertFalse(tickerFluxMock.isFluxDone(KCS_USDT));
// assertFalse(tickerFluxMock.isFluxDone(KCS_USDT));

// =============================================================================================================
// Second reply.
Expand Down
2 changes: 1 addition & 1 deletion spring-boot-starter-test/starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
<parent>
<groupId>tech.cassandre.trading.bot</groupId>
<artifactId>cassandre-trading-bot-project</artifactId>
<version>5.0.7</version>
<version>5.0.8</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<!-- =========================================================================================================== -->
Expand Down
Loading

0 comments on commit 0d6409d

Please sign in to comment.