snaptrade 3.0.18 → 3.0.20

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.
@@ -0,0 +1,356 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: api@snaptrade.com
8
+ =end
9
+
10
+ require 'date'
11
+ require 'time'
12
+
13
+ module SnapTrade
14
+ # Future option (option on a futures contract) instrument metadata for a V2 position. **Beta:** currently returned only for tastytrade and Interactive Brokers connections, and only for partners it has been enabled for. This schema may change.
15
+ class FutureOptionInstrument
16
+ # Type of security instrument.
17
+ attr_accessor :kind
18
+
19
+ # Unique identifier for the future option instrument.
20
+ attr_accessor :id
21
+
22
+ # Display symbol for the future option contract.
23
+ attr_accessor :symbol
24
+
25
+ # Whether the contract is a call or put.
26
+ attr_accessor :option_type
27
+
28
+ # Strike price for the option contract.
29
+ attr_accessor :strike_price
30
+
31
+ # Expiration date of the option contract.
32
+ attr_accessor :expiration_date
33
+
34
+ # Notional multiplier for the option contract.
35
+ attr_accessor :multiplier
36
+
37
+ # Human-readable description of the option contract.
38
+ attr_accessor :description
39
+
40
+ # ISO-4217 currency code for the contract.
41
+ attr_accessor :currency
42
+
43
+ # Exchange MIC code or exchange code for the contract.
44
+ attr_accessor :exchange
45
+
46
+ attr_accessor :underlying
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'kind' => :'kind',
52
+ :'id' => :'id',
53
+ :'symbol' => :'symbol',
54
+ :'option_type' => :'option_type',
55
+ :'strike_price' => :'strike_price',
56
+ :'expiration_date' => :'expiration_date',
57
+ :'multiplier' => :'multiplier',
58
+ :'description' => :'description',
59
+ :'currency' => :'currency',
60
+ :'exchange' => :'exchange',
61
+ :'underlying' => :'underlying'
62
+ }
63
+ end
64
+
65
+ # Returns all the JSON keys this model knows about
66
+ def self.acceptable_attributes
67
+ attribute_map.values
68
+ end
69
+
70
+ # Attribute type mapping.
71
+ def self.openapi_types
72
+ {
73
+ :'kind' => :'FutureOptionInstrumentKind',
74
+ :'id' => :'String',
75
+ :'symbol' => :'String',
76
+ :'option_type' => :'OptionType',
77
+ :'strike_price' => :'Float',
78
+ :'expiration_date' => :'Date',
79
+ :'multiplier' => :'Float',
80
+ :'description' => :'String',
81
+ :'currency' => :'String',
82
+ :'exchange' => :'String',
83
+ :'underlying' => :'FutureInstrument'
84
+ }
85
+ end
86
+
87
+ # List of attributes with nullable: true
88
+ def self.openapi_nullable
89
+ Set.new([
90
+ :'multiplier',
91
+ :'description',
92
+ :'currency',
93
+ :'exchange',
94
+ ])
95
+ end
96
+
97
+ # Initializes the object
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ def initialize(attributes = {})
100
+ if (!attributes.is_a?(Hash))
101
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::FutureOptionInstrument` initialize method"
102
+ end
103
+
104
+ # check to see if the attribute exists and convert string to symbol for hash key
105
+ attributes = attributes.each_with_object({}) { |(k, v), h|
106
+ if (!self.class.attribute_map.key?(k.to_sym))
107
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::FutureOptionInstrument`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
108
+ end
109
+ h[k.to_sym] = v
110
+ }
111
+
112
+ if attributes.key?(:'kind')
113
+ self.kind = attributes[:'kind']
114
+ end
115
+
116
+ if attributes.key?(:'id')
117
+ self.id = attributes[:'id']
118
+ end
119
+
120
+ if attributes.key?(:'symbol')
121
+ self.symbol = attributes[:'symbol']
122
+ end
123
+
124
+ if attributes.key?(:'option_type')
125
+ self.option_type = attributes[:'option_type']
126
+ end
127
+
128
+ if attributes.key?(:'strike_price')
129
+ self.strike_price = attributes[:'strike_price']
130
+ end
131
+
132
+ if attributes.key?(:'expiration_date')
133
+ self.expiration_date = attributes[:'expiration_date']
134
+ end
135
+
136
+ if attributes.key?(:'multiplier')
137
+ self.multiplier = attributes[:'multiplier']
138
+ end
139
+
140
+ if attributes.key?(:'description')
141
+ self.description = attributes[:'description']
142
+ end
143
+
144
+ if attributes.key?(:'currency')
145
+ self.currency = attributes[:'currency']
146
+ end
147
+
148
+ if attributes.key?(:'exchange')
149
+ self.exchange = attributes[:'exchange']
150
+ end
151
+
152
+ if attributes.key?(:'underlying')
153
+ self.underlying = attributes[:'underlying']
154
+ end
155
+ end
156
+
157
+ # Show invalid properties with the reasons. Usually used together with valid?
158
+ # @return Array for valid properties with the reasons
159
+ def list_invalid_properties
160
+ invalid_properties = Array.new
161
+ if @kind.nil?
162
+ invalid_properties.push('invalid value for "kind", kind cannot be nil.')
163
+ end
164
+
165
+ if @id.nil?
166
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
167
+ end
168
+
169
+ if @symbol.nil?
170
+ invalid_properties.push('invalid value for "symbol", symbol cannot be nil.')
171
+ end
172
+
173
+ if @option_type.nil?
174
+ invalid_properties.push('invalid value for "option_type", option_type cannot be nil.')
175
+ end
176
+
177
+ if @strike_price.nil?
178
+ invalid_properties.push('invalid value for "strike_price", strike_price cannot be nil.')
179
+ end
180
+
181
+ if @expiration_date.nil?
182
+ invalid_properties.push('invalid value for "expiration_date", expiration_date cannot be nil.')
183
+ end
184
+
185
+ if @underlying.nil?
186
+ invalid_properties.push('invalid value for "underlying", underlying cannot be nil.')
187
+ end
188
+
189
+ invalid_properties
190
+ end
191
+
192
+ # Check to see if the all the properties in the model are valid
193
+ # @return true if the model is valid
194
+ def valid?
195
+ return false if @kind.nil?
196
+ return false if @id.nil?
197
+ return false if @symbol.nil?
198
+ return false if @option_type.nil?
199
+ return false if @strike_price.nil?
200
+ return false if @expiration_date.nil?
201
+ return false if @underlying.nil?
202
+ true
203
+ end
204
+
205
+ # Checks equality by comparing each attribute.
206
+ # @param [Object] Object to be compared
207
+ def ==(o)
208
+ return true if self.equal?(o)
209
+ self.class == o.class &&
210
+ kind == o.kind &&
211
+ id == o.id &&
212
+ symbol == o.symbol &&
213
+ option_type == o.option_type &&
214
+ strike_price == o.strike_price &&
215
+ expiration_date == o.expiration_date &&
216
+ multiplier == o.multiplier &&
217
+ description == o.description &&
218
+ currency == o.currency &&
219
+ exchange == o.exchange &&
220
+ underlying == o.underlying
221
+ end
222
+
223
+ # @see the `==` method
224
+ # @param [Object] Object to be compared
225
+ def eql?(o)
226
+ self == o
227
+ end
228
+
229
+ # Calculates hash code according to all attributes.
230
+ # @return [Integer] Hash code
231
+ def hash
232
+ [kind, id, symbol, option_type, strike_price, expiration_date, multiplier, description, currency, exchange, underlying].hash
233
+ end
234
+
235
+ # Builds the object from hash
236
+ # @param [Hash] attributes Model attributes in the form of hash
237
+ # @return [Object] Returns the model itself
238
+ def self.build_from_hash(attributes)
239
+ new.build_from_hash(attributes)
240
+ end
241
+
242
+ # Builds the object from hash
243
+ # @param [Hash] attributes Model attributes in the form of hash
244
+ # @return [Object] Returns the model itself
245
+ def build_from_hash(attributes)
246
+ return nil unless attributes.is_a?(Hash)
247
+ attributes = attributes.transform_keys(&:to_sym)
248
+ self.class.openapi_types.each_pair do |key, type|
249
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
250
+ self.send("#{key}=", nil)
251
+ elsif type =~ /\AArray<(.*)>/i
252
+ # check to ensure the input is an array given that the attribute
253
+ # is documented as an array but the input is not
254
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
255
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
256
+ end
257
+ elsif !attributes[self.class.attribute_map[key]].nil?
258
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
259
+ end
260
+ end
261
+
262
+ self
263
+ end
264
+
265
+ # Deserializes the data based on type
266
+ # @param string type Data type
267
+ # @param string value Value to be deserialized
268
+ # @return [Object] Deserialized data
269
+ def _deserialize(type, value)
270
+ case type.to_sym
271
+ when :Time
272
+ Time.parse(value)
273
+ when :Date
274
+ Date.parse(value)
275
+ when :String
276
+ value.to_s
277
+ when :Integer
278
+ value.to_i
279
+ when :Float
280
+ value.to_f
281
+ when :Boolean
282
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
283
+ true
284
+ else
285
+ false
286
+ end
287
+ when :Object
288
+ # generic object (usually a Hash), return directly
289
+ value
290
+ when /\AArray<(?<inner_type>.+)>\z/
291
+ inner_type = Regexp.last_match[:inner_type]
292
+ value.map { |v| _deserialize(inner_type, v) }
293
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
294
+ k_type = Regexp.last_match[:k_type]
295
+ v_type = Regexp.last_match[:v_type]
296
+ {}.tap do |hash|
297
+ value.each do |k, v|
298
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
299
+ end
300
+ end
301
+ else # model
302
+ # models (e.g. Pet) or oneOf
303
+ klass = SnapTrade.const_get(type)
304
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
305
+ end
306
+ end
307
+
308
+ # Returns the string representation of the object
309
+ # @return [String] String presentation of the object
310
+ def to_s
311
+ to_hash.to_s
312
+ end
313
+
314
+ # to_body is an alias to to_hash (backward compatibility)
315
+ # @return [Hash] Returns the object in the form of hash
316
+ def to_body
317
+ to_hash
318
+ end
319
+
320
+ # Returns the object in the form of hash
321
+ # @return [Hash] Returns the object in the form of hash
322
+ def to_hash
323
+ hash = {}
324
+ self.class.attribute_map.each_pair do |attr, param|
325
+ value = self.send(attr)
326
+ if value.nil?
327
+ is_nullable = self.class.openapi_nullable.include?(attr)
328
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
329
+ end
330
+
331
+ hash[param] = _to_hash(value)
332
+ end
333
+ hash
334
+ end
335
+
336
+ # Outputs non-array value in the form of hash
337
+ # For object, use to_hash. Otherwise, just return the value
338
+ # @param [Object] value Any valid value
339
+ # @return [Hash] Returns the value in the form of hash
340
+ def _to_hash(value)
341
+ if value.is_a?(Array)
342
+ value.compact.map { |v| _to_hash(v) }
343
+ elsif value.is_a?(Hash)
344
+ {}.tap do |hash|
345
+ value.each { |k, v| hash[k] = _to_hash(v) }
346
+ end
347
+ elsif value.respond_to? :to_hash
348
+ value.to_hash
349
+ else
350
+ value
351
+ end
352
+ end
353
+
354
+ end
355
+
356
+ end
@@ -0,0 +1,36 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: api@snaptrade.com
8
+ =end
9
+
10
+ require 'date'
11
+ require 'time'
12
+
13
+ module SnapTrade
14
+ class FutureOptionInstrumentKind
15
+ FUTURE_OPTION = "future_option".freeze
16
+
17
+ def self.all_vars
18
+ @all_vars ||= [FUTURE_OPTION].freeze
19
+ end
20
+
21
+ # Builds the enum from string
22
+ # @param [String] The enum value in the form of the string
23
+ # @return [String] The enum value
24
+ def self.build_from_hash(value)
25
+ new.build_from_hash(value)
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def build_from_hash(value)
32
+ return value if FutureOptionInstrumentKind.all_vars.include?(value)
33
+ raise "Invalid ENUM value #{value} for class #FutureOptionInstrumentKind"
34
+ end
35
+ end
36
+ end
@@ -23,6 +23,7 @@ module SnapTrade
23
23
  :'CryptoInstrument',
