-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script engine support for Balance #983 #992
Conversation
@badgerwithagun - I've made some mark down updates on some of the wikis, but don't have permission to push changes and can't fork to do a PR. Whats the best way to submit them? |
This looks great. Could we move the new method to |
One other thought, probably not one to solve here, is that the ticker and balance event objects are not version controlled DTOs, and we should probably create some for this. If those objects change, we can't have that propagating to the script API without careful consideration. |
@badgerwithagun , |
orko-common/src/main/java/com/gruelbox/orko/job/script/ScriptJobProcessor.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Just one small cleanup then I think we're good to go.
One more thing: could you extend the testing in |
…erTrades) for clarity
… script-engine
Code Cleanup submitted. Its going to take me a little bit to wrap my head around how to write those test cases well. |
Is there a shortcut to just running the TestScriptJobProcessor tests? I'm still getting familiar with the environment. |
Do you use a Java IDE, @AwooOOoo ? This is easy in IntelliJ, just right-click and run. |
orko-common/src/main/java/com/gruelbox/orko/job/script/ScriptJobProcessor.java
Outdated
Show resolved
Hide resolved
orko-common/src/main/java/com/gruelbox/orko/job/script/ScriptJobProcessor.java
Outdated
Show resolved
Hide resolved
@badgerwithagun Currently using Visual Studio Code. I installed eclipse, but haven't gotten into it yet and it seems to have a steep learning curve. Sorry if the PR's aren't efficient. I haven't programmed Java in many years and so am pretty damn rusty. I appreciate the hints, its a lot to take in trying to remember the language and take in the code base. |
Got it. FWIW, IntelliJ is by far the easiest to use with this codebase. If you load it as a Maven project it will work out of the box with no further configuration. |
It is easy with IntelliJ, thanks =) |
…returns. - Cleaned up some warnings reported by IntelliJ
orko-common/src/main/java/com/gruelbox/orko/job/script/ScriptJobProcessor.java
Outdated
Show resolved
Hide resolved
orko-common/src/main/java/com/gruelbox/orko/job/script/ScriptJobProcessor.java
Outdated
Show resolved
Hide resolved
Merged. Thanks @AwooOOoo :) |
@badgerwithagun There is a PR in the wiki, that covers the changes. I'll add the unit tests when I get some time. |
Added balance support into the script engine (#983). It is set up similar to setTick in that it takes a callback and the trading pair to return the balance on.
Fields Available
The balance exposes the following fields;
[currency=ETH, total=1000, available=1000, frozen=0, borrowed=0, loaned=0, withdrawing=0, depositing=0]
Note that the response is called twice, once for the base and once for the quote. Assuming you had ETH/EUR selected, in the example below, it would call the function once for ETH and once for EUR.
Example Usage:
Output from Example:
Possible Improvements:
Thoughts?