Skip to content

Commit d9b1ad6

Browse files
author
Halfgarten Capital
committed
removed Contract#from_ib_ruby and String#to_contract
1 parent d11d6c1 commit d9b1ad6

2 files changed

Lines changed: 4 additions & 23 deletions

File tree

lib/ib/messages/outgoing/bar_requests.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ def parse data
1818
# unless BAR_SIZES.keys.include?(bar_size)
1919
# error ":bar_size must be one of #{BAR_SIZES.inspect}", :args
2020
# end
21-
22-
contract = data[:contract].is_a?(IB::Contract) ?
23-
data[:contract] : IB::Contract.from_ib_ruby(data[:contract])
24-
25-
[data_type, nil, contract]
21+
unless data[:contract].is_a? IB::Contract
22+
error "contract must be a valid IB::Contract" , :args
23+
end
24+
[data_type, nil, data[:contract]]
2625
end
2726
end
2827

lib/models/ib/contract.rb

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -424,24 +424,6 @@ def self.build opts = {}
424424
end
425425

426426

427-
# This returns a Contract initialized from the serialize_ib_ruby format string.
428-
def self.from_ib_ruby
429-
keys = [:con_id, :symbol, :sec_type, :expiry, :strike, :right, :multiplier,
430-
:exchange, :primary_exchange, :currency, :local_symbol]
431-
props = Hash[keys.zip(string.split(":"))]
432-
props.delete_if { |k, v| v.nil? || v.empty? }
433-
Contract.build props
434-
end
435427
end # class Contract
436428
end # module IB
437429

438-
class String
439-
def to_contract
440-
keys = [:con_id, :symbol, :sec_type, :expiry, :strike, :right, :multiplier,
441-
:exchange, :primary_exchange, :currency, :local_symbol]
442-
props = Hash[keys.zip(split(":"))]
443-
props.delete_if { |k, v| v.nil? || v.empty? }
444-
IB::Contract.build props
445-
446-
end
447-
end

0 commit comments

Comments
 (0)