24
24
  :'EtfInstrument',
25
25
  :'FutureInstrument',
26
+ :'FutureOptionInstrument',
26
27
  :'MutualFundInstrument',
27
28
  :'OptionInstrument',
28
29
  :'OtherInstrument',
@@ -45,6 +46,7 @@ module SnapTrade
45
46
  :'crypto' => :'CryptoInstrument',
46
47
  :'etf' => :'EtfInstrument',
47
48
  :'future' => :'FutureInstrument',
49
+ :'future_option' => :'FutureOptionInstrument',
48
50
  :'mutualfund' => :'MutualFundInstrument',
49
51
  :'option' => :'OptionInstrument',
50
52
  :'other' => :'OtherInstrument',
@@ -65,7 +65,7 @@ module SnapTrade
65
65
  :'kind' => :'OptionInstrumentKind',
66
66
  :'id' => :'String',
67
67
  :'symbol' => :'String',
68
- :'option_type' => :'OptionType',
68
+ :'option_type' => :'OptionInstrumentOptionType',
69
69
  :'strike_price' => :'Float',
70
70
  :'expiration_date' => :'Date',
71
71
  :'multiplier' => :'Float',
@@ -0,0 +1,37 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: api@snaptrade.com
8
+ =end
9
+
10
+ require 'date'
11
+ require 'time'
12
+
13
+ module SnapTrade
14
+ class OptionInstrumentOptionType
15
+ CALL = "CALL".freeze
16
+ PUT = "PUT".freeze
17
+
18
+ def self.all_vars
19
+ @all_vars ||= [CALL, PUT].freeze
20
+ end
21
+
22
+ # Builds the enum from string
23
+ # @param [String] The enum value in the form of the string
24
+ # @return [String] The enum value
25
+ def self.build_from_hash(value)
26
+ new.build_from_hash(value)
27
+ end
28
+
29
+ # Builds the enum from string
30
+ # @param [String] The enum value in the form of the string
31
+ # @return [String] The enum value
32
+ def build_from_hash(value)
33
+ return value if OptionInstrumentOptionType.all_vars.include?(value)
34
+ raise "Invalid ENUM value #{value} for class #OptionInstrumentOptionType"
35
+ end
36
+ end
37
+ end
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '3.0.18'
11
+ VERSION = '3.0.20'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -113,6 +113,8 @@ require 'snaptrade/models/exchange_rate_pairs'
113
113
  require 'snaptrade/models/figi_instrument'
