snaptrade 3.0.52 → 3.0.54

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 (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -16
  3. data/lib/snaptrade/api/account_information_api.rb +6 -6
  4. data/lib/snaptrade/api/experimental_endpoints_api.rb +14 -10
  5. data/lib/snaptrade/api/trading_api.rb +4 -4
  6. data/lib/snaptrade/models/account_order.rb +8 -9
  7. data/lib/snaptrade/models/account_position.rb +1 -1
  8. data/lib/snaptrade/models/cash_instrument.rb +1 -1
  9. data/lib/snaptrade/models/instrument.rb +2 -0
  10. data/lib/snaptrade/models/manual_trade_form.rb +1 -1
  11. data/lib/snaptrade/models/manual_trade_form_with_options.rb +1 -1
  12. data/lib/snaptrade/models/preferred_stock_instrument.rb +311 -0
  13. data/lib/snaptrade/models/preferred_stock_instrument_kind.rb +36 -0
  14. data/lib/snaptrade/models/priced_in_instrument.rb +53 -0
  15. data/lib/snaptrade/models/simple_trade_form.rb +2 -2
  16. data/lib/snaptrade/models/simple_trade_instrument.rb +1 -1
  17. data/lib/snaptrade/models/{manual_trade_form_notional_value.rb → trading_place_simple_order409_response.rb} +32 -12
  18. data/lib/snaptrade/models/underlying_cfd_instrument.rb +2 -0
  19. data/lib/snaptrade/models/underlying_option_instrument.rb +2 -0
  20. data/lib/snaptrade/version.rb +1 -1
  21. data/lib/snaptrade.rb +4 -1
  22. data/spec/api/account_information_api_spec.rb +1 -1
  23. data/spec/api/experimental_endpoints_api_spec.rb +1 -1
  24. data/spec/models/account_order_spec.rb +1 -1
  25. data/spec/models/{manual_trade_form_notional_value_spec.rb → preferred_stock_instrument_kind_spec.rb} +6 -6
  26. data/spec/models/preferred_stock_instrument_spec.rb +71 -0
  27. data/spec/models/priced_in_instrument_spec.rb +38 -0
  28. data/spec/models/trading_place_simple_order409_response_spec.rb +41 -0
  29. metadata +291 -282
@@ -0,0 +1,311 @@
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
+ # Security instrument metadata for preferred stock positions. Preferred shares were previously returned with kind `other`.
15
+ class PreferredStockInstrument
16
+ # Type of security instrument.
17
+ attr_accessor :kind
18
+
19
+ # Unique identifier for the instrument.
20
+ attr_accessor :id
21
+
22
+ # The formatted trading symbol for the security.
23
+ attr_accessor :symbol
24
+
25
+ # The raw symbol without any exchange suffix.
26
+ attr_accessor :raw_symbol
27
+
28
+ # Human-readable description of the security.
29
+ attr_accessor :description
30
+
31
+ # ISO-4217 currency code for the security listing.
32
+ attr_accessor :currency
33
+
34
+ # Exchange MIC code or exchange code for the security.
35
+ attr_accessor :exchange
36
+
37
+ attr_accessor :figi_instrument
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'kind' => :'kind',
43
+ :'id' => :'id',
44
+ :'symbol' => :'symbol',
45
+ :'raw_symbol' => :'raw_symbol',
46
+ :'description' => :'description',
47
+ :'currency' => :'currency',
48
+ :'exchange' => :'exchange',
49
+ :'figi_instrument' => :'figi_instrument'
50
+ }
51
+ end
52
+
53
+ # Returns all the JSON keys this model knows about
54
+ def self.acceptable_attributes
55
+ attribute_map.values
56
+ end
57
+
58
+ # Attribute type mapping.
59
+ def self.openapi_types
60
+ {
61
+ :'kind' => :'PreferredStockInstrumentKind',
62
+ :'id' => :'String',
63
+ :'symbol' => :'String',
64
+ :'raw_symbol' => :'String',
65
+ :'description' => :'String',
66
+ :'currency' => :'String',
67
+ :'exchange' => :'String',
68
+ :'figi_instrument' => :'StockInstrumentFigiInstrument'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ :'description',
76
+ :'currency',
77
+ :'exchange',
78
+ :'figi_instrument'
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::PreferredStockInstrument` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h|
91
+ if (!self.class.attribute_map.key?(k.to_sym))
92
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::PreferredStockInstrument`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
93
+ end
94
+ h[k.to_sym] = v
95
+ }
96
+
97
+ if attributes.key?(:'kind')
98
+ self.kind = attributes[:'kind']
99
+ end
100
+
101
+ if attributes.key?(:'id')
102
+ self.id = attributes[:'id']
103
+ end
104
+
105
+ if attributes.key?(:'symbol')
106
+ self.symbol = attributes[:'symbol']
107
+ end
108
+
109
+ if attributes.key?(:'raw_symbol')
110
+ self.raw_symbol = attributes[:'raw_symbol']
111
+ end
112
+
113
+ if attributes.key?(:'description')
114
+ self.description = attributes[:'description']
115
+ end
116
+
117
+ if attributes.key?(:'currency')
118
+ self.currency = attributes[:'currency']
119
+ end
120
+
121
+ if attributes.key?(:'exchange')
122
+ self.exchange = attributes[:'exchange']
123
+ end
124
+
125
+ if attributes.key?(:'figi_instrument')
126
+ self.figi_instrument = attributes[:'figi_instrument']
127
+ end
128
+ end
129
+
130
+ # Show invalid properties with the reasons. Usually used together with valid?
131
+ # @return Array for valid properties with the reasons
132
+ def list_invalid_properties
133
+ invalid_properties = Array.new
134
+ if @kind.nil?
135
+ invalid_properties.push('invalid value for "kind", kind cannot be nil.')
136
+ end
137
+
138
+ if @id.nil?
139
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
140
+ end
141
+
142
+ if @symbol.nil?
143
+ invalid_properties.push('invalid value for "symbol", symbol cannot be nil.')
144
+ end
145
+
146
+ if @raw_symbol.nil?
147
+ invalid_properties.push('invalid value for "raw_symbol", raw_symbol cannot be nil.')
148
+ end
149
+
150
+ invalid_properties
151
+ end
152
+
153
+ # Check to see if the all the properties in the model are valid
154
+ # @return true if the model is valid
155
+ def valid?
156
+ return false if @kind.nil?
157
+ return false if @id.nil?
158
+ return false if @symbol.nil?
159
+ return false if @raw_symbol.nil?
160
+ true
161
+ end
162
+
163
+ # Checks equality by comparing each attribute.
164
+ # @param [Object] Object to be compared
165
+ def ==(o)
166
+ return true if self.equal?(o)
167
+ self.class == o.class &&
168
+ kind == o.kind &&
169
+ id == o.id &&
170
+ symbol == o.symbol &&
171
+ raw_symbol == o.raw_symbol &&
172
+ description == o.description &&
173
+ currency == o.currency &&
174
+ exchange == o.exchange &&
175
+ figi_instrument == o.figi_instrument
176
+ end
177
+
178
+ # @see the `==` method
179
+ # @param [Object] Object to be compared
180
+ def eql?(o)
181
+ self == o
182
+ end
183
+
184
+ # Calculates hash code according to all attributes.
185
+ # @return [Integer] Hash code
186
+ def hash
187
+ [kind, id, symbol, raw_symbol, description, currency, exchange, figi_instrument].hash
188
+ end
189
+
190
+ # Builds the object from hash
191
+ # @param [Hash] attributes Model attributes in the form of hash
192
+ # @return [Object] Returns the model itself
193
+ def self.build_from_hash(attributes)
194
+ new.build_from_hash(attributes)
195
+ end
196
+
197
+ # Builds the object from hash
198
+ # @param [Hash] attributes Model attributes in the form of hash
199
+ # @return [Object] Returns the model itself
200
+ def build_from_hash(attributes)
201
+ return nil unless attributes.is_a?(Hash)
202
+ attributes = attributes.transform_keys(&:to_sym)
203
+ self.class.openapi_types.each_pair do |key, type|
204
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
205
+ self.send("#{key}=", nil)
206
+ elsif type =~ /\AArray<(.*)>/i
207
+ # check to ensure the input is an array given that the attribute
208
+ # is documented as an array but the input is not
209
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
210
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
211
+ end
212
+ elsif !attributes[self.class.attribute_map[key]].nil?
213
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
214
+ end
215
+ end
216
+
217
+ self
218
+ end
219
+
220
+ # Deserializes the data based on type
221
+ # @param string type Data type
222
+ # @param string value Value to be deserialized
223
+ # @return [Object] Deserialized data
224
+ def _deserialize(type, value)
225
+ case type.to_sym
226
+ when :Time
227
+ Time.parse(value)
228
+ when :Date
229
+ Date.parse(value)
230
+ when :String
231
+ value.to_s
232
+ when :Integer
233
+ value.to_i
234
+ when :Float
235
+ value.to_f
236
+ when :Boolean
237
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
238
+ true
239
+ else
240
+ false
241
+ end
242
+ when :Object
243
+ # generic object (usually a Hash), return directly
244
+ value
245
+ when /\AArray<(?<inner_type>.+)>\z/
246
+ inner_type = Regexp.last_match[:inner_type]
247
+ value.map { |v| _deserialize(inner_type, v) }
248
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
249
+ k_type = Regexp.last_match[:k_type]
250
+ v_type = Regexp.last_match[:v_type]
251
+ {}.tap do |hash|
252
+ value.each do |k, v|
253
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
254
+ end
255
+ end
256
+ else # model
257
+ # models (e.g. Pet) or oneOf
258
+ klass = SnapTrade.const_get(type)
259
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
260
+ end
261
+ end
262
+
263
+ # Returns the string representation of the object
264
+ # @return [String] String presentation of the object
265
+ def to_s
266
+ to_hash.to_s
267
+ end
268
+
269
+ # to_body is an alias to to_hash (backward compatibility)
270
+ # @return [Hash] Returns the object in the form of hash
271
+ def to_body
272
+ to_hash
273
+ end
274
+
275
+ # Returns the object in the form of hash
276
+ # @return [Hash] Returns the object in the form of hash
277
+ def to_hash
278
+ hash = {}
279
+ self.class.attribute_map.each_pair do |attr, param|
280
+ value = self.send(attr)
281
+ if value.nil?
282
+ is_nullable = self.class.openapi_nullable.include?(attr)
283
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
284
+ end
285
+
286
+ hash[param] = _to_hash(value)
287
+ end
288
+ hash
289
+ end
290
+
291
+ # Outputs non-array value in the form of hash
292
+ # For object, use to_hash. Otherwise, just return the value
293
+ # @param [Object] value Any valid value
294
+ # @return [Hash] Returns the value in the form of hash
295
+ def _to_hash(value)
296
+ if value.is_a?(Array)
297
+ value.compact.map { |v| _to_hash(v) }
298
+ elsif value.is_a?(Hash)
299
+ {}.tap do |hash|
300
+ value.each { |k, v| hash[k] = _to_hash(v) }
301
+ end
302
+ elsif value.respond_to? :to_hash
303
+ value.to_hash
304
+ else
305
+ value
306
+ end
307
+ end
308
+
309
+ end
310
+
311
+ 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 PreferredStockInstrumentKind
15
+ PREFERRED_STOCK = "preferred_stock".freeze
16
+
17
+ def self.all_vars
18
+ @all_vars ||= [PREFERRED_STOCK].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 PreferredStockInstrumentKind.all_vars.include?(value)
33
+ raise "Invalid ENUM value #{value} for class #PreferredStockInstrumentKind"
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,53 @@
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
+ # The asset an order's prices are denominated in. Use `kind` to determine which schema is present.
15
+ module PricedInInstrument
16
+ class << self
17
+ # List of class defined in oneOf (OpenAPI v3)
18
+ def openapi_one_of
19
+ [
20
+ :'CashInstrument',
21
+ :'CryptoInstrument'
22
+ ]
23
+ end
24
+
25
+ # Discriminator's property name (OpenAPI v3)
26
+ def openapi_discriminator_name
27
+ :'kind'
28
+ end
29
+
30
+ # Discriminator's mapping (OpenAPI v3)
31
+ def openapi_discriminator_mapping
32
+ {
33
+ :'cash' => :'CashInstrument',
34
+ :'crypto' => :'CryptoInstrument'
35
+ }
36
+ end
37
+
38
+ # Builds the object
39
+ # @param [Mixed] Data to be matched against the list of oneOf items
40
+ # @return [Object] Returns the model or the data itself
41
+ def build(data)
42
+ discriminator_value = data[openapi_discriminator_name]
43
+ return nil if discriminator_value.nil?
44
+
45
+ klass = openapi_discriminator_mapping[discriminator_value.to_s.to_sym]
46
+ return nil unless klass
47
+
48
+ SnapTrade.const_get(klass).build_from_hash(data)
49
+ end
50
+ end
51
+ end
52
+
53
+ end
@@ -14,7 +14,7 @@ module SnapTrade
14
14
  class SimpleTradeForm
