DSL for trading

Discussion in 'Automated Trading' started by nitro, Dec 5, 2009.

  1. nitro

    nitro

    Does anyone know of a DSL (Domain Specific Language) that implements trading semantics?

    For example, it would be great to be able to say something like:

    (when (and (< time 20:00)
    (timing-is-right))
    (trade (make-shares 100 x)))

    (That's a lisp DSL).

    It would be also be great if this thing handled options. So to be able to say:

    (when (and (< time 16:00)
    (timing-is-right))
    (trade (make-synthetic-ATM-straddle 50 x)
    (delta-hedge (StdDev 1))))

    I am looking for one in C# or F#
     
  2. nitro

    nitro

  3. nitro

    nitro

  4. chvid

    chvid

    Beyond toy examples - not really.

    Maybe tradestation or one of the financial focused complex event processing solutions.
     
  5. nitro

    nitro

    Thanks :(

    I am seriously considering starting an open source project to do one in F#.
     
  6. chvid

    chvid

    I'd be interested in participating.

    For my own setup I originally had a DSL I used for genetic programming but now I just have a single Java class and then use dependency injection, static imports and annotations to get a more concise definition of my trading system.

    This is thread on subject from nuclearfinance:

    http://nuclearphynance.com/Show Post.aspx?PostIDKey=116620
     
  7. I am not sure a DSL makes sense. See, the main problem is that trading decisions fall into the normal programming langauge paradigm. Yes, you need some methods to do the trading, but that is just methods.

    DSL are normally used when normal programming semantics do not fit. Example: SQL DDL (data definition language) expresses things that one can not normally express within a programming language (note: constructing an object tree is not the same as expressing something in the langauge).

    As I said, I do not think trading is something that widely benefits from a DSL approach.
     
  8. chvid

    chvid

  9. Somewhat agree...

    As nitro's 2nd example in his 1st post, if you're dealing with Pairs and Greek Arbs, Flow Hedges and other types of multiple legged trades... DSL helps out. Personally, all my trades are done within the normal semantics because I'm the only one using it. But I can see the benefit of it when there are multiple people handling the dev.

    I know a firm that has a SQL like DSL that does things like:

    Code:
    "TRADE 
          SYNTHETIC_ATM_STRADDLE(OPTION.DELTA_NEUTRAL)
    FROM 
          OPTIONS
    INNER JOIN
          UNDERLYING
          ON UNDERLYING.SYMBOL_CODE = OPTIONS.UNDERLYING_CODE
    WHERE
          OPTION.DELTA >= 1     
          AND UNDERLYING.CORP_ACTION != '1'
          AND UNDERLYING.REGION = 'US';"
    * The example above in not what that firm exactly uses but it's based on what I've heard from the chick. But from she said, the query is like a SQL SELECT statement that uses TRADE instead of SELECT. Each data column represents a set or a single leg. From is the Data source. Where statement is the Analytics. Also, by changing the "TRADE" to "DISPLAY", the app. outputs a string result of the query.

    I thought it was cool....
     
  10. #10     Dec 7, 2009