Bitcoin Forum
April 18, 2024, 02:10:31 AM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Warning: One or more bitcointalk.org users have reported that they strongly believe that the creator of this topic is a scammer. (Login to see the detailed trust ratings.) While the bitcointalk.org administration does not verify such claims, you should proceed with extreme caution.
Pages: [1]
  Print  
Author Topic: Formal definition of a trading language  (Read 2631 times)
daybyter (OP)
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


View Profile
December 15, 2012, 01:59:11 PM
 #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

<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

1713406231
Hero Member
*
Offline Offline

Posts: 1713406231

View Profile Personal Message (Offline)

Ignore
1713406231
Reply with quote  #2

1713406231
Report to moderator
1713406231
Hero Member
*
Offline Offline

Posts: 1713406231

View Profile Personal Message (Offline)

Ignore
1713406231
Reply with quote  #2

1713406231
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713406231
Hero Member
*
Offline Offline

Posts: 1713406231

View Profile Personal Message (Offline)

Ignore
1713406231
Reply with quote  #2

1713406231
Report to moderator
1713406231
Hero Member
*
Offline Offline

Posts: 1713406231

View Profile Personal Message (Offline)

Ignore
1713406231
Reply with quote  #2

1713406231
Report to moderator
kakobrekla
Hero Member
*****
Offline Offline

Activity: 714
Merit: 500


Psi laju, karavani prolaze.


View Profile
December 15, 2012, 02:03:30 PM
 #2

Perhaps take a look at http://book.mql4.com/ / http://www.mql5.com/en/docs

daybyter (OP)
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


View Profile
December 15, 2012, 02:16:04 PM
 #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.

laSeek
Member
**
Offline Offline

Activity: 70
Merit: 10


Litecoin Core Developer


View Profile WWW
December 15, 2012, 04: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.

Litecoin Core Developer
 - Dev Repo - https://github.com/dasher/litecoin.git
Donations:  LTC LX2aYdR8jPiHUHVmegBiK1DBGa2fusz1fx  BTC 1PnAbtTnQJTiZ1N1RVHLq2vop77PWwsCoC
daybyter (OP)
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


View Profile
December 15, 2012, 04:29:17 PM
 #5

I thought about users of a trading site, allowing people to upload such scripts for trading.

Kettenmonster
Sr. Member
****
Offline Offline

Activity: 420
Merit: 250


bool eval(bool b){return b ? b==true : b==false;}


View Profile
December 15, 2012, 05: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

The paining (sic!) is done with the QPainter class inside the paintEvent() method.
(source: my internet)
daybyter (OP)
Legendary
*
Offline Offline

Activity: 965
Merit: 1000


View Profile
December 15, 2012, 06:36:58 PM
 #7

I'm too honest to do that..  Roll Eyes

Stephen Gornick
Legendary
*
Offline Offline

Activity: 2506
Merit: 1010


View Profile
December 16, 2012, 12:49:00 PM
 #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/

Unichange.me

            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █
            █


bluemeanie1
Sr. Member
****
Offline Offline

Activity: 280
Merit: 257


bluemeanie


View Profile WWW
November 15, 2013, 09: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

Just who IS bluemeanie?    On NXTautoDAC and a Million Stolen NXT

feel like your voice isn't being heard? PM me.   |   stole 1M NXT?
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!