15
15
  attr_accessor :order_type
16
16
 
17
- # Order duration, subject to brokerage and execution-path support. gtd requires expiry_date and a non-market single-leg equity/option order. Existing single-leg option routing does not support ioc. Futures and multi-leg orders do not support gtd through this endpoint. Webull US futures only support day and gtc.
17
+ # Order duration, subject to brokerage and execution-path support. gtd requires expiry_date and a non-market single-leg equity/option order. Existing single-leg option routing does not support ioc. Futures and multi-leg orders do not support gtd through this endpoint. Webull US futures only support day and gtc. TradeStation futures and futures options accept day, gtc, ioc, and fok, subject to the contract and route's supported combinations.
18
18
  attr_accessor :time_in_force
19
19
 
20
20
  # Legs of one brokerage order. Use equity/option legs or future/future_option legs, without mixing the two families. Brokerage strategy and leg-count limits apply.
@@ -29,7 +29,7 @@ module SnapTrade
29
29
  # Only applicable to multi-leg limit and stop_limit orders. Requirements and supported values depend on the brokerage; tastytrade requires credit or debit. even implies a zero limit_price, which may be omitted and must be zero if supplied. Single-leg price effects are derived from the action.
30
30
  attr_accessor :price_effect
31
31
 
32
- # Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade and Webull US futures orders. Requires the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies; SnapTrade does not enforce uniqueness. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions. For Webull US futures, SnapTrade converts the supplied UUID (or its generated order UUID) to lowercase 32-character hexadecimal without hyphens. The original supplied UUID remains in SnapTrade's trade audit; the converted value is returned as brokerage_order_id for subsequent order reads.
32
+ # Optional canonical UUID, forwarded where the existing execution path supports it and for tastytrade, Webull US, and TradeStation futures-family orders. Requires the existing client-order-ID enablement; when disabled the value is ignored. Brokerage behavior on duplicates varies. SnapTrade does not enforce uniqueness, except for requests authenticated with an OAuth access token, where a client_order_id the user has already used returns 409. Tastytrade uses this as external-identifier for correlation and does not deduplicate submissions. For Webull US futures, SnapTrade converts the supplied UUID (or its generated order UUID) to lowercase 32-character hexadecimal without hyphens. The original supplied UUID remains in SnapTrade's trade audit; the converted value is returned as brokerage_order_id for subsequent order reads. For TradeStation live and SIM, SnapTrade encodes the supplied UUID (or its generated order UUID) as 22-character URL-safe base64 without padding and sends it as OrderConfirmID for brokerage duplicate prevention; the response contains TradeStation's separate order ID.
33
33
  attr_accessor :client_order_id
