ib-api 972.1 → 972.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9119cbc06f3b5e5e32b73fbe0d706b06d94c55ff2ce2ca4357e4f349f49f43f
4
- data.tar.gz: b977e09dee0df176e673679839b738425871dbf25ca8cad4e8f497323647ecc6
3
+ metadata.gz: c55a18237300e1d54915e0fd71dc9a51766be578b8f25d73dd70a115961ed935
4
+ data.tar.gz: f9aed73cec7a0959145d384f655dfbdd9f8416e6b0ddd4e21200ef30d458e149
5
5
  SHA512:
6
- metadata.gz: '02538d6ab965ee0024cef798aebbcdff42859025a848108c5ca7af1e305cae019b1db3f9489300497fde388f5b0e659064d305ec316695d4154d20abc05277f1'
7
- data.tar.gz: 3245c0fda19a98f6ab5b29827b246b91d31c91a5daac10bcd8bbe114d699edc117922bae11503b3219f7bd18d8b654b6be6e19365c346bad3f4201829ce6f97b
6
+ metadata.gz: 9a0fdbf9030c14c83b164531967ff130af078a3a1bdd6cf44697cb26887012d176ac929279eb8608b2920a2b4dd48b6434a129daf88cfdd1cb65a78014e35db9
7
+ data.tar.gz: 64fa9394bd0a90c6a4c8abdc0c0a798816d913f5d25fd40fa67032db459cefb5bd296a1a7827ee05817f887c1b989ada9719494dfd6f348e25c45d0f4d7f37cd
data/Gemfile.lock CHANGED
@@ -7,23 +7,23 @@ GIT
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- ib-api (972.1)
10
+ ib-api (972.2)
11
11
  activemodel
12
12
  activesupport (>= 6.0)
13
13
 
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- activemodel (6.1.0)
18
- activesupport (= 6.1.0)
19
- activesupport (6.1.0)
17
+ activemodel (6.1.2.1)
18
+ activesupport (= 6.1.2.1)
19
+ activesupport (6.1.2.1)
20
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
21
  i18n (>= 1.6, < 2)
22
22
  minitest (>= 5.1)
23
23
  tzinfo (~> 2.0)
24
24
  zeitwerk (~> 2.3)
25
25
  coderay (1.1.3)
26
- concurrent-ruby (1.1.7)
26
+ concurrent-ruby (1.1.8)
27
27
  diff-lcs (1.4.4)
28
28
  ffi (1.13.1)
29
29
  formatador (0.2.5)
@@ -41,14 +41,14 @@ GEM
41
41
  guard (~> 2.1)
42
42
  guard-compat (~> 1.1)
43
43
  rspec (>= 2.99.0, < 4.0)
44
- i18n (1.8.5)
44
+ i18n (1.8.9)
45
45
  concurrent-ruby (~> 1.0)
46
46
  listen (3.2.1)
47
47
  rb-fsevent (~> 0.10, >= 0.10.3)
48
48
  rb-inotify (~> 0.9, >= 0.9.10)
49
49
  lumberjack (1.2.8)
50
50
  method_source (1.0.0)
51
- minitest (5.14.2)
51
+ minitest (5.14.3)
52
52
  nenv (0.3.0)
53
53
  notiffany (0.1.3)
54
54
  nenv (~> 0.1)
@@ -89,7 +89,7 @@ PLATFORMS
89
89
  ruby
90
90
 
91
91
  DEPENDENCIES
92
- bundler (~> 1.17)
92
+ bundler
93
93
  guard
94
94
  guard-rspec
95
95
  ib-api!
data/VERSION CHANGED
@@ -1 +1 @@
1
- 972.1
1
+ 972.2
data/api.gemspec CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
36
  spec.require_paths = ["lib"]
37
37
 
38
- spec.add_development_dependency "bundler", "~> 1.17"
38
+ spec.add_development_dependency "bundler"
39
39
  spec.add_development_dependency "rake", "~> 13.0"
40
40
  spec.add_development_dependency "rspec", "~> 3.0"
41
41
  spec.add_dependency 'activesupport', '>= 6.0'
data/changelog.md CHANGED
@@ -15,4 +15,5 @@ Changelog
15
15
  | 1.12.2020 | creating a dummy Contract#verify to guaranty safe operation of spreads |
16
16
 
17
17
  | | Preparation of a Gem-Release |
18
-
18
+ | 23.2.2021 | Fixed retrieving of ContractDetail requests of Options with strikes < 1
19
+ | | Gem Release |
@@ -30,12 +30,12 @@ module IB
30
30
  @created_at = Time.now
31
31
  if source.is_a?(Hash) # Source is a @data Hash
32
32
  @data = source
33
- @buffer =[] # initialize empty buffer, indicates a successfull initializing
33
+ @buffer =[] # initialize empty buffer, indicates a successful initializing
34
34
  else
35
35
  @buffer = source
36
36
  ### DEBUG DEBUG DEBUG RAW STREAM ###############
37
37
  # if uncommented, the raw-input from the tws is included in the logging
38
- # puts "BUFFER :> #{buffer.inspect} "
38
+ ## puts "BUFFER :> #{buffer.inspect} "
39
39
  ### DEBUG DEBUG DEBUG RAW STREAM ###############
40
40
  @data = Hash.new
41
41
  self.load
@@ -43,11 +43,11 @@ module IB
43
43
  end
44
44
 
45
45
  def valid?
46
- @buffer.empty?
46
+ @buffer.empty?
47
47
  end
48
48
 
49
49
  ## more recent messages omit the transmission of a version
50
- ## thus just load the parameter-map
50
+ ## thus just load the parameter-map
51
51
  def simple_load
52
52
  load_map *self.class.data_map
53
53
  rescue IB::Error => e
@@ -87,7 +87,7 @@ module IB
87
87
 
88
88
  when Symbol # Normal map
89
89
  group, name, type, block =
90
- if instruction[2].nil? || instruction[2].is_a?(Proc) # lambda's are Proc's
90
+ if instruction[2].nil? || instruction[2].is_a?(Proc) # lambda's are Proc's
91
91
  [nil] + instruction # No group, [ :name, :type, (:block) ]
92
92
  else
93
93
  instruction # [ :group, :name, :type, (:block)]
@@ -95,14 +95,14 @@ module IB
95
95
  begin
96
96
  data = @buffer.__send__("read_#{type}", &block)
97
97
  rescue IB::LoadError, NoMethodError => e
98
- error "Reading #{self.class}: #{e.class}: #{e.message} --> Instruction: #{name}" , :reader, false
98
+ error "Reading #{self.class}: #{e.class}: #{e.message} --> Instruction: #{name}" , :reader, false
99
99
  end
100
100
  # debug puts data.inspect
101
101
  if group
102
102
  @data[group] ||= {}
103
103
  @data[group][name] = data
104
104
  else
105
- @data[name] = data
105
+ @data[name] = data
106
106
  end
107
107
  else
108
108
  error "Unrecognized instruction #{instruction}"
@@ -25,9 +25,9 @@ module IB
25
25
  #
26
26
  def send_to socket
27
27
  ### debugging of outgoing Messages
28
- # puts "------sendto ---------(debugging output in outgoing/abstract_message)"
29
- # puts socket.prepare_message( self.preprocess).inspect.split('\x00')[3..-1].inspect
30
- # puts "------sendto ---------"
28
+ # puts "------sendto ---------(debugging output in outgoing/abstract_message)"
29
+ # puts socket.prepare_message( self.preprocess).inspect.split('\x00')[3..-1].inspect
30
+ # puts "------sendto ---------"
31
31
  socket.send_messages self.preprocess #.each {|data| socket.write_data data}
32
32
  end
33
33
 
@@ -136,13 +136,15 @@ module IB
136
136
 
137
137
  def serialize *fields # :nodoc:
138
138
  print_default = ->(field, default="") { field.blank? ? default : field }
139
- print_not_zero = ->(field, default="") { field.to_i.zero? ? default : field }
139
+ ## Non numeric entries are passed untouched, only 0 is converted to the default value
140
+ ## Thus: a Zero-Strike-Option has to be defined with «strike: "0"»
141
+ print_not_zero = ->(field, default="") { field.is_a?(Numeric) && field.zero? ? default : field }
140
142
  [(con_id.present? && !con_id.is_a?(Symbol) && con_id.to_i > 0 ? con_id : ""),
141
143
  print_default[symbol],
142
144
  print_default[self[:sec_type]],
143
145
  ( fields.include?(:option) ?
144
146
  [ print_default[expiry],
145
- print_not_zero[strike],
147
+ print_default[strike],
146
148
  print_default[self[:right]],
147
149
  print_default[multiplier]] : nil ),
148
150
  print_default[exchange],
@@ -395,7 +397,7 @@ In places where these terms are used to indicate a concept, we have left them as
395
397
  Subclasses = Hash.new(Contract)
396
398
  Subclasses[:bag] = IB::Bag
397
399
  Subclasses[:option] = IB::Option
398
- Subclasses[:future_option] = IB::FutureOption
400
+ Subclasses[:futures_option] = IB::FutureOption
399
401
  Subclasses[:future] = IB::Future
400
402
  Subclasses[:stock] = IB::Stock
401
403
  Subclasses[:forex] = IB::Forex
@@ -77,6 +77,8 @@ module IB
77
77
  end # class Option
78
78
 
79
79
  class FutureOption < Option
80
-
80
+ def default_attributes
81
+ super.merge :sec_type => :futures_option
82
+ end
81
83
  end
82
84
  end # module IB
@@ -514,6 +514,11 @@ Format of serialisation
514
514
  (account ? "/#{account}" : '') +
515
515
  (commission ? " fee #{commission}" : '') + ">"
516
516
  end
517
+ def serialize_rabbit
518
+ { 'Contract' => contract.present? ? contract.serialize( :option, :trading_class ): '' ,
519
+ 'Order' => self,
520
+ 'OrderState' => order_state}
521
+ end
517
522
 
518
523
  end # class Order
519
524
  end # module IB
@@ -111,16 +111,20 @@ Adds (or substracts) relative (back) measures to the front month, just passes ab
111
111
 
112
112
 
113
113
  def essential
114
- legs.each{ |x| x.essential }
115
- self
114
+ invariant_attributes
116
115
  end
116
+
117
117
  def multiplier
118
118
  (legs.map(&:multiplier).sum/legs.size).to_i
119
119
  end
120
120
 
121
- # provide a negative con_id
121
+ # provide a negative con_id
122
122
  def con_id
123
- -legs.map(&:con_id).sum
123
+ if attributes[:con_id].present? && attributes[] < 0
124
+ attributes[:con_id]
125
+ else
126
+ -legs.map{ |x| x.is_a?(String) ? x.expand.con_id : x.con_id}.sum
127
+ end
124
128
  end
125
129
 
126
130
 
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ib-api
3
3
  version: !ruby/object:Gem::Version
4
- version: '972.1'
4
+ version: '972.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hartmut Bischoff
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-22 00:00:00.000000000 Z
11
+ date: 2021-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.17'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.17'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
199
  requirements: []
200
- rubygems_version: 3.0.4
200
+ rubygems_version: 3.0.3
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: Ruby Implementation of the Interactive Brokers TWS API