Skip to content

Commit

Permalink
Hidden Order Integration Tests Failing #978 (#977)
Browse files Browse the repository at this point in the history
* -Fix for #810, wrong message on soft trailing stop.

* -updated orko-parent snapshots

* -Changed the Xchange version from the 5.0.0-SNAPSHOT to 5.0.0

* Commented out Hidden Order integration tests

* -Potential fix for 'Hidden orders' test failure
  • Loading branch information
AwooOOoo authored Aug 19, 2020
1 parent e312fe5 commit a3a199e
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 35 deletions.
2 changes: 1 addition & 1 deletion orko-app-marketdata/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>com.gruelbox</groupId>
<artifactId>orko-parent</artifactId>
<version>0.15.2-SNAPSHOT</version>
<version>0.15.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,10 @@ private void tickTransaction(TickerEvent tickerEvent) {
}

// If we've hit the stop price, we're done
if ((job.direction().equals(Direction.SELL) && ticker.getBid().compareTo(stopPrice) <= 0)
|| (job.direction().equals(Direction.BUY) && ticker.getAsk().compareTo(stopPrice) >= 0)) {

if (job.direction().equals(Direction.SELL) && ticker.getBid().compareTo(stopPrice) <= 0) {
notificationService.info(
String.format(
"Trailing stop on %s %s/%s market hit stop price (%s < %s)",
"Trailing stop on %s %s/%s market hit exit price (%s < %s)",
job.tickTrigger().exchange(),
job.tickTrigger().base(),
job.tickTrigger().counter(),
Expand All @@ -190,6 +188,21 @@ private void tickTransaction(TickerEvent tickerEvent) {

jobSubmitter.submitNewUnchecked(limitOrderJob);

jobControl.finish(SUCCESS);
done = true;
return;
} else if (job.direction().equals(Direction.BUY) && ticker.getAsk().compareTo(stopPrice) >= 0) {
notificationService.info(
String.format(
"Trailing stop on %s %s/%s market hit entry price (%s > %s)",
job.tickTrigger().exchange(),
job.tickTrigger().base(),
job.tickTrigger().counter(),
ticker.getAsk(),
stopPrice));

jobSubmitter.submitNewUnchecked(limitOrderJob);

jobControl.finish(SUCCESS);
done = true;
return;
Expand Down Expand Up @@ -223,9 +236,7 @@ private void validate(LimitOrderJob limitOrderJob) {
@Override
public void replace(Job replacement) {
jobControl.replace(
SoftTrailingStopProcessor.this
.job
.toBuilder()
SoftTrailingStopProcessor.this.job.toBuilder()
.balanceState(((LimitOrderJob) replacement).balanceState())
.build());
}
Expand Down
55 changes: 30 additions & 25 deletions orko-end-to-end-testing/cypress/integration/coins/trade.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ context("Trading", () => {
limitTrade("sell", 100, "0.02")
})

it("Hidden orders", () => {
it("Hidden orders", async () => {
const createHiddenOrder = ({
direction,
amount,
Expand Down Expand Up @@ -249,52 +249,57 @@ context("Trading", () => {
highPrice: price + 1000,
highLimitPrice: price + 1100,
amount: 1
})
checkCancelServerSideOrder({
direction: "buy",
amount: "1",
stopPrice: price + 1000,
limitPrice: price + 1100
}).then(response => {
checkCancelServerSideOrder({
direction: "buy",
amount: "1",
stopPrice: price + 1000,
limitPrice: price + 1100
})
})

createHiddenOrder({
direction: "BUY",
lowPrice: price - 900,
lowLimitPrice: price - 1000,
amount: 1
})
checkCancelServerSideOrder({
direction: "buy",
amount: "1",
stopPrice: price - 900,
limitPrice: price - 1000
}).then(response => {
checkCancelServerSideOrder({
direction: "buy",
amount: "1",
stopPrice: price - 900,
limitPrice: price - 1000
})
})

createHiddenOrder({
direction: "SELL",
lowPrice: price - 1000,
lowLimitPrice: price - 900,
amount: 1
})
checkCancelServerSideOrder({
direction: "sell",
amount: "1",
stopPrice: price - 1000,
limitPrice: price - 900
}).then (response => {
checkCancelServerSideOrder({
direction: "sell",
amount: "1",
stopPrice: price - 1000,
limitPrice: price - 900
})
})

createHiddenOrder({
direction: "SELL",
highPrice: price + 1100,
highLimitPrice: price + 1000,
amount: 1
}).then(response => {
checkCancelServerSideOrder({
direction: "sell",
amount: "1",
stopPrice: price + 1100,
limitPrice: price + 1000
})
})
checkCancelServerSideOrder({
direction: "sell",
amount: "1",
stopPrice: price + 1100,
limitPrice: price + 1000
})

})
})

Expand Down
2 changes: 1 addition & 1 deletion orko-integration-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.gruelbox</groupId>
<artifactId>orko-parent</artifactId>
<version>0.15.2-SNAPSHOT</version>
<version>0.15.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
<junit.version>5.6.2</junit.version>

<xchange.groupid>org.knowm.xchange</xchange.groupid>
<xchange.version>5.0.0-SNAPSHOT</xchange.version>
<xchange.version>5.0.0</xchange.version>

<morf.groupid>com.github.badgerwithagun.morf</morf.groupid>
<morf.version>0.1.3.4</morf.version>
Expand Down

0 comments on commit a3a199e

Please sign in to comment.