114
114
  require 'snaptrade/models/future_instrument'
115
115
  require 'snaptrade/models/future_instrument_kind'
116
+ require 'snaptrade/models/future_option_instrument'
117
+ require 'snaptrade/models/future_option_instrument_kind'
116
118
  require 'snaptrade/models/holdings_status'
117
119
  require 'snaptrade/models/institution'
118
120
  require 'snaptrade/models/instrument'
@@ -173,6 +175,7 @@ require 'snaptrade/models/option_chain_inner_chain_per_root_inner_chain_per_stri
173
175
  require 'snaptrade/models/option_impact'
174
176
  require 'snaptrade/models/option_instrument'
175
177
  require 'snaptrade/models/option_instrument_kind'
178
+ require 'snaptrade/models/option_instrument_option_type'
176
179
  require 'snaptrade/models/option_leg'
177
180
  require 'snaptrade/models/option_leg_action'
178
181
  require 'snaptrade/models/option_quote'
@@ -62,7 +62,7 @@ describe 'AccountInformationApi' do
62
62
 
63
63
  # unit tests for get_all_account_positions
64
64
  # List all account positions
65
- # Returns a list of all positions in the specified account. The &#x60;results&#x60; list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, and CFD positions. Use the &#x60;instrument.kind&#x60; discriminator to determine the schema for each position&#39;s &#x60;instrument&#x60;. Positions counted in account cash balance or buying power include &#x60;cash_equivalent: true&#x60;. &#x60;stock&#x60;, &#x60;adr&#x60;, &#x60;etf&#x60;, &#x60;mutualfund&#x60;, and &#x60;crypto&#x60; positions may include &#x60;tax_lots&#x60; when tax lot data is enabled for the account. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages). If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
65
+ # Returns a list of all positions in the specified account. The &#x60;results&#x60; list can contain multiple instrument types in the same response, including stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, and CFD positions. Use the &#x60;instrument.kind&#x60; discriminator to determine the schema for each position&#39;s &#x60;instrument&#x60;. **Beta:** future option positions (&#x60;instrument.kind: future_option&#x60;) are in beta. They are currently returned only for tastytrade and Interactive Brokers connections, and only for partners they have been enabled for — please contact the SnapTrade team to enable them. The &#x60;FutureOptionInstrument&#x60; schema may change. Positions counted in account cash balance or buying power include &#x60;cash_equivalent: true&#x60;. &#x60;stock&#x60;, &#x60;adr&#x60;, &#x60;etf&#x60;, &#x60;mutualfund&#x60;, and &#x60;crypto&#x60; positions may include &#x60;tax_lots&#x60; when tax lot data is enabled for the account. To see which institutions support tax lot data, please see our [supported institutions doc](https://support.snaptrade.com/brokerages). If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
66
66
  # @param user_id