34
34
 
35
35
  # ISO 8601 expiry timestamp, required for gtd and invalid with other durations. A missing timezone is treated as UTC. Supported only through existing single-leg Public and Sandbox execution paths.
@@ -14,7 +14,7 @@ module SnapTrade
14
14
  class SimpleTradeInstrument
15
15
  attr_accessor :kind
16
16
 
17
- # Equity ticker, OCC equity-option symbol, or brokerage-native futures symbol. Tastytrade future tickers begin with `/` and future-option tickers begin with `./`; preserve their spaces and punctuation. Webull US futures require a specific unprefixed contract symbol such as ESZ6, without whitespace; slash aliases and continuous/root-only symbols are not accepted. Universal symbol IDs are not accepted.
17
+ # Equity ticker, OCC equity-option symbol, or brokerage-native futures symbol. Tastytrade future tickers begin with `/` and future-option tickers begin with `./`; preserve their spaces and punctuation. Webull US futures require a specific unprefixed contract symbol such as ESZ6, without whitespace. TradeStation (live and SIM) requires a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as `ESZ26 C6000`, preserving the space and any session alias. TradeStation's optional @ prefix for dated futures contracts is forwarded unchanged. Webull and TradeStation do not accept slash aliases or root-only continuous symbols. Universal symbol IDs are not accepted.
18
18
  attr_accessor :symbol
