ib-ruby 0.7.4 → 0.7.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/.gitignore +3 -0
  2. data/HISTORY +8 -0
  3. data/README.md +2 -2
  4. data/Rakefile +15 -0
  5. data/TODO +7 -2
  6. data/VERSION +1 -1
  7. data/bin/account_info +1 -1
  8. data/bin/cancel_orders +1 -1
  9. data/bin/contract_details +1 -1
  10. data/bin/depth_of_market +1 -1
  11. data/bin/fa_accounts +1 -1
  12. data/bin/fundamental_data +42 -0
  13. data/bin/historic_data +1 -1
  14. data/bin/historic_data_cli +1 -1
  15. data/bin/list_orders +1 -2
  16. data/bin/market_data +1 -1
  17. data/bin/option_data +1 -1
  18. data/bin/place_combo_order +1 -1
  19. data/bin/place_order +1 -1
  20. data/bin/template +1 -4
  21. data/bin/tick_data +2 -2
  22. data/bin/time_and_sales +1 -1
  23. data/lib/ib-ruby.rb +4 -0
  24. data/lib/ib-ruby/connection.rb +50 -34
  25. data/lib/ib-ruby/constants.rb +232 -37
  26. data/lib/ib-ruby/db.rb +25 -0
  27. data/lib/ib-ruby/extensions.rb +51 -1
  28. data/lib/ib-ruby/messages/abstract_message.rb +0 -8
  29. data/lib/ib-ruby/messages/incoming.rb +18 -493
  30. data/lib/ib-ruby/messages/incoming/abstract_message.rb +100 -0
  31. data/lib/ib-ruby/messages/incoming/alert.rb +34 -0
  32. data/lib/ib-ruby/messages/incoming/contract_data.rb +82 -0
  33. data/lib/ib-ruby/messages/incoming/delta_neutral_validation.rb +20 -0
  34. data/lib/ib-ruby/messages/incoming/execution_data.rb +59 -0
  35. data/lib/ib-ruby/messages/incoming/historical_data.rb +55 -0
  36. data/lib/ib-ruby/messages/incoming/market_depths.rb +44 -0
  37. data/lib/ib-ruby/messages/incoming/open_order.rb +32 -16
  38. data/lib/ib-ruby/messages/incoming/order_status.rb +67 -0
  39. data/lib/ib-ruby/messages/incoming/portfolio_value.rb +39 -0
  40. data/lib/ib-ruby/messages/incoming/real_time_bar.rb +32 -0
  41. data/lib/ib-ruby/messages/incoming/scanner_data.rb +49 -0
  42. data/lib/ib-ruby/messages/outgoing.rb +25 -223
  43. data/lib/ib-ruby/messages/outgoing/abstract_message.rb +61 -0
  44. data/lib/ib-ruby/messages/outgoing/bar_requests.rb +149 -0
  45. data/lib/ib-ruby/messages/outgoing/place_order.rb +24 -0
  46. data/lib/ib-ruby/models.rb +4 -0
  47. data/lib/ib-ruby/models/bar.rb +31 -14
  48. data/lib/ib-ruby/models/combo_leg.rb +48 -23
  49. data/lib/ib-ruby/models/contracts.rb +2 -2
  50. data/lib/ib-ruby/models/contracts/bag.rb +11 -7
  51. data/lib/ib-ruby/models/contracts/contract.rb +90 -66
  52. data/lib/ib-ruby/models/contracts/option.rb +16 -7
  53. data/lib/ib-ruby/models/execution.rb +34 -18
  54. data/lib/ib-ruby/models/model.rb +15 -7
  55. data/lib/ib-ruby/models/model_properties.rb +101 -44
  56. data/lib/ib-ruby/models/order.rb +176 -187
  57. data/lib/ib-ruby/models/order_state.rb +99 -0
  58. data/lib/ib-ruby/symbols/forex.rb +10 -10
  59. data/lib/ib-ruby/symbols/futures.rb +6 -6
  60. data/lib/ib-ruby/symbols/stocks.rb +3 -3
  61. data/spec/account_helper.rb +4 -5
  62. data/spec/combo_helper.rb +4 -4
  63. data/spec/db.rb +18 -0
  64. data/spec/ib-ruby/messages/{incoming_spec.rb → incoming/alert_spec.rb} +1 -0
  65. data/spec/ib-ruby/messages/incoming/open_order_spec.rb +100 -0
  66. data/spec/ib-ruby/messages/incoming/order_status_spec.rb +74 -0
  67. data/spec/ib-ruby/messages/{outgoing_spec.rb → outgoing/account_data_spec.rb} +0 -0
  68. data/spec/ib-ruby/messages/outgoing/market_data_type_spec.rb +44 -0
  69. data/spec/ib-ruby/models/bag_spec.rb +97 -0
  70. data/spec/ib-ruby/models/bar_spec.rb +45 -0
  71. data/spec/ib-ruby/models/combo_leg_spec.rb +56 -40
  72. data/spec/ib-ruby/models/contract_spec.rb +134 -170
  73. data/spec/ib-ruby/models/execution_spec.rb +35 -50
  74. data/spec/ib-ruby/models/option_spec.rb +127 -0
  75. data/spec/ib-ruby/models/order_spec.rb +89 -68
  76. data/spec/ib-ruby/models/order_state_spec.rb +55 -0
  77. data/spec/integration/contract_info_spec.rb +4 -6
  78. data/spec/integration/fundamental_data_spec.rb +41 -0
  79. data/spec/integration/historic_data_spec.rb +4 -4
  80. data/spec/integration/market_data_spec.rb +1 -3
  81. data/spec/integration/orders/attached_spec.rb +8 -10
  82. data/spec/integration/orders/combo_spec.rb +2 -2
  83. data/spec/integration/orders/execution_spec.rb +0 -1
  84. data/spec/integration/orders/placement_spec.rb +1 -3
  85. data/spec/integration/orders/valid_ids_spec.rb +1 -2
  86. data/spec/message_helper.rb +1 -1
  87. data/spec/model_helper.rb +211 -0
  88. data/spec/order_helper.rb +44 -37
  89. data/spec/spec_helper.rb +36 -23
  90. data/spec/v.rb +7 -0
  91. data/tasks/doc.rake +1 -1
  92. metadata +116 -12
  93. data/spec/integration/orders/open_order +0 -98
@@ -1,98 +0,0 @@
1
- This is just a dump file to compare received order messages:
2
-
3
- [#<IB::Messages::Incoming::OpenOrder:0xfdc #<IB::Messages::Incoming::OpenOrder:0x10b8 #<IB::Messages::Incoming::OpenOrder:0x1198
4
- @contract= @contract= @contract=
5
- #<IB::Models::Contract:0xfe0 #<IB::Models::Contract:0x10bc #<IB::Models::Contract:0x119c
6
- @con_id="12087792", @con_id="12087792", @con_id="12087792",
7
- @exchange="IDEALPRO", @exchange="IDEALPRO", @exchange="IDEALPRO",
8
- @local_symbol="EUR.USD", @local_symbol="EUR.USD", @local_symbol="EUR.USD",
9
- @sec_type="CASH", @sec_type="CASH", @sec_type="CASH",
10
- @created_at=Thu Feb 23 12:17:48 +0400 2012, @created_at=Thu Feb 23 12:17:48 +0400 2012, @created_at=Thu Feb 23 12:17:48 +0400 2012,
11
- @order= @order= @order=
12
- #<IB::Models::Order:0x1018 #<IB::Models::Order:0x10f4 #<IB::Models::Order:0x11d4
13
- @client_id=1111, @client_id=1111, @client_id=1111,
14
- @commission=nil, @commission=2.5, @commission=2.5,
15
- @commission_currency="USD", @commission_currency="USD", @commission_currency="USD",
16
- @id=38, @id=38, @id=38,
17
- @limit_price=1.4, @limit_price=1.4, @limit_price=1.4,
18
- @perm_id=300145671, @perm_id=300145671, @perm_id=300145671,
19
- @status="Filled", @status="Filled", @status="Filled",
20
- @total_quantity=20000, @total_quantity=20000, @total_quantity=20000,
21
- @socket=nil>, @socket=nil>, @socket=nil>]
22
-
23
-
24
- #<IB::Models::Order:0xfa0 #<IB::Models::Order:0x1040 #<IB::Models::Order:0x10e0
25
- @commission=nil, @commission=nil, @commission=2.5,
26
- @commission_currency="USD", @commission_currency="USD", @commission_currency="USD",
27
- @limit_price=1.0, @limit_price=1.0, @limit_price=1.0,
28
- @status="Filled", @status="Filled", @status="Filled",
29
- @tif="DAY", @tif="DAY", @tif="DAY",
30
- @total_quantity=20000, @total_quantity=20000, @total_quantity=20000,
31
- @transmit=true, @transmit=true, @transmit=true,
32
- @what_if=false> @what_if=false> @what_if=false>
33
-
34
- [#<IB::Messages::Incoming::OrderStatus:0x127c
35
- @created_at=Thu Feb 23 12:17:48 +0400 2012,
36
- @data=
37
- {:version=>6,
38
- :id=>38,
39
- :status=>"Filled",
40
- :filled=>20000,
41
- :remaining=>0,
42
- :average_fill_price=>1.3292,
43
- :perm_id=>300145671,
44
- :parent_id=>0,
45
- :last_fill_price=>1.3292,
46
- :client_id=>1111,
47
- :why_held=>""},
48
- @socket=nil>,
49
- #<IB::Messages::Incoming::OrderStatus:0x12bc
50
- @created_at=Thu Feb 23 12:17:48 +0400 2012,
51
- @data=
52
- {:version=>6,
53
- :id=>38,
54
- :status=>"Filled",
55
- :filled=>20000,
56
- :remaining=>0,
57
- :average_fill_price=>1.3292,
58
- :perm_id=>300145671,
59
- :parent_id=>0,
60
- :last_fill_price=>1.3292,
61
- :client_id=>1111,
62
- :why_held=>""},
63
- @socket=nil>,
64
- #<IB::Messages::Incoming::OrderStatus:0x12d8
65
- @created_at=Thu Feb 23 12:17:48 +0400 2012,
66
- @data=
67
- {:version=>6,
68
- :id=>38,
69
- :status=>"Filled",
70
- :filled=>20000,
71
- :remaining=>0,
72
- :average_fill_price=>1.3292,
73
- :perm_id=>300145671,
74
- :parent_id=>0,
75
- :last_fill_price=>1.3292,
76
- :client_id=>1111,
77
- :why_held=>""},
78
- @socket=nil>]
79
-
80
- Original Combo: Attached Auto Combo Limit:
81
-
82
- <Order: LMT DAY BUY 100 PreSubmitted 0.01 2: <Order: LMT DAY SELL 100 PreSubmitted 1.01
83
- id: 3/173276893 from: 1111/DU118180>> id: 0/173276895 from: 0/DU118180>>
84
- #<IB::Models::Order:0xfa0 #<IB::Models::Order:0x102c
85
- @action="BUY", @action="SELL",
86
- @client_id=1111, @client_id=0, # Attached via TWS
87
- @created_at=Fri Mar 23 09:09:16 +0400 2012, @created_at=Fri Mar 23 09:09:16 +0400 2012,
88
- @limit_price=0.01, @limit_price=1.01,
89
- @oca_group="", @oca_group="173276893",
90
- @oca_type=3, @oca_type=3,
91
- @order_id=3, @order_id=0,
92
- @order_type="LMT", @order_type="LMT",
93
- @parent_id=0, @parent_id=3,
94
- @perm_id=173276893, @perm_id=173276895,
95
- @status="PreSubmitted", @status="PreSubmitted",
96
- @tif="DAY", @tif="DAY",
97
- @total_quantity=100, @total_quantity=100,
98
- @what_if=false> @what_if=false>