Skip to content

Commit

Permalink
Merge branch 'release/5.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
straumat committed Sep 30, 2021
2 parents 406cb31 + 479b46c commit 104eca3
Show file tree
Hide file tree
Showing 120 changed files with 6,759 additions and 117 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
# ================================================================================================================
- name: Upload codacy coverage results
continue-on-error: true
run: |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
--project-token ${{ secrets.CODACY_API_TOKEN }} \
Expand Down Expand Up @@ -83,3 +84,39 @@ jobs:
-Dversion=1.0-SNAPSHOT \
-Dpackage=com.example
mvn -f archetype-test-ta4j-basic/pom.xml test
# ================================================================================================================
# Testing that the graphql starter is working correctly.
- name: Start a postgres server and restore a database from production
run: |
docker run -d \
--name postgres \
-p 5432:5432 \
-e POSTGRES_DB=cassandre_trading_bot \
-e POSTGRES_USER=cassandre_trading_bot \
-e POSTGRES_PASSWORD=cassandre_trading_bot_password \
library/postgres:13-alpine
sleep 30
docker exec -i postgres psql -U cassandre_trading_bot cassandre_trading_bot < util/test/api/graphql/dump_cassandre_trading_bot.sql
- name: Creating a trading bot and configure it for the postgres database
run: |
mvn -B archetype:generate \
-DarchetypeGroupId=tech.cassandre.trading.bot \
-DarchetypeArtifactId=cassandre-trading-bot-spring-boot-starter-basic-archetype \
-DarchetypeVersion=${{ steps.version.outputs.version }} \
-DgroupId=com.example \
-DartifactId=archetype-test-api-graphql \
-Dversion=1.0-SNAPSHOT \
-Dpackage=com.example
cp util/test/api/graphql/application.properties archetype-test-api-graphql/src/main/resources/
cp util/test/api/graphql/user-trade.tsv archetype-test-api-graphql/src/main/resources/
mvn -f archetype-test-api-graphql/pom.xml spring-boot:run &
- name: Runs graphQL tests.
run: |
cp util/test/api/graphql/package.json .
cp util/test/api/graphql/*.js .
npm install --save-dev jest isomorphic-fetch
sleep 30
npm run test
6 changes: 6 additions & 0 deletions .github/workflows/release-creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
# ================================================================================================================
# Upload cassandre-trading-bot-spring-boot-autoconfigure assets to the release (jar, sources, javadoc).
- name: Upload cassandre-trading-bot-spring-boot-autoconfigure jar
continue-on-error: true
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -80,6 +81,7 @@ jobs:
asset_content_type: application/java-archive

- name: Upload cassandre-trading-bot-spring-boot-autoconfigure sources
continue-on-error: true
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -90,6 +92,7 @@ jobs:
asset_content_type: application/java-archive

- name: Upload cassandre-trading-bot-spring-boot-autoconfigure javadoc
continue-on-error: true
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -102,6 +105,7 @@ jobs:
# ================================================================================================================
# Upload cassandre-trading-bot-spring-boot-starter assets to the release (jar).
- name: Upload cassandre-trading-bot-spring-boot-starter jar
continue-on-error: true
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -113,6 +117,7 @@ jobs:

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

# ================================================================================================================
- name: Publish the release announce on Discord
continue-on-error: true
uses: Ilshidur/[email protected]
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,4 @@ docs/yarn.lock
/trading-bot-strategies/technical_analysis/ta4j-strategy/.idea/libraries/
/archetype-test-basic/
/archetype-test-ta4j-basic/
/util/test/api/graphql/package.json
2 changes: 2 additions & 0 deletions docs/src/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ module.exports = {
{
text: 'Advanced', items: [
{text: 'Technical analysis', link: '/learn/technical-analysis'},
{text: 'Data importation', link: '/learn/import-historical-data'},
{text: 'GraphQL API', link: '/learn/graphql-api'},
]
},
{
Expand Down
31 changes: 31 additions & 0 deletions docs/src/learn/graphql-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# GraphQL API

::: warning
Available in 5.0.4 release.
:::

## Overview
Cassandre GraphQL API allows you to ONLY query your data (balances, strategies, orders, trades and positions).

## Installation
To deploy the GraphQLAPI, just add this spring boot starter to your pom:
```xml
<dependency>
<groupId>tech.cassandre.trading.bot</groupId>
<artifactId>cassandre-trading-bot-spring-boot-starter-api-graphql</artifactId>
<version>CASSANDRE_LATEST_RELEASE</version>
</dependency>
```

## Access the API with GraphiQL
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.

To start, you can try this query to display all your strategies:
```
query {
strategies{ strategyId name }
}
```

## Secure your API
To protect the access to your API with a key, add this property: `cassandre.trading.bot.api.graphql.key` in your `applications.properties`.
27 changes: 27 additions & 0 deletions docs/src/learn/import-historical-data.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Import historical data

::: warning
Available in 5.0.4 release.
:::

## Overview
This feature allows you to import historical data (tickers you selected) in Cassandre database, so you can initialise your strategy.

## Data file & format
At startup, Cassandre will search for all files starting with `tickers-to-import` and ending with `csv`.

This is how the file must be formatted:
```
CURRENCY_PAIR,OPEN,LAST,BID,ASK,HIGH,LOW,VWAP,VOLUME,QUOTE_VOLUME,BID_SIZE,ASK_SIZE,TIMESTAMP
"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
"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
"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
```

## When to initialize data?
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.

## Access your data in your strategy
In your strategy, you can access the data with two methods:
* `List<TickerDTO> getImportedTickers()`.
* `List<TickerDTO> getImportedTickers(CurrencyPairDTO currencyPairDTO)`.
2 changes: 1 addition & 1 deletion docs/src/learn/quickstart.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Quickstart
# Quickstart

::: tip
If you are new to trading, you can read our tutorial "[Trading basics](../ressources/trading-basics.md)".
Expand Down
7 changes: 5 additions & 2 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.3</version>
<version>5.0.4</version>
<packaging>pom</packaging>
<name>Cassandre trading bot</name>
<url>https://github.com/cassandre-tech/cassandre-trading-bot</url>
Expand Down Expand Up @@ -69,7 +69,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- XChange release -->
<xchange.version>5.0.10</xchange.version>
<xchange.version>5.0.11</xchange.version>
</properties>
<!-- =========================================================================================================== -->

Expand All @@ -82,6 +82,9 @@
<!-- Trading bot spring boot starter test -->
<module>spring-boot-starter-test/autoconfigure</module>
<module>spring-boot-starter-test/starter</module>
<!-- Trading bot spring boot starter API -->
<module>spring-boot-starter-api/spring-boot-starter-api-graphql/autoconfigure</module>
<module>spring-boot-starter-api/spring-boot-starter-api-graphql/starter</module>
<!-- Archetypes -->
<module>trading-bot-archetypes/basic-archetype</module>
<module>trading-bot-archetypes/basic-ta4j-archetype</module>
Expand Down
Loading

0 comments on commit 104eca3

Please sign in to comment.