Open 0x7183 opened 1 year ago
@0x7183 can you give a job example of using if else?
@llllllluc following some examples:
@llllllluc following some examples:
- A Grid bot using warp
- Most of the trading strategies
- Handling of errors in sub messages
sorry i mean job example where the condition needs if else, can you write some sudo code to help me better understand? the more detail the better maybe use grid bot as example
With a grid bot we need to buy or sell an asset based on the price.
Right now there isn't a way to implement it using only warp.
We'll require a job for the buy message with the buy condition and a job with for the sell message with the sell condition. Also when a job is triggered we have to delete the other one and create a new buy and sell message updating the parameters based on the last message.
What we need is something like that in pseudo code:
If buy: buy msg else if sell: sell msg else: pass
Sorry for the formatting, but I'm from phone and is pretty late here.
If this isn't enough I'll provide more details tomorrow!
I see, this is a nice feature we should support, it's like having 2 condition field and 2 msgs fields, if cond 1 resolves to true, then execute msgs 1, if cond 2 resolves to true, then execute msgs 2, if both resolves to false, then do nothing, but what if both resolve to true? I'm trying to think of an elegant way to implement this. Maybe you can bring this up in warp telegram, and let @vladjdk and @simke9445 chime in.
when a job is triggered we have to delete the other one and create a new buy and sell message updating the parameters based on the last message.
I think this is already supported by the recurring job, where you can update var every time it executes (recurring job is after you execute, it will create a new one)
@vladjdk told us to open an issue on Github and discuss there the implementation details, if you're ok with it we can start working at it and make a PR at the end.
Just what is the main branch?
awesome! the pre release branch is in https://github.com/terra-money/warp-contracts/pull/67, looking forward to the PR!
Cool idea, me and @vladjdk were discussing this on several occasions, and its great that you guys took a hand of it.
Ideally this would work very similar to a switch
statement.
Job would look like this:
in your case:
BIG Labs is interested in contributing to Warp Contracts by adding the ability to use if-else conditions when creating jobs. We would like to discuss the technical aspects and implementation details with the Warp Contracts development team.