Skip to content

Commit 2e2b20f

Browse files
committed
Merge branch 'release/2.0.0'
2 parents 8097bfd + 51865dc commit 2e2b20f

File tree

134 files changed

+6930
-2548
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+6930
-2548
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,18 @@ jobs:
4747
KUCOIN_PASSPHRASE: ${{ secrets.KUCOIN_PASSPHRASE }}
4848
KUCOIN_KEY: ${{ secrets.KUCOIN_KEY }}
4949
KUCOIN_SECRET: ${{ secrets.KUCOIN_SECRET }}
50-
run: mvn deploy -B -Dgpg.passphrase=${GPG_PASSPHRASE}
50+
run: |
51+
mvn deploy -B -Dgpg.passphrase=${GPG_PASSPHRASE}
52+
echo "::set-output name=version::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
53+
54+
# ================================================================================================================
55+
- name : Test Cassandre trading bot maven archetype - basic strategy
56+
run: |
57+
mvn -B archetype:generate -DarchetypeGroupId=tech.cassandre.trading.bot -DarchetypeArtifactId=cassandre-trading-bot-spring-boot-starter-archetype -DarchetypeVersion=${{ steps.package.outputs.version }} -DgroupId=tech.cassandre -DartifactId=archetype-test-basic -Dversion=1.0-SNAPSHOT -Dpackage=tech.cassandre
58+
mvn -f archetype-test-basic/pom.xml test
59+
60+
# ================================================================================================================
61+
- name : Test Cassandre trading bot maven archetype - basic ta4j strategy
62+
run: |
63+
mvn -B archetype:generate -DarchetypeGroupId=tech.cassandre.trading.bot -DarchetypeArtifactId=cassandre-trading-bot-spring-boot-starter-basic-ta4j-archetype -DarchetypeVersion=${{ steps.package.outputs.version }} -DgroupId=tech.cassandre -DartifactId=archetype-test-ta4j-basic -Dversion=1.0-SNAPSHOT -Dpackage=tech.cassandre
64+
mvn -f archetype-test-ta4j-basic/pom.xml test

.github/workflows/release-creation.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,6 @@ jobs:
103103
asset_name: cassandre-trading-bot-spring-boot-starter-${{ steps.package.outputs.version }}.jar
104104
asset_content_type: application/java-archive
105105

106-
# ================================================================================================================
107-
# Upload cassandre-trading-bot-spring-boot-starter-archetype assets to the release (jar).
108-
- name: Upload cassandre-trading-bot-spring-boot-starter-archetype jar
109-
uses: actions/upload-release-asset@v1.0.1
110-
env:
111-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112-
with:
113-
upload_url: ${{ steps.create_release.outputs.upload_url }}
114-
asset_path: trading-bot-spring-boot-starter-archetype/target/cassandre-trading-bot-spring-boot-starter-archetype-${{ steps.package.outputs.version }}.jar
115-
asset_name: cassandre-trading-bot-spring-boot-starter-archetype-${{ steps.package.outputs.version }}.jar
116-
asset_content_type: application/java-archive
117-
118106
# ================================================================================================================
119107
- name : Publish the release announce on Twitter
120108
uses: ethomson/send-tweet-action@v1

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,5 @@ index.md
119119
/images/
120120
/trading-bot-strategies/technical_analysis/ta4j-strategy/.idea/
121121
/trading-bot-strategies/technical_analysis/ta4j-strategy/.idea/libraries/
122+
/archetype-test-basic/
123+
/archetype-test-ta4j-basic/

SECURITY.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| 1.0.x | :white_check_mark: |
8+
9+
## Reporting a Vulnerability
10+
11+
Send an email to contact@cassandre.tech and we will reply within 24 hours.