19
19
 
20
20
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -11,10 +11,19 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module SnapTrade
14
- class ManualTradeFormNotionalValue
14
+ class TradingPlaceSimpleOrder409Response
15
+ attr_accessor :detail
16
+
17
+ attr_accessor :status_code
18
+
19
+ attr_accessor :code
20
+
15
21
  # Attribute mapping from ruby-style variable name to JSON key.
16
22
  def self.attribute_map
17
23
  {
24
+ :'detail' => :'detail',
25
+ :'status_code' => :'status_code',
26
+ :'code' => :'code'
18
27
  }
19
28
  end
20
29
 
@@ -26,6 +35,9 @@ module SnapTrade
26
35
  # Attribute type mapping.
27
36
  def self.openapi_types
28
37
  {
38
+ :'detail' => :'String',
39
+ :'status_code' => :'Integer',
40
+ :'code' => :'String'
29
41
  }
30
42
  end
31
43
 
@@ -35,27 +47,32 @@ module SnapTrade
35
47
  ])
36
48
  end
37
49
 
38
- # List of class defined in allOf (OpenAPI v3)
39
- def self.openapi_all_of
40
- [
41
- :'NotionalValue'
42
- ]
43
- end
44
-
45
50
  # Initializes the object
46
51
  # @param [Hash] attributes Model attributes in the form of hash
