Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions lib/ib/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,26 @@ def send_message what, *args
# Place Order (convenience wrapper for send_message :PlaceOrder).
# Assigns client_id and order_id fields to placed order. Returns assigned order_id.
def place_order order, contract
order.place contract, self
# order.place contract, self ## old
error "Unable to place order, next_local_id not known" unless next_local_id
error "local_id present. Order is already placed. Do might use modify insteed" unless order.local_id.nil?
order.client_id = client_id
order.local_id = next_local_id
self.next_local_id += 1
order.placed_at = Time.now
modify_order order, contract
end

# Modify Order (convenience wrapper for send_message :PlaceOrder). Returns order_id.
def modify_order order, contract
order.modify contract, self
# order.modify contract, self ## old
error "Unable to modify order; local_id not specified" if order.local_id.nil?
order.modified_at = Time.now
send_message :PlaceOrder,
:order => order,
:contract => contract,
:local_id => order.local_id
order.local_id # return value
end

# Cancel Orders by their local ids (convenience wrapper for send_message :CancelOrder).
Expand Down
16 changes: 0 additions & 16 deletions lib/ib/model.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
## Connection to Orientdb is established if the oriendb-client is
# present upon require if ib-ruby
# If ActiveOrient is not connected (ActiveOrient::Init.connect has not been called)
# lightweigth tables are used
require 'ib/base_properties'
#require 'active-orient'
#if ActiveOrient::Model.orientdb.nil?
require 'ib/base'
IB::Model = IB::Base
#else
# require 'ib/orientdb'
# IB::Model = V #ActiveOrient::Base
# IB::DB.connect
# puts " IB-Ruby is run in OrientDB-Mode"
#end
#module IB
# IB Models can be either lightweight (tableless) or database-backed.
# require 'ib/db' - to make all IB models database-backed
# Model = IB.db_backed? ? ActiveRecord::Base : IB::Base
#end
93 changes: 0 additions & 93 deletions lib/models/ib/butterfly.rb

This file was deleted.

107 changes: 0 additions & 107 deletions lib/models/ib/calendar.rb

This file was deleted.

5 changes: 5 additions & 0 deletions lib/models/ib/contract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ def essential
end


# creates a new Contract substituting attributes by the provied key-value pairs
def merge **new_attributes
self.class.new attributes.merge new_attributes
end

# Contract comparison

def == other # :nodoc:
Expand Down
Loading