Author

Topic: Formal definition of a trading language (Read 2630 times)

sr. member
Activity: 280
Merit: 257
bluemeanie
November 15, 2013, 05:48:13 PM
#9
also an interesting web search find:  "Describing, manipulating and pricing financial contracts: The MLFi language"

http://www.lexifi.com/files/resources/Cambridge_lexifi.pdf
legendary
Activity: 2506
Merit: 1010
December 16, 2012, 08:49:00 AM
#8
Is there any interested in such a definition? People willing to collaborate to create one?

Related:

Towards a unified exchange protocol
 - http://polimedia.us/trilema/2012/towards-a-unified-exchange-protocol/
legendary
Activity: 965
Merit: 1000
December 15, 2012, 02:36:58 PM
#7
I'm too honest to do that..  Roll Eyes
sr. member
Activity: 420
Merit: 250
bool eval(bool b){return b ? b==true : b==false;}
December 15, 2012, 01:03:37 PM
#6
So you want to provide a site with a configurable/programmable trading bot?  Huh

Don't forget to exploit the strategy hidden in those uploaded scripts. Best business model ever! Grin
legendary
Activity: 965
Merit: 1000
December 15, 2012, 12:29:17 PM
#5
I thought about users of a trading site, allowing people to upload such scripts for trading.
member
Activity: 70
Merit: 10
Litecoin Core Developer
December 15, 2012, 12:21:39 PM
#4

The first step is clearly defining what you're trying to achieve & why - who the target audience is for the proposal and who the userbase is for the rules (they're not the usually the same people).

This will help drive the DSL and start providing some structure to the design of the DSL.

For instance - if you're looking at the core of the DSL and won't be allowing the reference of one rule from another, or your outlining a rule without worrying about rules being portable between systems - then rule-names aren't needed.

If you're designing the DSL for coder then the type of syntax you're outlining would be familiar to them - but this type of syntax isn't intuitive to Joe off the street.

So a few questions to help get your started:
Who is this outline targeted at - implementers? Site Owners, Currency exchange or Stock trading boards?
Who will be writing the rule syntax? People currently day trading with some kind of bot already? People without bots? Techies or home-makers?
Why a common language at all? Do you think the current service layer is mature enough to warrant a common standard?

Look at the more recent HTML standards - one reason they exist (one of many) is that they help ensure there's a common definition for implementers so that there's common behaviour across different browsers for content creators.

I'm playing devils advocate with some of them - but it helps ensure people reading and those working on it have a common frame of reference.
legendary
Activity: 965
Merit: 1000
December 15, 2012, 10:16:04 AM
#3
Well, I wasn't thinking about a full-blown OO language. Just simple if ... then .... rules. So even non-coders can write their traders.
hero member
Activity: 714
Merit: 500
Psi laju, karavani prolaze.
legendary
Activity: 965
Merit: 1000
December 15, 2012, 09:59:11 AM
#1
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:

Code:
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

..
or
..

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
Jump to: