ib-api 10.33.4 → 972.0

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.
Files changed (181) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -2
  3. data/Gemfile +2 -3
  4. data/Gemfile.lock +52 -67
  5. data/README.md +8 -60
  6. data/VERSION +1 -1
  7. data/api.gemspec +3 -10
  8. data/bin/console +38 -39
  9. data/bin/console.yml +2 -2
  10. data/changelog.md +0 -25
  11. data/example/README.md +76 -0
  12. data/example/account_info +54 -0
  13. data/example/account_positions +30 -0
  14. data/example/account_summary +88 -0
  15. data/example/cancel_orders +74 -0
  16. data/example/fa_accounts +25 -0
  17. data/example/fundamental_data +40 -0
  18. data/example/historic_data_cli +186 -0
  19. data/example/list_orders +45 -0
  20. data/example/portfolio_csv +81 -0
  21. data/example/scanner_data +62 -0
  22. data/example/template +19 -0
  23. data/example/tick_data +28 -0
  24. data/lib/extensions/class-extensions.rb +87 -0
  25. data/lib/ib/base.rb +1 -7
  26. data/lib/ib/base_properties.rb +12 -30
  27. data/lib/ib/connection.rb +269 -418
  28. data/lib/ib/constants.rb +22 -31
  29. data/lib/ib/errors.rb +1 -9
  30. data/lib/ib/logger.rb +26 -0
  31. data/lib/ib/messages/abstract_message.rb +43 -10
  32. data/lib/ib/messages/incoming/abstract_message.rb +98 -98
  33. data/lib/ib/messages/incoming/account_value.rb +78 -0
  34. data/lib/ib/messages/incoming/alert.rb +4 -4
  35. data/lib/ib/messages/incoming/contract_data.rb +29 -32
  36. data/lib/ib/messages/incoming/execution_data.rb +3 -3
  37. data/lib/ib/messages/incoming/historical_data.rb +33 -14
  38. data/lib/ib/messages/incoming/{market_depth.rb → market_depths.rb} +10 -0
  39. data/lib/ib/messages/incoming/next_valid_id.rb +0 -1
  40. data/lib/ib/messages/incoming/open_order.rb +201 -214
  41. data/lib/ib/messages/incoming/order_status.rb +1 -1
  42. data/lib/ib/messages/incoming/portfolio_value.rb +58 -27
  43. data/lib/ib/messages/incoming/scanner_data.rb +1 -1
  44. data/lib/ib/messages/incoming/ticks.rb +268 -0
  45. data/lib/ib/messages/incoming.rb +95 -136
  46. data/lib/ib/messages/outgoing/abstract_message.rb +22 -18
  47. data/lib/ib/messages/outgoing/{request_account_summary.rb → account_requests.rb} +40 -7
  48. data/lib/ib/messages/outgoing/{bar_request_message.rb → bar_requests.rb} +16 -13
  49. data/lib/ib/messages/outgoing/place_order.rb +198 -138
  50. data/lib/ib/messages/outgoing/{request_market_data.rb → request_marketdata.rb} +29 -32
  51. data/lib/ib/messages/outgoing/request_tick_data.rb +21 -0
  52. data/lib/ib/messages/outgoing.rb +160 -133
  53. data/lib/ib/messages.rb +7 -47
  54. data/lib/ib/model.rb +4 -0
  55. data/lib/ib/models.rb +14 -0
  56. data/lib/{server_versions.rb → ib/server_versions.rb} +9 -40
  57. data/lib/ib/socket.rb +147 -45
  58. data/lib/ib/support.rb +158 -240
  59. data/lib/ib/version.rb +1 -1
  60. data/lib/ib-api.rb +5 -42
  61. data/lib/models/ib/account.rb +85 -0
  62. data/{models → lib/models}/ib/account_value.rb +5 -5
  63. data/{models → lib/models}/ib/bag.rb +7 -7
  64. data/{models → lib/models}/ib/bar.rb +2 -2
  65. data/{models → lib/models}/ib/combo_leg.rb +4 -26
  66. data/lib/models/ib/condition.rb +245 -0
  67. data/{models → lib/models}/ib/contract.rb +170 -166
  68. data/{models → lib/models}/ib/contract_detail.rb +15 -25
  69. data/{models → lib/models}/ib/execution.rb +1 -1
  70. data/{models → lib/models}/ib/forex.rb +2 -1
  71. data/lib/models/ib/future.rb +15 -0
  72. data/{models → lib/models}/ib/index.rb +3 -2
  73. data/lib/models/ib/option.rb +78 -0
  74. data/lib/models/ib/option_detail.rb +55 -0
  75. data/{models → lib/models}/ib/order.rb +165 -366
  76. data/{models → lib/models}/ib/order_state.rb +22 -25
  77. data/lib/models/ib/portfolio_value.rb +64 -0
  78. data/lib/models/ib/stock.rb +16 -0
  79. data/{models → lib/models}/ib/underlying.rb +5 -3
  80. data/lib/models/ib/vertical.rb +96 -0
  81. data/lib/requires.rb +12 -0
  82. metadata +64 -188
  83. data/CLAUDE.md +0 -131
  84. data/LLM_GUIDE.md +0 -388
  85. data/bin/simple +0 -91
  86. data/conditions/ib/execution_condition.rb +0 -31
  87. data/conditions/ib/margin_condition.rb +0 -28
  88. data/conditions/ib/order_condition.rb +0 -29
  89. data/conditions/ib/percent_change_condition.rb +0 -34
  90. data/conditions/ib/price_condition.rb +0 -44
  91. data/conditions/ib/time_condition.rb +0 -42
  92. data/conditions/ib/volume_condition.rb +0 -36
  93. data/lib/class_extensions.rb +0 -167
  94. data/lib/ib/contract.rb +0 -30
  95. data/lib/ib/messages/incoming/abstract_tick.rb +0 -25
  96. data/lib/ib/messages/incoming/account_message.rb +0 -26
  97. data/lib/ib/messages/incoming/contract_message.rb +0 -13
  98. data/lib/ib/messages/incoming/histogram_data.rb +0 -30
  99. data/lib/ib/messages/incoming/historical_data_update.rb +0 -50
  100. data/lib/ib/messages/incoming/managed_accounts.rb +0 -21
  101. data/lib/ib/messages/incoming/market_depth_l2.rb +0 -15
  102. data/lib/ib/messages/incoming/position_data.rb +0 -21
  103. data/lib/ib/messages/incoming/positions_multi.rb +0 -15
  104. data/lib/ib/messages/incoming/receive_fa.rb +0 -30
  105. data/lib/ib/messages/incoming/tick_by_tick.rb +0 -77
  106. data/lib/ib/messages/incoming/tick_efp.rb +0 -18
  107. data/lib/ib/messages/incoming/tick_generic.rb +0 -12
  108. data/lib/ib/messages/incoming/tick_option.rb +0 -60
  109. data/lib/ib/messages/incoming/tick_price.rb +0 -60
  110. data/lib/ib/messages/incoming/tick_size.rb +0 -55
  111. data/lib/ib/messages/incoming/tick_string.rb +0 -13
  112. data/lib/ib/messages/outgoing/new-place-order.rb +0 -193
  113. data/lib/ib/messages/outgoing/old-place-order.rb +0 -147
  114. data/lib/ib/messages/outgoing/request_historical_data.rb +0 -182
  115. data/lib/ib/messages/outgoing/request_market_depth.rb +0 -57
  116. data/lib/ib/messages/outgoing/request_real_time_bars.rb +0 -48
  117. data/lib/ib/messages/outgoing/request_scanner_subscription.rb +0 -73
  118. data/lib/ib/messages/outgoing/request_tick_by_tick_data.rb +0 -21
  119. data/lib/ib/order_condition.rb +0 -26
  120. data/lib/ib/plugins.rb +0 -27
  121. data/lib/ib/prepare_data.rb +0 -61
  122. data/lib/ib/raw_message_parser.rb +0 -99
  123. data/lib/support/array_function.rb +0 -28
  124. data/lib/support/logging.rb +0 -45
  125. data/models/ib/account.rb +0 -72
  126. data/models/ib/future.rb +0 -64
  127. data/models/ib/option.rb +0 -149
  128. data/models/ib/option_detail.rb +0 -84
  129. data/models/ib/portfolio_value.rb +0 -86
  130. data/models/ib/spread.rb +0 -176
  131. data/models/ib/stock.rb +0 -25
  132. data/plugins/ib/advanced-account.rb +0 -442
  133. data/plugins/ib/alerts/base-alert.rb +0 -125
  134. data/plugins/ib/alerts/gateway-alerts.rb +0 -15
  135. data/plugins/ib/alerts/order-alerts.rb +0 -73
  136. data/plugins/ib/auto-adjust.rb +0 -0
  137. data/plugins/ib/connection-tools.rb +0 -122
  138. data/plugins/ib/eod.rb +0 -326
  139. data/plugins/ib/greeks.rb +0 -102
  140. data/plugins/ib/managed-accounts.rb +0 -274
  141. data/plugins/ib/market-price.rb +0 -150
  142. data/plugins/ib/option-chain.rb +0 -167
  143. data/plugins/ib/order-flow.rb +0 -157
  144. data/plugins/ib/order-prototypes/abstract.rb +0 -67
  145. data/plugins/ib/order-prototypes/adaptive.rb +0 -40
  146. data/plugins/ib/order-prototypes/all-in-one.rb +0 -46
  147. data/plugins/ib/order-prototypes/combo.rb +0 -46
  148. data/plugins/ib/order-prototypes/forex.rb +0 -40
  149. data/plugins/ib/order-prototypes/limit.rb +0 -193
  150. data/plugins/ib/order-prototypes/market.rb +0 -116
  151. data/plugins/ib/order-prototypes/pegged.rb +0 -169
  152. data/plugins/ib/order-prototypes/premarket.rb +0 -31
  153. data/plugins/ib/order-prototypes/stop.rb +0 -202
  154. data/plugins/ib/order-prototypes/volatility.rb +0 -39
  155. data/plugins/ib/order-prototypes.rb +0 -118
  156. data/plugins/ib/probability-of-expiring.rb +0 -109
  157. data/plugins/ib/process-orders.rb +0 -155
  158. data/plugins/ib/roll.rb +0 -86
  159. data/plugins/ib/spread-prototypes/butterfly.rb +0 -77
  160. data/plugins/ib/spread-prototypes/calendar.rb +0 -97
  161. data/plugins/ib/spread-prototypes/stock-spread.rb +0 -56
  162. data/plugins/ib/spread-prototypes/straddle.rb +0 -70
  163. data/plugins/ib/spread-prototypes/strangle.rb +0 -93
  164. data/plugins/ib/spread-prototypes/vertical.rb +0 -83
  165. data/plugins/ib/spread-prototypes.rb +0 -70
  166. data/plugins/ib/symbols/abstract.rb +0 -136
  167. data/plugins/ib/symbols/bonds.rb +0 -28
  168. data/plugins/ib/symbols/cfd.rb +0 -19
  169. data/plugins/ib/symbols/combo.rb +0 -46
  170. data/plugins/ib/symbols/commodity.rb +0 -17
  171. data/plugins/ib/symbols/forex.rb +0 -41
  172. data/plugins/ib/symbols/futures.rb +0 -127
  173. data/plugins/ib/symbols/index.rb +0 -43
  174. data/plugins/ib/symbols/options.rb +0 -99
  175. data/plugins/ib/symbols/stocks.rb +0 -44
  176. data/plugins/ib/symbols/version.rb +0 -5
  177. data/plugins/ib/symbols.rb +0 -118
  178. data/plugins/ib/verify.rb +0 -226
  179. data/symbols/w20.yml +0 -210
  180. data/t.txt +0 -20
  181. data/update.md +0 -71