47
52
  def initialize(attributes = {})
48
53
  if (!attributes.is_a?(Hash))
49
- fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::ManualTradeFormNotionalValue` initialize method"
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::TradingPlaceSimpleOrder409Response` initialize method"
50
55
  end
51
56
 
52
57
  # check to see if the attribute exists and convert string to symbol for hash key
53
58
  attributes = attributes.each_with_object({}) { |(k, v), h|
54
59
  if (!self.class.attribute_map.key?(k.to_sym))
55
- fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::ManualTradeFormNotionalValue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::TradingPlaceSimpleOrder409Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
61
  end
57
62
  h[k.to_sym] = v
58
63
  }
64
+
65
+ if attributes.key?(:'detail')
66
+ self.detail = attributes[:'detail']
67
+ end
68
+
69
+ if attributes.key?(:'status_code')
70
+ self.status_code = attributes[:'status_code']
71
+ end
72
+
73
+ if attributes.key?(:'code')
74
+ self.code = attributes[:'code']
75
+ end
59
76
  end
60
77
 
61
78
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -75,7 +92,10 @@ module SnapTrade
75
92
  # @param [Object] Object to be compared
76
93
  def ==(o)
77
94
  return true if self.equal?(o)
78
- self.class == o.class
95
+ self.class == o.class &&
96
+ detail == o.detail &&
97
+ status_code == o.status_code &&
98
+ code == o.code
79
99
  end
80
100
 
81
101
  # @see the `==` method
@@ -87,7 +107,7 @@ module SnapTrade
87
107
  # Calculates hash code according to all attributes.