67
67
  # @param user_secret
68
68
  # @param account_id
@@ -96,6 +96,20 @@ describe 'ConnectionsApi' do
96
96
  end
97
97
  end
98
98
 
99
+ # unit tests for list_connection_accounts
100
+ # List accounts for a connection (discriminated union)
101
+ # Returns the accounts that belong to the specified connection for the authenticated user, using the &#x60;kind&#x60;-discriminated account shape. Each item in the response carries a &#x60;kind&#x60; field (&#x60;investment&#x60;, &#x60;deposit&#x60;, and &#x60;line_of_credit&#x60; are implemented) that determines which additional fields are present -- see the &#x60;ConnectionAccount&#x60; schema. On Pay as you Go / Real-time, this endpoint refreshes each account&#39;s opening date and total net value (&#x60;net_value&#x60;) live from the institution on each call, along with funding date for &#x60;investment&#x60; accounts. On Pay as you Go / Daily, this endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by institution. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see whether your plan includes real-time data.
102
+ # @param connection_id
103
+ # @param user_id
104
+ # @param user_secret
105
+ # @param [Hash] opts the optional parameters
106
+ # @return [Array<ConnectionAccount>]
107
+ describe 'list_connection_accounts test' do
108
+ it 'should work' do
109
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
110
+ end
111
+ end
112
+
99
113
  # unit tests for refresh_brokerage_authorization