pom.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<!-- Project information -->
99
<groupId>tech.cassandre.trading.bot</groupId>
1010
<artifactId>cassandre-trading-bot-project</artifactId>
11-
<version>1.0.0</version>
11+
<version>2.0.0</version>
1212
<packaging>pom</packaging>
1313
<name>Cassandre trading bot</name>
1414
<url>https://github.com/cassandre-tech/cassandre-trading-bot</url>
@@ -36,7 +36,7 @@
3636
<parent>
3737
<groupId>org.springframework.boot</groupId>
3838
<artifactId>spring-boot-starter-parent</artifactId>
39-
<version>2.2.6.RELEASE</version>
39+
<version>2.3.2.RELEASE</version>
4040
<relativePath/>
4141
</parent>
4242
<!-- =========================================================================================================== -->
@@ -58,8 +58,7 @@
5858
<module>trading-bot-spring-boot-autoconfigure</module>
5959
<module>trading-bot-spring-boot-starter</module>
6060
<module>trading-bot-spring-boot-starter-archetype</module>
61-
<module>trading-bot-strategies/dumb</module>
62-
<module>trading-bot-strategies/technical_analysis/ta4j-strategy</module>
61+
<module>trading-bot-spring-boot-starter-basic-ta4j-archetype</module>
6362
</modules>
6463
<!-- =========================================================================================================== -->
6564

trading-bot-spring-boot-autoconfigure/pom.xml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<dependency>
2626
<groupId>org.hibernate.validator</groupId>
2727
<artifactId>hibernate-validator</artifactId>
28-
<version>6.1.2.Final</version>
28+
<version>6.1.5.Final</version>
2929
</dependency>
3030
<dependency>
3131
<groupId>io.projectreactor</groupId>
@@ -45,12 +45,19 @@
4545
<dependency>
4646
<groupId>org.knowm.xchange</groupId>
4747
<artifactId>xchange-core</artifactId>
48-
<version>4.4.2</version>
48+
<version>5.0.1</version>
4949
</dependency>
5050
<dependency>
5151
<groupId>org.knowm.xchange</groupId>
5252
<artifactId>xchange-kucoin</artifactId>
53-
<version>4.4.2</version>
53+
<version>5.0.1</version>
54+
</dependency>
55+
56+
<!-- Ta4j -->
57+
<dependency>
58+
<groupId>org.ta4j</groupId>
59+
<artifactId>ta4j-core</artifactId>
60+
<version>0.13</version>
5461
</dependency>
5562

5663
<!-- Util -->
@@ -80,13 +87,13 @@
8087
<dependency>
8188
<groupId>org.awaitility</groupId>
8289
<artifactId>awaitility</artifactId>
83-
<version>4.0.2</version>
90+
<version>4.0.3</version>
8491
<scope>test</scope>
8592
</dependency>
8693
<dependency>
8794
<groupId>org.junit-pioneer</groupId>
8895
<artifactId>junit-pioneer</artifactId>
89-
<version>0.5.5</version>
96+
<version>0.9.0</version>
9097
<scope>test</scope>
9198
</dependency>
9299
</dependencies>
@@ -99,7 +106,7 @@
99106
<dependency>
100107
<groupId>io.projectreactor</groupId>
101108
<artifactId>reactor-bom</artifactId>
102-
<version>Dysprosium-SR6</version>
109+
<version>Dysprosium-SR10</version>
103110
<type>pom</type>
104111
<scope>import</scope>
105112
</dependency>
@@ -121,7 +128,7 @@
121128
<dependency>
122129
<groupId>com.puppycrawl.tools</groupId>
123130
<artifactId>checkstyle</artifactId>
124-
<version>8.31</version>
131+
<version>8.35</version>
125132
</dependency>
126133
</dependencies>
127134
<executions>
@@ -255,7 +262,7 @@
255262
<parent>
256263
<groupId>tech.cassandre.trading.bot</groupId>
257264
<artifactId>cassandre-trading-bot-project</artifactId>
258-
<version>1.0.0</version>
265+
<version>2.0.0</version>
259266
</parent>
260267
<!-- =========================================================================================================== -->
261268

trading-bot-spring-boot-autoconfigure/src/main/java/tech/cassandre/trading/bot/batch/AccountFlux.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.util.Set;
1111

