TODO for trading robot DSL

November 24th, 2007

del.icio.us Reddit Slashdot Digg Facebook Technorati Google StumbleUpon Yahoo Bloglines Bookmark.it Ask Mister Wong Netvouz

  1. Online and history quote mode for opentick servers
  2. Other type of trading orders (stop, stop limit, trailing & etc)
  3. Some useful functions for technical analysis
  4. Improve redundancy for order placement plugin (must remeber it’s state in all securities)
  5. All-in-one installation program and instructions for Linux/OSX/Windows
  6. Documentation for plugin’s API
  7. Documentation for trading robot DSL syntax

will see :)

Trading robot DSL version 0.0.2 released

November 24th, 2007

del.icio.us Reddit Slashdot Digg Facebook Technorati Google StumbleUpon Yahoo Bloglines Bookmark.it Ask Mister Wong Netvouz

Changes:

  1. Plugins support for flexibility
  2. IB Trader workstation online and history mode for quotes
  3. IB Trader workstation market and limit order placement
  4. SMA and EMA functions

List of plugins:

  • IBHistoryPlugin - for history quotes IB TWS
  • IBOnlinePlugin - for online quotes IB TWS
  • IBOrderPlugin - for order placement IB TWS
  • TAPlugin - for technical analysis functions

Here some working examples:
1. Online quotes mode:


robot do
  # loading plugins, first must be plugin for query
  plugin DSL::IBOnlinePlugin, DSL::IBOrderPlugin, DSL::TAPlugin
  # online quotes mode configuration with bar duration = 10 seconds
  online :duration => 10
  # contract specifications YM symbol future on ECBOT exchange with 200712 expiry date
  YM.ECBOT FUT, USD, 200712
  # main loop: query online quotes for YM
  query YM do
    if (ema YM, 9)/(ema YM, 25) - 1 > 0.05
      # place buy market order with size = 1 for YM future
      order YM, BUY, MKT, 1
    end
    if (ewa YM, 9)/(ewa YM, 25) - 1 < -0.05
      # place sell market order with size = 1 for YM future
      order YM, SELL, MKT, 1
    end
  end # query
end # robot

Trading robot DSL for automated trading programs released

November 19th, 2007

del.icio.us Reddit Slashdot Digg Facebook Technorati Google StumbleUpon Yahoo Bloglines Bookmark.it Ask Mister Wong Netvouz

Yes, version 0.0.1 released - only historical mode works. Tomorrow i’ll add online mode (during trading session) and order placement.

This example simple get quotes for GOOG and CSCO tickers and print simple average (period=3):


robot connect do
	login 'test_opentick', '123123'
	history :duration => 300, :from => Time.now-10*24*3600, :to => Time.now
	query GOOG.Q,CSCO.Q do
		p avg GOOG.Q, 3
		p avg CSCO.Q, 3
	end # query
end # robot

see Download page

Example of trading robot DSL code

November 11th, 2007

del.icio.us Reddit Slashdot Digg Facebook Technorati Google StumbleUpon Yahoo Bloglines Bookmark.it Ask Mister Wong Netvouz


<pre>
robot do
  online :duration => 300
  query MSFT do
    unless openposition MSFT
      if (ewa MSFT, 9)/(ewa MSFT, 25) - 1 > 0.5
        buy MSFT, MKT, 10
      end
    else
      if (ewa MSFT, 9)/(ewa MSFT, 25) - 1 < - 0.5
        sell MSFT, MKT, 10
      end
    end # unless
  end # query
end # robot
</pre>

DSL library will be posted in 2 days

DSL for trading robot

November 9th, 2007

del.icio.us Reddit Slashdot Digg Facebook Technorati Google StumbleUpon Yahoo Bloglines Bookmark.it Ask Mister Wong Netvouz

After seeing these presentations:

Introduction to Domain Specific Languages

Agile DSL Development in Ruby

I decided to organize my research process and develop Domain specific language for automated trading - it will simplify future robots development and testing.