Hi!
I thought about a way to describe trading strategies in a well-defined language. Still working on the concept, but here is a simple example, what it could look like:
rule "Compare btc-e sma"
when
( BTCe.btc<=>usd.ticker.buy * 110% > BTCe.btc<=>usd.sma(6h) ) && ( BTCe.btc.balance() > 1.0 )
then
BTCe.btc<=>usd.sell( BTCe.btc.balance() - 1.0)
end
The overall structure is taken from drools (that's what I want to translate it to).
Most of these expressions follow the scheme
<tradesite>.<currency pair>.<method>
or
<tradesite>.<currency>.<method>
which is quite easy to parse because the '<=>' indicates a currency pair in my app. laSeek already contributed the first construct, namely the '%' suffix. Times are always handled as microseconds here, which gives you sometimes numbers, that are not very convenient to read. So I wanted to use suffixes, like 's', 'm' and 'h' (maybe even 'd' for days) to make the numbers more readable. So 1s just translates to 1000000 here.
This structure would be simple enough to translate it automatically, which is important to me. My idea so far was to write an Antlr grammar to parse the language, because it has a non.restrictive license and everyone could add his own productions.
Is there any interested in such a definition? People willing to collaborate to create one?
Ciao,
Andreas