88
108
  # @return [Integer] Hash code
89
109
  def hash
90
- [].hash
110
+ [detail, status_code, code].hash
91
111
  end
92
112
 
93
113
  # Builds the object from hash
@@ -23,6 +23,7 @@ module SnapTrade
23
23
  :'EtfInstrument',
24
24
  :'MutualFundInstrument',
25
25
  :'OtherInstrument',
26
+ :'PreferredStockInstrument',
26
27
  :'StockInstrument'
27
28
  ]
28
29
  end
@@ -42,6 +43,7 @@ module SnapTrade
42
43
  :'etf' => :'EtfInstrument',
43
44
  :'mutualfund' => :'MutualFundInstrument',
44
45
  :'other' => :'OtherInstrument',
46
+ :'preferred_stock' => :'PreferredStockInstrument',
45
47
  :'stock' => :'StockInstrument'
46
48
  }
47
49
  end
@@ -23,6 +23,7 @@ module SnapTrade
23
23
  :'EtfInstrument',
24
24
  :'MutualFundInstrument',
25
25
  :'OtherInstrument',
26
+ :'PreferredStockInstrument',
26
27
  :'StockInstrument'
27
28
  ]
28
29
  end
@@ -42,6 +43,7 @@ module SnapTrade
42
43
  :'etf' => :'EtfInstrument',
43
44
  :'mutualfund' => :'MutualFundInstrument',
44
45
  :'other' => :'OtherInstrument',
46
+ :'preferred_stock' => :'PreferredStockInstrument',
45
47
  :'stock' => :'StockInstrument'
46
48
  }
47
49
  end
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '3.0.52'
11
+ VERSION = '3.0.54'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -166,7 +166,6 @@ require 'snaptrade/models/manual_trade_form'
166
166
  require 'snaptrade/models/manual_trade_form_bracket'
167
167
  require 'snaptrade/models/manual_trade_form_complex'
168
168
  require 'snaptrade/models/manual_trade_form_complex_type'
169
- require 'snaptrade/models/manual_trade_form_notional_value'
170
169
  require 'snaptrade/models/manual_trade_form_with_options'
171
170
  require 'snaptrade/models/manual_trade_impact'
172
171
  require 'snaptrade/models/manual_trade_place_time_in_force_strict'
@@ -240,7 +239,10 @@ require 'snaptrade/models/performance_custom'
240
239
  require 'snaptrade/models/position'
241
240
  require 'snaptrade/models/position_currency'
242
241
  require 'snaptrade/models/position_symbol'
242
+ require 'snaptrade/models/preferred_stock_instrument'
243
+ require 'snaptrade/models/preferred_stock_instrument_kind'
243
244
  require 'snaptrade/models/price_effect'
245
+ require 'snaptrade/models/priced_in_instrument'
244
246
  require 'snaptrade/models/rate_of_return_object'
245
247
  require 'snaptrade/models/rate_of_return_response'
246
248
  require 'snaptrade/models/recent_orders_response'
@@ -300,6 +302,7 @@ require 'snaptrade/models/trade_detection_subscription'
300
302
  require 'snaptrade/models/trading_get_user_account_option_quotes410_response'
301
303
  require 'snaptrade/models/trading_instrument'
302
304
  require 'snaptrade/models/trading_instrument_type'
305
+ require 'snaptrade/models/trading_place_simple_order409_response'
303
306
  require 'snaptrade/models/trading_search_cryptocurrency_pair_instruments200_response'
304
307
  require 'snaptrade/models/trading_session'
305
308
  require 'snaptrade/models/trailing_stop'
@@ -90,7 +90,7 @@ describe 'AccountInformationApi' do
90
90
 
91
91
  # unit tests for get_all_account_positions
92
92
  # List all account positions
