-
-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
134 changed files
with
6,930 additions
and
2,548 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,18 +103,6 @@ jobs: | |
asset_name: cassandre-trading-bot-spring-boot-starter-${{ steps.package.outputs.version }}.jar | ||
asset_content_type: application/java-archive | ||
|
||
# ================================================================================================================ | ||
# Upload cassandre-trading-bot-spring-boot-starter-archetype assets to the release (jar). | ||
- name: Upload cassandre-trading-bot-spring-boot-starter-archetype jar | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: trading-bot-spring-boot-starter-archetype/target/cassandre-trading-bot-spring-boot-starter-archetype-${{ steps.package.outputs.version }}.jar | ||
asset_name: cassandre-trading-bot-spring-boot-starter-archetype-${{ steps.package.outputs.version }}.jar | ||
asset_content_type: application/java-archive | ||
|
||
# ================================================================================================================ | ||
- name : Publish the release announce on Twitter | ||
uses: ethomson/send-tweet-action@v1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Security Policy | ||
|
||
## Supported Versions | ||
|
||
| Version | Supported | | ||
| ------- | ------------------ | | ||
| 1.0.x | :white_check_mark: | | ||
|
||
## Reporting a Vulnerability | ||
|
||
Send an email to [email protected] and we will reply within 24 hours. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...pring-boot-autoconfigure/src/main/java/tech/cassandre/trading/bot/batch/PositionFlux.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package tech.cassandre.trading.bot.batch; | ||
|
||
import tech.cassandre.trading.bot.dto.position.PositionDTO; | ||
import tech.cassandre.trading.bot.service.PositionService; | ||
import tech.cassandre.trading.bot.util.base.BaseFlux; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.LinkedHashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
/** | ||
* Position flux - push {@link PositionDTO}. | ||
*/ | ||
public class PositionFlux extends BaseFlux<PositionDTO> { | ||
|
||
/** Position service. */ | ||
private final PositionService positionService; | ||
|
||
/** Previous values. */ | ||
private final Map<Long, PositionDTO> previousValues = new LinkedHashMap<>(); | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param newPositionService position service | ||
*/ | ||
public PositionFlux(final PositionService newPositionService) { | ||
this.positionService = newPositionService; | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("unused") | ||
protected final Set<PositionDTO> getNewValues() { | ||
getLogger().debug("PositionFlux - Retrieving new values"); | ||
Set<PositionDTO> newValues = new LinkedHashSet<>(); | ||
|
||
// Finding which positions has been updated. | ||
positionService.getPositions().forEach(position -> { | ||
getLogger().debug("PositionFlux - Treating position : {}", position.getId()); | ||
PositionDTO existingPosition = previousValues.get(position.getId()); | ||
if (existingPosition == null || !existingPosition.equals(position)) { | ||
getLogger().debug("PositionFlux - Flux {} has changed : {}", position.getId(), position); | ||
previousValues.put(position.getId(), position); | ||
newValues.add(position); | ||
} | ||
}); | ||
|
||
getLogger().debug("PositionFlux - {} position(s) updated", newValues.size()); | ||
return newValues; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...t-spring-boot-autoconfigure/src/main/java/tech/cassandre/trading/bot/batch/TradeFlux.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package tech.cassandre.trading.bot.batch; | ||
|
||
import tech.cassandre.trading.bot.dto.trade.TradeDTO; | ||
import tech.cassandre.trading.bot.service.TradeService; | ||
import tech.cassandre.trading.bot.util.base.BaseFlux; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.LinkedHashSet; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
/** | ||
* Trade flux - push {@link TradeDTO}. | ||
*/ | ||
public class TradeFlux extends BaseFlux<TradeDTO> { | ||
|
||
/** Trade service. */ | ||
private final TradeService tradeService; | ||
|
||
/** Previous values. */ | ||
private final Map<String, TradeDTO> previousValues = new LinkedHashMap<>(); | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param newTradeService trade service | ||
*/ | ||
public TradeFlux(final TradeService newTradeService) { | ||
this.tradeService = newTradeService; | ||
} | ||
|
||
@Override | ||
@SuppressWarnings("unused") | ||
protected final Set<TradeDTO> getNewValues() { | ||
getLogger().debug("TradeFlux - Retrieving new values"); | ||
Set<TradeDTO> newValues = new LinkedHashSet<>(); | ||
|
||
// Finding which trades has been updated. | ||
tradeService.getTrades().forEach(trade -> { | ||
getLogger().debug("TradeFlux - Treating trade : {}", trade.getId()); | ||
TradeDTO existingTrade = previousValues.get(trade.getId()); | ||
if (existingTrade == null || !existingTrade.equals(trade)) { | ||
getLogger().debug("TradeFlux - Trade {} has changed : {}", trade.getId(), trade); | ||
previousValues.put(trade.getId(), trade); | ||
newValues.add(trade); | ||
} | ||
}); | ||
getLogger().debug("TradeFlux - {} trade(s) updated", newValues.size()); | ||
return newValues; | ||
} | ||
|
||
} |
Oops, something went wrong.