100
114
  # Refresh holdings for a connection
101
115
  # Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [&#x60;ACCOUNT_HOLDINGS_UPDATED&#x60; webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred. **Because of the cost of refreshing a connection, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)** **Please note this endpoint is disabled for Real-time plans (Personal and Pay as you go) unless SnapTrade uses delayed data for the connection. Real-time connections do not benefit from this feature since data is refreshed when calls are made. Refer to &#x60;data_freshness_mode.snaptrade&#x60; on a connection to determine this.**
@@ -99,20 +99,6 @@ describe 'ExperimentalEndpointsApi' do
99
99
  end
100
100
  end
101
101
 
102
- # unit tests for list_connection_accounts
103
- # List accounts for a connection (discriminated union)
104
- # Experimental and subject to change without notice. Returns the accounts that belong to the specified connection for the authenticated user, using the &#x60;kind&#x60;-discriminated account shape. Each item in the response carries a &#x60;kind&#x60; field (&#x60;investment&#x60;, &#x60;deposit&#x60;, and &#x60;line_of_credit&#x60; are implemented) that determines which additional fields are present -- see the &#x60;ConnectionAccount&#x60; schema. On Pay as you Go / Real-time, this endpoint refreshes each account&#39;s opening date and total net value (&#x60;net_value&#x60;) live from the institution on each call, along with funding date for &#x60;investment&#x60; accounts. On Pay as you Go / Daily, this endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by institution. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see whether your plan includes real-time data.
105
- # @param connection_id
106
- # @param user_id
107
- # @param user_secret
108
- # @param [Hash] opts the optional parameters
109
- # @return [Array<ConnectionAccount>]
110
- describe 'list_connection_accounts test' do
111
- it 'should work' do
112
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
113
- end
114
- end
115
-
116
102
  # unit tests for list_subscriptions
117
103
  # List active Trade Detection subscriptions
118
104
  # Returns active Trade Detection subscriptions for your Client ID. Cancelled subscriptions are not returned.
@@ -0,0 +1,23 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: api@snaptrade.com
8
+ =end
9
+
10
+ require 'spec_helper'
11
+ require 'json'
12
+ require 'date'
13
+
14
+ # Unit tests for SnapTrade::FutureOptionInstrumentKind
15
+ describe SnapTrade::FutureOptionInstrumentKind do
16
+ let(:instance) { SnapTrade::FutureOptionInstrumentKind.new }
17
+
18
+ describe 'test an instance of FutureOptionInstrumentKind' do
19
+ it 'should create an instance of FutureOptionInstrumentKind' do
20
+ expect(instance).to be_instance_of(SnapTrade::FutureOptionInstrumentKind)
21
+ end
22
+ end
23
+ end