Skip to content

Instantly share code, notes, and snippets.

@kennystone
Created July 8, 2010 21:10
Show Gist options
  • Save kennystone/468629 to your computer and use it in GitHub Desktop.
Save kennystone/468629 to your computer and use it in GitHub Desktop.
champ ruby
conf = {:host=>"127.0.0.1", :port=>2345, :api_info=>{:name=>:ruby_client, :vers=>"ruby-api.0.1"}, :user=>"user", :password=>"password"}
require 'connamara_api'
require 'pub/champ/publisher'
require 'serializer/erlbin/erlang_binary_term'
include Connamara
cp = ConnamaraAPI.run( conf, ErlangBinaryTerm, ChampPub )
cp.subscribe(:Position) {|pos| puts 'pos ' + pos.inspect }
cp.subscribe(:Execution) {|ex| puts 'ex ' + ex.inspect }
cp.publish( :Execution,
:Side=>ConnamaraAPI::OrderSide::BUY,
:Price=>100,
:InstrumentID=>:AAPL,
:AccountID=>:JCD,
:Quantity=>200 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment