ib-api 972.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +50 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +7 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +16 -0
  7. data/Gemfile.lock +105 -0
  8. data/Guardfile +24 -0
  9. data/LICENSE +674 -0
  10. data/README.md +65 -0
  11. data/Rakefile +11 -0
  12. data/VERSION +1 -0
  13. data/api.gemspec +43 -0
  14. data/bin/console +95 -0
  15. data/bin/console.yml +3 -0
  16. data/bin/setup +8 -0
  17. data/changelog.md +7 -0
  18. data/example/README.md +76 -0
  19. data/example/account_info +54 -0
  20. data/example/account_positions +30 -0
  21. data/example/account_summary +88 -0
  22. data/example/cancel_orders +74 -0
  23. data/example/fa_accounts +25 -0
  24. data/example/fundamental_data +40 -0
  25. data/example/historic_data_cli +186 -0
  26. data/example/list_orders +45 -0
  27. data/example/portfolio_csv +81 -0
  28. data/example/scanner_data +62 -0
  29. data/example/template +19 -0
  30. data/example/tick_data +28 -0
  31. data/lib/extensions/class-extensions.rb +87 -0
  32. data/lib/ib-api.rb +7 -0
  33. data/lib/ib/base.rb +103 -0
  34. data/lib/ib/base_properties.rb +160 -0
  35. data/lib/ib/connection.rb +450 -0
  36. data/lib/ib/constants.rb +393 -0
  37. data/lib/ib/errors.rb +44 -0
  38. data/lib/ib/logger.rb +26 -0
  39. data/lib/ib/messages.rb +99 -0
  40. data/lib/ib/messages/abstract_message.rb +101 -0
  41. data/lib/ib/messages/incoming.rb +251 -0
  42. data/lib/ib/messages/incoming/abstract_message.rb +116 -0
  43. data/lib/ib/messages/incoming/account_value.rb +78 -0
  44. data/lib/ib/messages/incoming/alert.rb +34 -0
  45. data/lib/ib/messages/incoming/contract_data.rb +102 -0
  46. data/lib/ib/messages/incoming/delta_neutral_validation.rb +23 -0
  47. data/lib/ib/messages/incoming/execution_data.rb +50 -0
  48. data/lib/ib/messages/incoming/historical_data.rb +84 -0
  49. data/lib/ib/messages/incoming/market_depths.rb +44 -0
  50. data/lib/ib/messages/incoming/next_valid_id.rb +18 -0
  51. data/lib/ib/messages/incoming/open_order.rb +277 -0
  52. data/lib/ib/messages/incoming/order_status.rb +85 -0
  53. data/lib/ib/messages/incoming/portfolio_value.rb +78 -0
  54. data/lib/ib/messages/incoming/real_time_bar.rb +32 -0
  55. data/lib/ib/messages/incoming/scanner_data.rb +54 -0
  56. data/lib/ib/messages/incoming/ticks.rb +268 -0
  57. data/lib/ib/messages/outgoing.rb +437 -0
  58. data/lib/ib/messages/outgoing/abstract_message.rb +88 -0
  59. data/lib/ib/messages/outgoing/account_requests.rb +112 -0
  60. data/lib/ib/messages/outgoing/bar_requests.rb +250 -0
  61. data/lib/ib/messages/outgoing/place_order.rb +209 -0
  62. data/lib/ib/messages/outgoing/request_marketdata.rb +99 -0
  63. data/lib/ib/messages/outgoing/request_tick_data.rb +21 -0
  64. data/lib/ib/model.rb +4 -0
  65. data/lib/ib/models.rb +14 -0
  66. data/lib/ib/server_versions.rb +114 -0
  67. data/lib/ib/socket.rb +185 -0
  68. data/lib/ib/support.rb +160 -0
  69. data/lib/ib/version.rb +6 -0
  70. data/lib/models/ib/account.rb +85 -0
  71. data/lib/models/ib/account_value.rb +33 -0
  72. data/lib/models/ib/bag.rb +55 -0
  73. data/lib/models/ib/bar.rb +31 -0
  74. data/lib/models/ib/combo_leg.rb +105 -0
  75. data/lib/models/ib/condition.rb +245 -0
  76. data/lib/models/ib/contract.rb +415 -0
  77. data/lib/models/ib/contract_detail.rb +108 -0
  78. data/lib/models/ib/execution.rb +67 -0
  79. data/lib/models/ib/forex.rb +13 -0
  80. data/lib/models/ib/future.rb +15 -0
  81. data/lib/models/ib/index.rb +15 -0
  82. data/lib/models/ib/option.rb +78 -0
  83. data/lib/models/ib/option_detail.rb +55 -0
  84. data/lib/models/ib/order.rb +519 -0
  85. data/lib/models/ib/order_state.rb +152 -0
  86. data/lib/models/ib/portfolio_value.rb +64 -0
  87. data/lib/models/ib/stock.rb +16 -0
  88. data/lib/models/ib/underlying.rb +34 -0
  89. data/lib/models/ib/vertical.rb +96 -0
  90. data/lib/requires.rb +12 -0
  91. metadata +203 -0
