gruelbox/orko

Wrong message on trailing stop buy activation

konqueror1 opened this issue · 9 comments

Describe the bug
I am adding a trailing stop buy order for LTC/USDT with initial stop 37.1 and limit price 37. Current price is ~37.5. When submit the stop executes immediately with this in the log:

Trailing stop on binance LTC/USDT market hit stop price (37.57000000 < 37.10)
It is obvious that 37.57 is not less than 37.10.

Tested with the latest official release 0.15.2 and with bleeding-edge snapshot 0.15.3-SNAPSHOT

Expected behavior
I expect the order execution to happen when current price >= 37.1

I think it's just the message that's wrong. The code does this:

if
 job.direction = SELL and ticker.bidPrice <= stopPrice
or
 job.direction = BUY and ticker.askPrice >= stopPrice

But it always uses the same message.

Code here.

It's a very simple fix.

Hi Graham,
I new to the Circleci pipeline and saw it reported that the build failed. It compiled locally with Maven, could you give me some pointers as to what I missed?

Paul

Ok Fixed that...Stale POM snapshots 0.15.2 vs. 0.15.3. Now it compiles, but integration testing fails. When I run the integration tests locally, I get the following error repeated:

ERROR [2020-08-14 19:01:10,535] com.gruelbox.orko.auth.ipwhitelisting.IpWhitelistingService: Access attempt from [127.0.0.1] not whitelisted

How do I add IP whitelisting to get the tests to run?

Hey @AwooOOoo. Check out the file start-integration-test.sh which shows how to run the app with the integration test specific configuration. In the IDE you just need to run the main class with server ../integration-test-config.yml (or something like that) in the IDE's run configuration.

@badgerwithagun, I was running start-integration-test.sh (command line) when I get the above-listed error repeatedly.

Try mvn -Pe2etest verify.

That starts up an instance of the app and runs the tests in the same way as on CircleCI, which we know works.

Does that work for you?

It runs, but now I am seeing a failure in Orko Job tests... (good times)

[ERROR] Failures: 
[ERROR]   TestJobExecution.testFailOnStopNonResident:235 
Wanted but not invoked:
statusUpdateService.status("JOB1", SUCCESS);
-> at com.gruelbox.orko.jobrun.TestJobExecution.testFailOnStopNonResident(TestJobExecution.java:235)
Actually, there were zero interactions with this mock.

[INFO] 
[ERROR] Tests run: 30, Failures: 1, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Orko 0.15.3-SNAPSHOT:
[INFO] 
[INFO] Orko ............................................... SUCCESS [  0.023 s]
[INFO] Orko Base .......................................... SUCCESS [ 15.519 s]
[INFO] Orko DB Testsupport ................................ SUCCESS [  0.771 s]
[INFO] Orko Auth .......................................... SUCCESS [ 33.167 s]
[INFO] Orko Job ........................................... FAILURE [01:22 min]
[INFO] Orko Common ........................................ SKIPPED
[INFO] Orko Monolith Application .......................... SKIPPED
[INFO] Orko End-to-End Tests .............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:12 min
[INFO] Finished at: 2020-08-15T12:46:22+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project orko-job: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/paul/Code/tmp/orko/orko-job/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :orko-job

Exactly the same as here:

https://circleci.com/workflow-run/62b4f5fc-8447-4ed6-9e01-c672cffb59c0

So it's not you! Looks like something changed between the old 5.0.0 version of XChange it last successfully built against and 5.0.0. fun times as you say...

It looks like the following test cases are the ones with issues:

Orko Job: testFailOnStopNonResident() - 1 Error (TestJobExecution.testFailOnStopNonResident:235
Wanted but not invoked:
statusUpdateService.status("JOB1", SUCCESS);
-> at com.gruelbox.orko.jobrun.TestJobExecution.testFailOnStopNonResident(TestJobExecution.java:235)
Actually, there were zero interactions with this mock.)

Orko Common: testSubscriptionsDirect() - 2 Errors (Timed out waiting for SubscriptionControllerImpl)
Orko Common: TestEventBusSubscriptionDifferentSubscriberInner() - 2 Errors (Timed out waiting for SubscriptionControllerImpl)
Orko Common: testEventBusSubscriptionSameSubscriber() - 2 Errors (Timed out waiting for SubscriptionControllerImpl)
Orko Common: testEventBusSubscriptionDifferentSubscriberOuter() - 1 Error (Timed out waiting for SubscriptionControllerImpl)