93
- # 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, CFD positions, and tokenized asset 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;. Security positions (&#x60;stock&#x60;, &#x60;adr&#x60;, &#x60;etf&#x60;, &#x60;mutualfund&#x60;, &#x60;cef&#x60;, &#x60;crypto&#x60;, &#x60;bond&#x60;, and &#x60;other&#x60;) may include &#x60;tax_lots&#x60; when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. 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.
93
+ # 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, preferred stocks, ADRs, ETFs, mutual funds, closed-end funds, bonds, crypto, futures, option positions, future option positions, CFD positions, and tokenized asset 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;. Security positions (&#x60;stock&#x60;, &#x60;preferred_stock&#x60;, &#x60;adr&#x60;, &#x60;etf&#x60;, &#x60;mutualfund&#x60;, &#x60;cef&#x60;, &#x60;crypto&#x60;, &#x60;bond&#x60;, and &#x60;other&#x60;) may include &#x60;tax_lots&#x60; when tax lot data is enabled for the account; derivative, CFD, tokenized asset, and cash positions never do. 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.
94
94
  # @param user_id
95
95
  # @param user_secret
96
96
  # @param account_id
@@ -128,7 +128,7 @@ describe 'ExperimentalEndpointsApi' do
128
128
 
129
129
  # unit tests for place_simple_order
130
130
  # Place a simple order (beta)
131
- # **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade and Webull US; future options are supported only on tastytrade. Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. A futures symbol does not need to be present in SnapTrade&#39;s local instrument catalog to submit an order. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
131
+ # **Beta.** Places a single-leg or multi-leg order using a common request format for equities, equity options, futures, and future options. This endpoint is experimental; breaking changes are possible during the experimental phase. Equity and equity-option orders use the existing brokerage trading capabilities. Futures are supported on tastytrade, Webull US, and TradeStation (live and SIM); future options are supported on tastytrade and TradeStation (live and SIM). Order types, time in force, optional fields, and strategy combinations remain subject to brokerage support. See the [brokerage trading support page](https://support.snaptrade.com/brokerages). An order may contain equity/option legs or future/future_option legs, but cannot mix those two families. Equity/option strategies must share the same underlying symbol. Each strategy is submitted as one brokerage order; unsupported strategies are never split into independent orders. Tastytrade supports single-leg outright futures and up to four future-option legs, and does not support multi-leg market orders. Webull US supports single-leg futures orders with buy or sell actions and positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day or gtc duration. Futures options, multi-leg futures, trailing stops, and Webull Canada futures trading are not supported. Webull determines contract availability, margin requirements, and valid price increments. TradeStation and TradeStation SIM support single-leg futures and futures-option orders in Futures accounts, with positive whole-contract quantities. Supported order types are market, limit, stop, and stop_limit, with day, gtc, ioc, or fok duration, subject to the contract and route&#39;s supported combinations. Futures use buy/sell; futures options use the open/close option actions. Multi-leg futures-family strategies are not supported. Prices are forwarded without rounding; TradeStation determines contract availability, permissions, margin requirements, and valid price increments. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or brokerage-native futures symbols. For tastytrade, use the exact BrokerageInstrument ticker, including any spaces. For Webull US, use a specific unprefixed futures contract symbol such as ESZ6; slash-prefixed aliases, continuous/root-only symbols, and whitespace are not accepted. For TradeStation, use a specific two-digit-year contract such as ESZ26 or @ESZ26, or a futures-option symbol such as &#x60;ESZ26 C6000&#x60;, preserving the space and any session alias. The optional @ prefix is supported for dated futures contracts and is forwarded unchanged. Slash-prefixed aliases and root-only continuous symbols such as @ES are not accepted. A futures symbol does not need to be present in SnapTrade&#39;s local instrument catalog to submit an order. A successful response contains only the brokerage order ID. Use the existing order endpoints to retrieve order details.
132
132
  # @param account_id The ID of the account to execute the trade on.
133
133
  # @param user_id
134
134
  # @param user_secret
@@ -50,7 +50,7 @@ describe SnapTrade::AccountOrder do
50
50
  end
51
51
  end
52
52
 
53
- describe 'test attribute "price_currency"' do
53
+ describe 'test attribute "priced_in"' do
54
54
  it 'should work' do
55
55
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
56
  end