@@ -0,0 +1,88 @@
1
+ require 'ib/messages/abstract_message'
2
+
3
+ module IB
4
+ module Messages
5
+ module Outgoing
6
+
7
+ # Container for specific message classes, keyed by their message_ids
8
+ Classes = {}
9
+
10
+ class AbstractMessage < IB::Messages::AbstractMessage
11
+
12
+ def initialize data={}
13
+ @data = data
14
+ @created_at = Time.now
15
+ end
16
+
17
+ # This causes the message to send itself over the server socket in server[:socket].
18
+ # "server" is the @server instance variable from the IB object.
19
+ # You can also use this to e.g. get the server version number.
20
+ #
21
+ # Subclasses can either override this method for precise control over how
22
+ # stuff gets sent to the server, or else define a method encode() that returns
23
+ # an Array of elements that ought to be sent to the server by calling to_s on
24
+ # each one and postpending a '\0'.
25
+ #
26
+ def send_to socket
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 ---------"
31
+ socket.send_messages self.preprocess #.each {|data| socket.write_data data}
32
+ end
33
+
34
+ # Same message representation as logged by TWS into API messages log file
35
+ def to_s
36
+ self.preprocess.join('-')
37
+ end
38
+
39
+ # Pre-process encoded message Array before sending into socket, such as
40
+ # changing booleans into 0/1 and stuff
41
+ def preprocess
42
+ self.encode.flatten.map {|data| data == true ? 1 : data == false ? 0 : data }
43
+ end
44
+
45
+ # Encode message content into (possibly, nested) Array of values.
46
+ # At minimum, encoded Outgoing message contains message_id and version.
47
+ # Most messages also contain (ticker, request or order) :id.
48
+ # Then, content of @data Hash is encoded per instructions in data_map.
49
+ # This method may be modified by message subclasses!
50
+ #
51
+ # If the version is zero, omit its apperance (for historical data)
52
+ def encode
53
+ ## create a proper request_id and erase :id and :ticker_id if nessesary
54
+ if self.class.properties?.include?(:request_id)
55
+ @data[:request_id] = if @data[:request_id].blank? && @data[:ticker_id].blank? && @data[:id].blank?
56
+ rand(9999)
57
+ else
58
+ @data[:id] || @data[:ticker_id] || @data[:request_id]
59
+ end
60
+ @data[:id] = @data[:ticker_id] = nil
61
+ end
62
+ [
63
+ self.class.version.zero? ? self.class.message_id : [ self.class.message_id, self.class.version ],
64
+ @data[:id] || @data[:ticker_id] ||# @data[:request_id] || # id, ticker_id, local_id, order_id
65
+ @data[:local_id] || @data[:order_id] || [], # do not appear in data_map
66
+ self.class.data_map.map do |(field, default_method, args)| # but request_id does
67
+ case
68
+ when default_method.nil?
69
+ @data[field]
70
+
71
+ when default_method.is_a?(Symbol) # method name with args
72
+ @data[field].send default_method, *args
73
+
74
+ when default_method.respond_to?(:call) # callable with args
75
+ default_method.call @data[field], *args
76
+
77
+ else # default
78
+ @data[field].nil? ? default_method : @data[field] # may be false still
79
+ end
80
+ end
81
+ ]
82
+ # TWS wants to receive booleans as 1 or 0
83
+ end
84
+
85
+ end # AbstractMessage
86
+ end # module Outgoing
87
+ end # module Messages
88
+ end # module IB
@@ -0,0 +1,112 @@
1
+
2
+ module IB
3
+ module Messages
4
+ module Outgoing
5
+
6
+ RequestManagedAccounts = def_message 17
7
+
8
+ # @data = { :subscribe => boolean,
9
+ # :account_code => Advisor accounts only. Empty ('') for a standard account. }
10
+ RequestAccountUpdates = RequestAccountData = def_message([6, 2],
11
+ [:subscribe, true],
12
+ :account_code)
13
+ =begin
14
+ Call this method to request and keep up to date the data that appears
15
+ on the TWS Account Window Summary tab. The data is returned by
16
+ accountSummary().
17
+
18
+ Note: This request is designed for an FA managed account but can be
19
+ used for any multi-account structure.
20
+
21
+ reqId:int - The ID of the data request. Ensures that responses are matched
22
+ to requests If several requests are in process.
23
+ groupName:str - Set to All to returnrn account summary data for all
24
+ accounts, or set to a specific Advisor Account Group name that has
25
+ already been created in TWS Global Configuration.
26
+ tags:str - A comma-separated list of account tags. Available tags are:
27
+ accountountType
28
+ NetLiquidation,
29
+ TotalCashValue - Total cash including futures pnl
30
+ SettledCash - For cash accounts, this is the same as
31
+ TotalCashValue
32
+ AccruedCash - Net accrued interest
33
+ BuyingPower - The maximum amount of marginable US stocks the
34
+ account can buy
35
+ EquityWithLoanValue - Cash + stocks + bonds + mutual funds
36
+ PreviousDayEquityWithLoanValue,
37
+ GrossPositionValue - The sum of the absolute value of all stock
38
+ and equity option positions
39
+ RegTEquity,
40
+ RegTMargin,
41
+ SMA - Special Memorandum Account
42
+ InitMarginReq,
43
+ MaintMarginReq,
44
+ AvailableFunds,
45
+ ExcessLiquidity,
46
+ Cushion - Excess liquidity as a percentage of net liquidation value
47
+ FullInitMarginReq,
48
+ FullMaintMarginReq,
49
+ FullAvailableFunds,
50
+ FullExcessLiquidity,
51
+ LookAheadNextChange - Time when look-ahead values take effect
52
+ LookAheadInitMarginReq,
53
+ LookAheadMaintMarginReq,
54
+ LookAheadAvailableFunds,
55
+ LookAheadExcessLiquidity,
56
+ HighestSeverity - A measure of how close the account is to liquidation
57
+ DayTradesRemaining - The Number of Open/Close trades a user
58
+ could put on before Pattern Day Trading is detected. A value of "-1"
59
+ means that the user can put on unlimited day trades.
60
+ Leverage - GrossPositionValue / NetLiquidation
61
+ $LEDGER - Single flag to relay all cash balance tags*, only in base
62
+ currency.
63
+ $LEDGER:CURRENCY - Single flag to relay all cash balance tags*, only in
64
+ the specified currency.
65
+ $LEDGER:ALL - Single flag to relay all cash balance tags* in all
66
+ currencies.
67
+
68
+ =end
69
+ RequestAccountSummary = def_message( 62,
70
+ :request_id, # autogenerated if not specified
71
+ [:group, 'All'],
72
+ :tags )
73
+
74
+ CancelAccountSummary = def_message 63 # :request_id required
75
+
76
+ # Note: The reqPositions function is not available in Introducing
77
+ # Broker or Financial Advisor master accounts that have very large
78
+ # numbers of subaccounts (> 50) to optimize the performance of TWS/IB
79
+ # Gateway v973+. Instead the function reqPositionsMulti can be used
80
+ # to subscribe to updates from individual subaccounts. Also not
81
+ # available with IBroker accounts configured for on-demand account
82
+ # lookup.
83
+ RequestPositions = def_message 61
84
+ CancelPositions = def_message 64
85
+
86
+
87
+ # The function reqPositionsMulti can be used with any
88
+ # account structure to subscribe to positions updates for multiple
89
+ # accounts and/or models. The account and model parameters are
90
+ # optional if there are not multiple accounts or models available.
91
+ RequestPositionsMulti = def_message( 74, :request_id, # autogenerated
92
+ [ :account, 'ALL' ],
93
+ [:model_code, nil ] )
94
+
95
+ CancelPositionsMulti = def_message( 75, :request_id ) # required
96
+
97
+ RequestAccountUpdatesMulti = def_message( 76, :request_id, # autogenerated
98
+ [ :account, 'ALL'], # account or account-group
99
+ [:model_code, nil],
100
+ [:leger_and_nlv, nil ])
101
+ CancelAccountUpdatesMulti = def_message 77, :request_id # required
102
+ end # module outgoing
103
+ end # module messages
104
+ end # module ib
105
+
106
+ # REQ_POSITIONS = 61
107
+ # REQ_ACCOUNT_SUMMARY = 62
108
+ # CANCEL_ACCOUNT_SUMMARY = 63
109
+ # CANCEL_POSITIONS = 64
110
+
111
+ # REQ_ACCOUNT_UPDATES_MULTI = 76
112
+ # CANCEL_ACCOUNT_UPDATES_MULTI = 77
@@ -0,0 +1,250 @@
1
+ module IB
2
+ module Messages
3
+ module Outgoing
4
+
5
+ # Messages that request bar data have special processing of @data
6
+
7
+ class BarRequestMessage < AbstractMessage
8
+ # Preprocessor for some data fields
9
+ def parse data
10
+ type = data[:data_type] || data[:what_to_show]
11
+ data_type = DATA_TYPES.invert[type] || type
12
+ unless DATA_TYPES.keys.include?(data_type)
13
+ error ":data_type must be one of #{DATA_TYPES.inspect}", :args
14
+ end
15
+
16
+ #size = data[:bar_size] || data[:size]
17
+ #bar_size = BAR_SIZES.invert[size] || size
18
+ # unless BAR_SIZES.keys.include?(bar_size)
19
+ # error ":bar_size must be one of #{BAR_SIZES.inspect}", :args
20
+ # 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]
26
+ end
27
+ end
28
+
29
+ # data = { :id => ticker_id (int),
30
+ # :contract => Contract ,
31
+ # :bar_size => int/Symbol? Currently only 5 second bars are supported,
32
+ # if any other value is used, an exception will be thrown.,
33
+ # :data_type => Symbol: Determines the nature of data being extracted.
34
+ # :trades, :midpoint, :bid, :ask, :bid_ask,
35
+ # :historical_volatility, :option_implied_volatility,
36
+ # :option_volume, :option_open_interest
37
+ # - converts to "TRADES," "MIDPOINT," "BID," etc...
38
+ # :use_rth => int: 0 - all data available during the time span requested
39
+ # is returned, even data bars covering time intervals where the
40
+ # market in question was illiquid. 1 - only data within the
41
+ # "Regular Trading Hours" of the product in question is returned,
42
+ # even if the time span requested falls partially or completely
43
+ # outside of them.
44
+ #
45
+ # Version 3
46
+ RequestRealTimeBars = def_message [ 50, 3 ], BarRequestMessage,
47
+ :request_id # autogenerated if not specified
48
+
49
+ class RequestRealTimeBars
50
+ def parse data
51
+ data_type, bar_size, contract = super data
52
+
53
+ size = data[:bar_size] || data[:size]
54
+ bar_size = 5 # only 5 sec bars are supported --> for future use ::> size.to_i
55
+ [data_type, bar_size, contract]
56
+ end
57
+
58
+ def encode
59
+ data_type, bar_size, contract = parse @data
60
+
61
+ [super,
62
+ contract.serialize_short(:primary_exchange), # include primary exchange in request
63
+ bar_size,
64
+ data_type.to_s.upcase,
65
+ @data[:use_rth] ,
66
+ "XYZ" # not suported realtimebars option string
67
+ ]
68
+ end
69
+ end # RequestRealTimeBars
70
+
71
+ ## python reference (9.74)
72
+ # def reqHistoricalData(self, reqId:TickerId , contract:Contract, endDateTime:str,
73
+ # durationStr:str, barSizeSetting:str, whatToShow:str,
74
+ # useRTH:int, formatDate:int, keepUpToDate:bool, chartOptions:TagValueList)
75
+ RequestHistoricalData = def_message [20, 0], BarRequestMessage,
76
+ :request_id # autogenerated if not specified
77
+
78
+ # - data = {
79
+ # :contract => Contract: requested ticker description
80
+ # :end_date_time => String: "yyyymmdd HH:mm:ss", with optional time zone
81
+ # allowed after a space: "20050701 18:26:44 GMT"
82
+ # :duration => String, time span the request will cover, and is specified
83
+ # using the format: <integer> <unit>, eg: '1 D', valid units are:
84
+ # '1 S' (seconds, default if no unit is specified)
85
+ # '1 D' (days)
86
+ # '1 W' (weeks)
87
+ # '1 M' (months)
88
+ # '1 Y' (years, currently limited to one)
89
+ # :bar_size => String: Specifies the size of the bars that will be returned
90
+ # (within IB/TWS limits). Valid values include:
91
+ # '1 sec'
92
+ # '5 secs'
93
+ # '15 secs'
94
+ # '30 secs'
95
+ # '1 min'
96
+ # '2 mins'
97
+ # '3 mins'
98
+ # '5 mins'
99
+ # '15 mins'
100
+ # '30 min'
101
+ # '1 hour'
102
+ # '1 day'
103
+ # :what_to_show => Symbol: Determines the nature of data being extracted.
104
+ # Valid values:
105
+ # :trades, :midpoint, :bid, :ask, :bid_ask,
106
+ # :historical_volatility, :option_implied_volatility,
107
+ # :option_volume, :option_open_interest
108
+ # - converts to "TRADES," "MIDPOINT," "BID," etc...
109
+ # :use_rth => int: 0 - all data available during the time span requested
110
+ # is returned, even data bars covering time intervals where the
111
+ # market in question was illiquid. 1 - only data within the
112
+ # "Regular Trading Hours" of the product in question is returned,
113
+ # even if the time span requested falls partially or completely
114
+ # outside of them.
115
+ # :format_date => int: 1 - text format, like "20050307 11:32:16".
116
+ # 2 - offset from 1970-01-01 in sec (UNIX epoch)
117
+ # }
118
+ #
119
+ # - NB: using the D :duration only returns bars in whole days, so requesting "1 D"
120
+ # for contract ending at 08:05 will only return 1 bar, for 08:00 on that day.
121
+ # But requesting "86400 S" gives 86400/barlengthsecs bars before the end Time.
122
+ #
123
+ # - Note also that the :duration for any request must be such that the start Time is not
124
+ # more than one year before the CURRENT-Time-less-one-day (not 1 year before the end
125
+ # Time in the Request)
126
+ #
127
+ # Bar Size Max Duration
128
+ # -------- ------------
129
+ # 1 sec 2000 S
130
+ # 5 sec 10000 S
131
+ # 15 sec 30000 S
132
+ # 30 sec 86400 S
133
+ # 1 minute 86400 S, 6 D
134
+ # 2 minutes 86400 S, 6 D
135
+ # 5 minutes 86400 S, 6 D
136
+ # 15 minutes 86400 S, 6 D, 20 D, 2 W
137
+ # 30 minutes 86400 S, 34 D, 4 W, 1 M
138
+ # 1 hour 86400 S, 34 D, 4 w, 1 M
139
+ # 1 day 60 D, 12 M, 52 W, 1 Y
140
+ #
141
+ # - NB: as of 4/07 there is no historical data available for forex spot.
142
+ #
143
+ # - data[:contract] may either be a Contract object or a String. A String should be
144
+ # in serialize_ib_ruby format; that is, it should be a colon-delimited string in
145
+ # the format (e.g. for Globex British pound futures contract expiring in Sep-2008):
146
+ #
147
+ #
148
+ # - Fields not needed for a particular security should be left blank (e.g. strike
149
+ # and right are only relevant for options.)
150
+ #
151
+ # - A Contract object will be automatically serialized into the required format.
152
+ #
153
+ # - See also http://chuckcaplan.com/twsapi/index.php/void%20reqIntradayData%28%29
154
+ # for general information about how TWS handles historic data requests, whence
155
+ # the following has been adapted:
156
+ #
157
+ # - The server providing historical prices appears to not always be
158
+ # available outside of market hours. If you call it outside of its
159
+ # supported time period, or if there is otherwise a problem with
160
+ # it, you will receive error #162 "Historical Market Data Service
161
+ # query failed.:HMDS query returned no data."
162
+ #
163
+ # - For backfill on futures data, you may need to leave the Primary
164
+ # Exchange field of the Contract structure blank; see
165
+ # http://www.interactivebrokers.com/discus/messages/2/28477.html?1114646754
166
+ #
167
+ # - Version 6 implemented --> the version is not transmitted anymore
168
+ class RequestHistoricalData
169
+ def parse data
170
+ data_type, bar_size, contract = super data
171
+
172
+ size = data[:bar_size] || data[:size]
173
+ bar_size = BAR_SIZES.invert[size] || size
174
+ unless BAR_SIZES.keys.include?(bar_size)
175
+ error ":bar_size must be one of #{BAR_SIZES.inspect}", :args
176
+ end
177
+ [data_type, bar_size, contract]
178
+ end
179
+
180
+ def encode
181
+ data_type, bar_size, contract = parse @data
182
+
183
+ [super.flatten,
184
+ contract.serialize_long[0..-1], # omit sec_id_type and sec_id
185
+ @data[:end_date_time],
186
+ bar_size,
187
+ @data[:duration],
188
+ @data[:use_rth],
189
+ data_type.to_s.upcase,
190
+ 2 , # @data[:format_date], format-date is hard-coded as int_date in incoming/historicalData
191
+ contract.serialize_legs ,
192
+ @data[:keep_up_todate], # 0 / 1
193
+ 'XYZ' # chartOptions:TagValueList - For internal use only. Use default value XYZ.
194
+ ]
195
+ end
196
+ end # RequestHistoricalData
197
+
198
+ end # module Outgoing
199
+ end # module Messages
200
+ end # module IB
201
+
202
+ ## python documentaion
203
+ # """Requests contracts' historical data. When requesting historical data, a
204
+ # finishing time and date is required along with a duration string. The
205
+ # resulting bars will be returned in EWrapper.historicalData()
206
+ # reqId:TickerId - The id of the request. Must be a unique value. When the
207
+ # market data returns, it whatToShowill be identified by this tag. This is also
208
+ # used when canceling the market data.
209
+ # contract:Contract - This object contains a description of the contract for which
210
+ # market data is being requested.
211
+ # endDateTime:str - Defines a query end date and time at any point during the past 6 mos.
212
+ # Valid values include any date/time within the past six months in the format:
213
+ # yyyymmdd HH:mm:ss ttt
214
+ # where "ttt" is the optional time zone.
215
+ # durationStr:str - Set the query duration up to one week, using a time unit
216
+ # of seconds, days or weeks. Valid values include any integer followed by a space
217
+ # and then S (seconds), D (days) or W (week). If no unit is specified, seconds is used.
218
+ # barSizeSetting:str - Specifies the size of the bars that will be returned (within IB/TWS listimits).
219
+ # Valid values include:
220
+ # 1 sec
221
+ # 5 secs
222
+ # 15 secs
223
+ # 30 secs
224
+ # 1 min
225
+ # 2 mins
226
+ # 3 mins
227
+ # 5 mins
228
+ # 15 mins
229
+ # 30 mins
230
+ # 1 hour
231
+ # 1 day
232
+ # whatToShow:str - Determines the nature of data beinging extracted. Valid values include:
233
+ # TRADES
234
+ # MIDPOINT
235
+ # BID
236
+ # ASK
237
+ # BID_ASK
238
+ # HISTORICAL_VOLATILITY
239
+ # OPTION_IMPLIED_VOLATILITY
240
+ # useRTH:int - Determines whether to return all data available during the requested time span,
241
+ # or only data that falls within regular trading hours. Valid values include:
242
+ # 0 - all data is returned even where the market in question was outside of its
243
+ # regular trading hours.
244
+ # 1 - only data within the regular trading hours is returned, even if the
245
+ # requested time span falls partially or completely outside of the RTH.
246
+ # formatDate: int - Determines the date format applied to returned bars. validd values include:
247
+ # 1 - dates applying to bars returned in the format: yyyymmdd{space}{space}hh:mm:dd
248
+ # 2 - dates are returned as a long integer specifying the number of seconds since
249
+ # 1/1/1970 GMT.
250
+ # chartOptions:TagValueList - For internal use only. Use default value XYZ. """