data/symbols/w20.yml DELETED
@@ -1,210 +0,0 @@
1
- ---
2
- 0: !ruby/object:IB::Stock
3
- attributes:
4
- :symbol: ANW
5
- :con_id: 0
6
- :right: ''
7
- :sec_type: STK
8
- :currency: USD
9
- :exchange: SMART
10
- :created_at: 2024-07-11 11:13:47.303012890 +02:00
11
- :include_expired: false
12
- :description: 'Stock: ANW USD'
13
- 1: !ruby/object:IB::Stock
14
- attributes:
15
- :symbol: AEB
16
- :con_id: 0
17
- :right: ''
18
- :sec_type: STK
19
- :currency: USD
20
- :exchange: SMART
21
- :created_at: 2024-07-11 11:13:47.304535419 +02:00
22
- :include_expired: false
23
- :description: 'Stock: AEB USD'
24
- 2: !ruby/object:IB::Stock
25
- attributes:
26
- :symbol: AED
27
- :con_id: 0
28
- :right: ''
29
- :sec_type: STK
30
- :currency: USD
31
- :exchange: SMART
32
- :created_at: 2024-07-11 11:13:47.305076488 +02:00
33
- :include_expired: false
34
- :description: 'Stock: AED USD'
35
- 3: !ruby/object:IB::Stock
36
- attributes:
37
- :symbol: AEG
38
- :con_id: 0
39
- :right: ''
40
- :sec_type: STK
41
- :currency: USD
42
- :exchange: SMART
43
- :created_at: 2024-07-11 11:13:47.305668741 +02:00
44
- :include_expired: false
45
- :description: 'Stock: AEG USD'
46
- 4: !ruby/object:IB::Stock
47
- attributes:
48
- :symbol: AEH
49
- :con_id: 0
50
- :right: ''
51
- :sec_type: STK
52
- :currency: USD
53
- :exchange: SMART
54
- :created_at: 2024-07-11 11:13:47.306387580 +02:00
55
- :include_expired: false
56
- :description: 'Stock: AEH USD'
57
- 5: !ruby/object:IB::Stock
58
- attributes:
59
- :symbol: AER
60
- :con_id: 0
61
- :right: ''
62
- :sec_type: STK
63
- :currency: USD
64
- :exchange: SMART
65
- :created_at: 2024-07-11 11:13:47.307176556 +02:00
66
- :include_expired: false
67
- :description: 'Stock: AER USD'
68
- 6: !ruby/object:IB::Stock
69
- attributes:
70
- :symbol: HIVE
71
- :con_id: 0
72
- :right: ''
73
- :sec_type: STK
74
- :currency: USD
75
- :exchange: SMART
76
- :created_at: 2024-07-11 11:13:47.308077562 +02:00
77
- :include_expired: false
78
- :description: 'Stock: HIVE USD'
79
- 7: !ruby/object:IB::Stock
80
- attributes:
81
- :symbol: AJRD
82
- :con_id: 0
83
- :right: ''
84
- :sec_type: STK
85
- :currency: USD
86
- :exchange: SMART
87
- :created_at: 2024-07-11 11:13:47.309462908 +02:00
88
- :include_expired: false
89
- :description: 'Stock: AJRD USD'
90
- 8: !ruby/object:IB::Stock
91
- attributes:
92
- :symbol: AET
93
- :con_id: 0
94
- :right: ''
95
- :sec_type: STK
96
- :currency: USD
97
- :exchange: SMART
98
- :created_at: 2024-07-11 11:13:47.311778738 +02:00
99
- :include_expired: false
100
- :description: 'Stock: AET USD'
101
- 9: !ruby/object:IB::Stock
102
- attributes:
103
- :symbol: AMG
104
- :con_id: 0
105
- :right: ''
106
- :sec_type: STK
107
- :currency: USD
108
- :exchange: SMART
109
- :created_at: 2024-07-11 11:13:47.313762230 +02:00
110
- :include_expired: false
111
- :description: 'Stock: AMG USD'
112
- 10: !ruby/object:IB::Stock
113
- attributes:
114
- :symbol: AFL
115
- :con_id: 0
116
- :right: ''
117
- :sec_type: STK
118
- :currency: USD
119
- :exchange: SMART
120
- :created_at: 2024-07-11 11:13:47.315120668 +02:00
121
- :include_expired: false
122
- :description: 'Stock: AFL USD'
123
- 11: !ruby/object:IB::Stock
124
- attributes:
125
- :symbol: MITT
126
- :con_id: 0
127
- :right: ''
128
- :sec_type: STK
129
- :currency: USD
130
- :exchange: SMART
131
- :created_at: 2024-07-11 11:13:47.316746279 +02:00
132
- :include_expired: false
133
- :description: 'Stock: MITT USD'
134
- 12: !ruby/object:IB::Stock
135
- attributes:
136
- :symbol: AGCO
137
- :con_id: 0
138
- :right: ''
139
- :sec_type: STK
140
- :currency: USD
141
- :exchange: SMART
142
- :created_at: 2024-07-11 11:13:47.318371506 +02:00
143
- :include_expired: false
144
- :description: 'Stock: AGCO USD'
145
- 13: !ruby/object:IB::Stock
146
- attributes:
147
- :symbol: A
148
- :con_id: 0
149
- :right: ''
150
- :sec_type: STK
151
- :currency: USD
152
- :exchange: SMART
153
- :created_at: 2024-07-11 11:13:47.320149849 +02:00
154
- :include_expired: false
155
- :description: 'Stock: A USD'
156
- 14: !ruby/object:IB::Stock
157
- attributes:
158
- :symbol: AEM
159
- :con_id: 0
160
- :right: ''
161
- :sec_type: STK
162
- :currency: USD
163
- :exchange: SMART
164
- :created_at: 2024-07-11 11:13:47.321989169 +02:00
165
- :include_expired: false
166
- :description: 'Stock: AEM USD'
167
- 15: !ruby/object:IB::Stock
168
- attributes:
169
- :symbol: ADC
170
- :con_id: 0
171
- :right: ''
172
- :sec_type: STK
173
- :currency: USD
174
- :exchange: SMART
175
- :created_at: 2024-07-11 11:13:47.323900346 +02:00
176
- :include_expired: false
177
- :description: 'Stock: ADC USD'
178
- 16: !ruby/object:IB::Stock
179
- attributes:
180
- :symbol: AL
181
- :con_id: 0
182
- :right: ''
183
- :sec_type: STK
184
- :currency: USD
185
- :exchange: SMART
186
- :created_at: 2024-07-11 11:13:47.327106091 +02:00
187
- :include_expired: false
188
- :description: 'Stock: AL USD'
189
- 17: !ruby/object:IB::Stock
190
- attributes:
191
- :symbol: APD
192
- :con_id: 0
193
- :right: ''
194
- :sec_type: STK
195
- :currency: USD
196
- :exchange: SMART
197
- :created_at: 2024-07-11 11:13:47.329187138 +02:00
198
- :include_expired: false
199
- :description: 'Stock: APD USD'
200
- 18: !ruby/object:IB::Stock
201
- attributes:
202
- :symbol: AYR
203
- :con_id: 0
204
- :right: ''
205
- :sec_type: STK
206
- :currency: USD
207
- :exchange: SMART
208
- :created_at: 2024-07-11 11:13:47.332186539 +02:00
209
- :include_expired: false
210
- :description: 'Stock: AYR USD'
data/t.txt DELETED
@@ -1,20 +0,0 @@
1
- # place order
2
-
3
- f = Stock.new symbol: 'F'
4
- o = Limit.order( size: 100, price: 8 , contract: f )
5
- C.place_order order: o, contract: f
6
-
7
- IB::Messages::Outgoing::PlaceOrder.new local_id: 5, order: o, contract: f
8
- 3-5--F-STK-----SMART--USD-----BUY-100.0-LMT-8--GTC--DU4035277-O-0--1-0-0-0--0-0-0--0--------0---1-0---0---0-0--0------0-----0-----------0---0-0---0--0-0-0-0---------------------- # new
9
- 3-5--F-STK-----SMART--USD-----BUY-100.0-LMT-8--GTC--DU4035277-O-0--1-0-0-0--0-0-0--0--------0---1-0---0---0-0-0-0------0-----0-----------0---0-0--0--0-0-0-0-----------------------# old
10
-
11
-
12
- 3-5--F-STK-----SMART--USD-----BUY-100.0-LMT-8--GTC--DU4035279-O-0--1-0-0-0--0-0---0--------0---1-0---0---0-0-0-0------0-----0-----------0---0-0--0--0-0-0-0-----------------------"
13
- origin=customer
14
- 0=hidden
15
-
16
-
17
- "3-45-5--F-STK-----SMART--USD-----BUY-100 -LMT-8--GTC---O-0--1-0-0-0-0-0-0-0--0--------0---1-0---0---0-0--0------0-----0-----------0---0-0---0--0-0-0-0-------------------"
18
-
19
- "3-5--F-STK-----SMART--USD-----BUY-100.0-LMT-8--GTC---O-0--1-0-0-0--0-0-0--0--------0---1-0---0---0-0--0------0-----0-----------0---0-0---0--0-0-0-0-------------------"
20
-
data/update.md DELETED
@@ -1,71 +0,0 @@
1
- # Update from 9.72 to 10.12 # Aug 2022
2
-
3
- Protocol of api-changes: https://www.interactivebrokers.com/en/index.php?f=24356
4
-
5
- 1. Update Incoming and outgoing Messages constants
6
- lib/ib/messages/incoming.rb
7
- lib/ib/massages/outgoing.rb
8
-
9
- note: Field types : int = 1
10
- string = 2
11
- float = 2
12
- python/message.py
13
-
14
- 2. Update ServerVersion
15
- lib/ib/server_versions.rb
16
- New supported server Version: 165 /:min_server_er_historical_schedule/
17
-
18
- python/server_versions.py
19
-
20
-
21
- 3. Update ClientVersion
22
- is NOT necessary. According to EClient.java, ClientVersion 66 is the most recent one
23
-
24
- ToDo: Can we omit the constant at all?
25
-
26
- 4. Update Max_Version --: 165
27
- in lib/ib/server_versions.rb
28
-
29
- 5. Start of a console with a running papertrading account
30
-
31
- > BUFFER:: "\x00\x00\x00\x1A165\x0020220812 06:42:26 GMT\x00"
32
- > F: Connected to server, version: 165, using client-id: 2000,
33
- > connection time: 2022-08-12 06:42:27 +0000 local, 2022-08-12T06:42:26+00:00 remote.
34
- > BUFFER:: "\x00\x00\x00B15\x001\x00DF4035274,DU4035275,DU4035276,DU4035277,DU4035278,DU4035279,\x00"
35
- > F: Connected to server, version: 165, using client-id: 2000,
36
- > connection time: 2022-08-12 06:42:27 +0000 local, 2022-08-12T06:42:26+00:00 remote.
37
- > BUFFER:: "\x00\x00\x00B15\x001\x00DF4035274,DU4035275,DU4035276,DU4035277,DU4035278,DU4035279,\x00"
38
- > I: < ManagedAccounts: DF4035274 - DU4035275 - DU4035276 - DU4035277 - DU4035278 - DU4035279>
39
- > BUFFER:: "\x00\x00\x00\x069\x001\x001\x00"
40
- > I: Got next valid order id: 1.
41
- > Connection established on Port 4002, client_id 2000 used
42
-
43
- **The login-procedure is unchanged!**
44
-
45
- 6. Starting with tests
46
-
47
- 6.1 connect_spec.rb
48
- After editing connect.yml the test passes
49
-
50
- 6.2 ContractDetails
51
- Changes: a) Version is not transmitted anymore
52
- b) contract_detail.md_size_multiplier is not used anymore
53
- c) remaining buffer: (stock) => ["COMMON", "1", "1", "100"],
54
- --:: added stock_type, min_size, size_increment, suggested_size_increment
55
- to lib/ib/model/ContractDetail.rb and /lib/ib/messages/incoming/contract_data.rb
56
-
57
- Ensure that the buffer is read completely!
58
-
59
- 6.3 HeadTimeStamp --:: OK
60
- 6.4 HistogramData --:: OK
61
- 6.4 HistoricalData --:: OK
62
- 6.5 ManagedAccounts--:: OK
63
- 6.6 OptionChian --:: OK
64
- 6.7 PositionData --:: OK
65
- 6.8 PositionsMulti --:: OK
66
- 6.9 ReceiveFA --:: OK
67
- 6.10 MultiAccountUpdate --:: OK
68
-
69
-
70
-
71
-