Skip to content

Commit 104eca3

Browse files
committed
Merge branch 'release/5.0.4'
2 parents 406cb31 + 479b46c commit 104eca3

File tree

120 files changed

+6759
-117
lines changed

Some content is hidden

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

120 files changed

+6759
-117
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
4848
# ================================================================================================================
4949
- name: Upload codacy coverage results
50+
continue-on-error: true
5051
run: |
5152
bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
5253
--project-token ${{ secrets.CODACY_API_TOKEN }} \
@@ -83,3 +84,39 @@ jobs:
8384
-Dversion=1.0-SNAPSHOT \
8485
-Dpackage=com.example
8586
mvn -f archetype-test-ta4j-basic/pom.xml test
87+
88+
# ================================================================================================================
89+
# Testing that the graphql starter is working correctly.
90+
- name: Start a postgres server and restore a database from production
91+
run: |
92+
docker run -d \
93+
--name postgres \
94+
-p 5432:5432 \
95+
-e POSTGRES_DB=cassandre_trading_bot \
96+
-e POSTGRES_USER=cassandre_trading_bot \
97+
-e POSTGRES_PASSWORD=cassandre_trading_bot_password \
98+
library/postgres:13-alpine
99+
sleep 30
100+
docker exec -i postgres psql -U cassandre_trading_bot cassandre_trading_bot < util/test/api/graphql/dump_cassandre_trading_bot.sql
101+
102+
- name: Creating a trading bot and configure it for the postgres database
103+
run: |
104+
mvn -B archetype:generate \
105+
-DarchetypeGroupId=tech.cassandre.trading.bot \
106+
-DarchetypeArtifactId=cassandre-trading-bot-spring-boot-starter-basic-archetype \
107+
-DarchetypeVersion=${{ steps.version.outputs.version }} \
108+
-DgroupId=com.example \
109+
-DartifactId=archetype-test-api-graphql \
110+
-Dversion=1.0-SNAPSHOT \
111+
-Dpackage=com.example
112+
cp util/test/api/graphql/application.properties archetype-test-api-graphql/src/main/resources/
113+
cp util/test/api/graphql/user-trade.tsv archetype-test-api-graphql/src/main/resources/
114+
mvn -f archetype-test-api-graphql/pom.xml spring-boot:run &
115+
116+
- name: Runs graphQL tests.
117+
run: |
118+
cp util/test/api/graphql/package.json .
119+
cp util/test/api/graphql/*.js .
120+
npm install --save-dev jest isomorphic-fetch
121+
sleep 30
122+
npm run test

.github/workflows/release-creation.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
# ================================================================================================================
7171
# Upload cassandre-trading-bot-spring-boot-autoconfigure assets to the release (jar, sources, javadoc).
7272
- name: Upload cassandre-trading-bot-spring-boot-autoconfigure jar
73+
continue-on-error: true
7374
uses: actions/upload-release-asset@v1.0.1
7475
env:
7576
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -80,6 +81,7 @@ jobs:
8081
asset_content_type: application/java-archive
8182

8283
- name: Upload cassandre-trading-bot-spring-boot-autoconfigure sources
84+
continue-on-error: true
8385
uses: actions/upload-release-asset@v1.0.1
8486
env:
8587
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -90,6 +92,7 @@ jobs:
9092
asset_content_type: application/java-archive
9193

9294
- name: Upload cassandre-trading-bot-spring-boot-autoconfigure javadoc
95+
continue-on-error: true
9396
uses: actions/upload-release-asset@v1.0.1
9497
env:
9598
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -102,6 +105,7 @@ jobs:
102105
# ================================================================================================================
103106
# Upload cassandre-trading-bot-spring-boot-starter assets to the release (jar).
104107
- name: Upload cassandre-trading-bot-spring-boot-starter jar
108+
continue-on-error: true
105109
uses: actions/upload-release-asset@v1.0.1
106110
env:
107111
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -113,6 +117,7 @@ jobs:
113117

114118
# ================================================================================================================
115119
- name: Publish the release announce on Twitter
120+
continue-on-error: true
116121
uses: ethomson/send-tweet-action@v1
117122
env:
118123
TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
@@ -128,6 +133,7 @@ jobs:
128133

129134
# ================================================================================================================
130135
- name: Publish the release announce on Discord
136+
continue-on-error: true
131137
uses: Ilshidur/action-discord@0.3.0
132138
env:
133139
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,4 @@ docs/yarn.lock
122122
/trading-bot-strategies/technical_analysis/ta4j-strategy/.idea/libraries/
123123
/archetype-test-basic/
124124
/archetype-test-ta4j-basic/
125+
/util/test/api/graphql/package.json

docs/src/.vuepress/config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ module.exports = {
9090
{
9191
text: 'Advanced', items: [
9292
{text: 'Technical analysis', link: '/learn/technical-analysis'},
93+
{text: 'Data importation', link: '/learn/import-historical-data'},
94+
{text: 'GraphQL API', link: '/learn/graphql-api'},
9395
]
9496
},
9597
{

docs/src/learn/graphql-api.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# GraphQL API
2+
3+
::: warning
4+
Available in 5.0.4 release.
5+
:::
6+
7+
## Overview
8+
Cassandre GraphQL API allows you to ONLY query your data (balances, strategies, orders, trades and positions).
9+
10+
## Installation
11+
To deploy the GraphQLAPI, just add this spring boot starter to your pom:
12+
```xml
13+
<dependency>
14+
<groupId>tech.cassandre.trading.bot</groupId>
15+
<artifactId>cassandre-trading-bot-spring-boot-starter-api-graphql</artifactId>
16+
<version>CASSANDRE_LATEST_RELEASE</version>
17+
</dependency>
18+
```
19+
20+
## Access the API with GraphiQL
21+
Start the application and open a browser to [http://localhost:8080/graphiql](http://localhost:8080/graphiql). GraphiQL is a query editor that comes out of the box with the DGS framework.
22+
23+
To start, you can try this query to display all your strategies:
24+
```
25+
query {
26+
strategies{ strategyId name }
27+
}
28+
```
29+
30+
## Secure your API
31+
To protect the access to your API with a key, add this property: `cassandre.trading.bot.api.graphql.key` in your `applications.properties`.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Import historical data
2+
3+
::: warning
4+
Available in 5.0.4 release.
5+
:::
6+
7+
## Overview
8+
This feature allows you to import historical data (tickers you selected) in Cassandre database, so you can initialise your strategy.
9+
10+
## Data file & format
11+
At startup, Cassandre will search for all files starting with `tickers-to-import` and ending with `csv`.
12+
13+
This is how the file must be formatted:
14+
```
15+
CURRENCY_PAIR,OPEN,LAST,BID,ASK,HIGH,LOW,VWAP,VOLUME,QUOTE_VOLUME,BID_SIZE,ASK_SIZE,TIMESTAMP
16+
"BTC/USDT","0.00000001","0.00000002","0.00000003","0.00000004","0.00000005","0.00000006","0.00000007","0.00000008","0.00000009","0.00000010","0.00000011",1508546000
17+
"BTC/USDT","1.00000001","1.00000002","1.00000003","1.00000004","1.00000005","1.00000006","1.00000007","1.00000008","1.00000009","1.00000010","1.00000011",1508446000
18+
"ETH/USDT","2.00000001","2.00000002","2.00000003","2.00000004","2.00000005","2.00000006","2.00000007","2.00000008","2.00000009","2.00000010","2.00000011",1508346000
19+
```
20+
21+
## When to initialize data?
22+
In you strategy, you should implement the `initialize()` method. This method is executed by Cassandre before any other data (tickers, orders, trades...) is pushed to the strategy.
23+
24+
## Access your data in your strategy
25+
In your strategy, you can access the data with two methods:
26+
* `List<TickerDTO> getImportedTickers()`.
27+
* `List<TickerDTO> getImportedTickers(CurrencyPairDTO currencyPairDTO)`.

docs/src/learn/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Quickstart
1+
# Quickstart
22

33
::: tip
44
If you are new to trading, you can read our tutorial "[Trading basics](../ressources/trading-basics.md)".

pom.xml

Lines changed: 5 additions & 2 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>5.0.3</version>
11+
<version>5.0.4</version>
1212
<packaging>pom</packaging>
1313
<name>Cassandre trading bot</name>
1414
<url>https://github.com/cassandre-tech/cassandre-trading-bot</url>
@@ -69,7 +69,7 @@
6969
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
7070
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
7171
<!-- XChange release -->
72-
<xchange.version>5.0.10</xchange.version>
72+
<xchange.version>5.0.11</xchange.version>
7373
</properties>
7474
<!-- =========================================================================================================== -->
7575

@@ -82,6 +82,9 @@
8282
<!-- Trading bot spring boot starter test -->
8383
<module>spring-boot-starter-test/autoconfigure</module>
8484
<module>spring-boot-starter-test/starter</module>
85+
<!-- Trading bot spring boot starter API -->
86+
<module>spring-boot-starter-api/spring-boot-starter-api-graphql/autoconfigure</module>
87+
<module>spring-boot-starter-api/spring-boot-starter-api-graphql/starter</module>
8588
<!-- Archetypes -->
8689
<module>trading-bot-archetypes/basic-archetype</module>
8790
<module>trading-bot-archetypes/basic-ta4j-archetype</module>

0 commit comments

Comments
 (0)