1212
/**
13-
* Account flux.
13+
* Account flux - push {@link AccountDTO}.
1414
*/
1515
public class AccountFlux extends BaseFlux<AccountDTO> {
1616

trading-bot-spring-boot-autoconfigure/src/main/java/tech/cassandre/trading/bot/batch/OrderFlux.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.util.Set;
1111

1212
/**
13-
* Order flux.
13+
* Order flux - push {@link OrderDTO}.
1414
*/
1515
public class OrderFlux extends BaseFlux<OrderDTO> {
1616

@@ -41,12 +41,11 @@ protected final Set<OrderDTO> getNewValues() {
4141
OrderDTO existingOrder = previousValues.get(order.getId());
4242
// If it does not exist or something changed, we do it.
4343
if (existingOrder == null || !existingOrder.equals(order)) {
44-
getLogger().debug("OrderFlux - order {} has changed : {}", order.getId(), order);
44+
getLogger().debug("OrderFlux - Order {} has changed : {}", order.getId(), order);
4545
previousValues.put(order.getId(), order);
4646
newValues.add(order);
4747
}
4848
});
49-
// TODO Removing all the orders no more returned by the exchange.
5049
getLogger().debug("OrderFlux - {} order(s) updated", newValues.size());
5150
return newValues;
5251
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package tech.cassandre.trading.bot.batch;
2+
3+
import tech.cassandre.trading.bot.dto.position.PositionDTO;
4+
import tech.cassandre.trading.bot.service.PositionService;
5+
import tech.cassandre.trading.bot.util.base.BaseFlux;
6+
7+
import java.util.LinkedHashMap;
8+
import java.util.LinkedHashSet;
9+
import java.util.Map;
10+
import java.util.Set;
11+
12+
/**
13+
* Position flux - push {@link PositionDTO}.
14+
*/
15+
public class PositionFlux extends BaseFlux<PositionDTO> {
16+
17+
/** Position service. */
18+
private final PositionService positionService;
19+
20+
/** Previous values. */
21+
private final Map<Long, PositionDTO> previousValues = new LinkedHashMap<>();
22+
23+
/**
24+
* Constructor.
25+
*
26+
* @param newPositionService position service
27+
*/
28+
public PositionFlux(final PositionService newPositionService) {
29+
this.positionService = newPositionService;
30+
}
31+
32+
@Override
33+
@SuppressWarnings("unused")
34+
protected final Set<PositionDTO> getNewValues() {
35+
getLogger().debug("PositionFlux - Retrieving new values");
36+
Set<PositionDTO> newValues = new LinkedHashSet<>();
37+
38+
// Finding which positions has been updated.
39+
positionService.getPositions().forEach(position -> {
40+
getLogger().debug("PositionFlux - Treating position : {}", position.getId());
41+
PositionDTO existingPosition = previousValues.get(position.getId());
42+
if (existingPosition == null || !existingPosition.equals(position)) {
43+
getLogger().debug("PositionFlux - Flux {} has changed : {}", position.getId(), position);
44+
previousValues.put(position.getId(), position);
45+
newValues.add(position);
46+
}
47+
});
48+
49+
getLogger().debug("PositionFlux - {} position(s) updated", newValues.size());
50+
return newValues;
51+
}
52+
53+
}

trading-bot-spring-boot-autoconfigure/src/main/java/tech/cassandre/trading/bot/batch/TickerFlux.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import java.util.Set;
1515

1616
/**
17-
* Ticker flux.
17+
* Ticker flux - push {@link TickerDTO}.
1818
*/
1919
public class TickerFlux extends BaseFlux<TickerDTO> {
2020

@@ -52,13 +52,13 @@ public void updateRequestedCurrencyPairs(final Set<CurrencyPairDTO> newRequested
5252
@Override
5353
@SuppressWarnings("unused")
5454
protected final Set<TickerDTO> getNewValues() {
55-
getLogger().debug("TickerDTO - Retrieving new values");
55+
getLogger().debug("TickerFlux - Retrieving new values");
5656
Set<TickerDTO> newValues = new LinkedHashSet<>();
5757
getCurrencyPairToTreat()
5858
.flatMap(marketService::getTicker)
5959
.ifPresent(t -> {
6060
if (!t.equals(previousValues.get(t.getCurrencyPair()))) {
61-
getLogger().debug("TickerDTO - new ticker received : {}", t);
61+
getLogger().debug("TickerFlux - New ticker received : {}", t);
6262
previousValues.replace(t.getCurrencyPair(), t);
6363
newValues.add(t);
6464
}
@@ -72,7 +72,6 @@ protected final Set<TickerDTO> getNewValues() {
7272
* @return currency pair to treat.
7373
*/
7474
private Optional<CurrencyPairDTO> getCurrencyPairToTreat() {
75-
// TODO Optimize this.
7675
final CurrencyPairDTO nextCurrencyPairToTreat;
7776

7877
// No currency pairs required.

0 commit comments

Comments
 (0)