snaptrade 3.0.17 → 3.0.19

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 453e07ef22552dfcc5ba7aaf226f04c6ae70b4795f0b25c480d9e57c1c080dad
4
- data.tar.gz: ea726cdd14e3e2478fa66e9339d959aa3b731cfb27f17070e597161b25b09f21
3
+ metadata.gz: 83b50aa122906e3335ec87cea66fd578b1051d185cb443a3fa1d4547cc169ba4
4
+ data.tar.gz: e75959932405d8332e0ff0792b33a822803bde99884f4d88e3bf77f2a9f266e4
5
5
  SHA512:
6
- metadata.gz: 0043f1a7bf08c97e3f633740b3c7e719c849e2c583d46ed90bc44cd3da9209c22fcd5b7789e4948c664eab9c7d717a1a130ffe62a8f9039b946fb954005cbd8a
7
- data.tar.gz: 82d3e842da1da873041694d85ba6629c04b7fdca1d819d0721717c39e00a4de357e1ae9f78d779845cbccb8ceaa5568951427119859f7e53eca5e7b97984a76f
6
+ metadata.gz: 8299becc77d8244f1d6f83f506af9cab8a03662c3b3ffd94d168dbff044cc6e9f39aa91826ab24e68c0b8f3f3a34c3a639fa3d12d3f6b03b35155bab21be5efd
7
+ data.tar.gz: 9ac79ae9f0c067be7822318d3a0093cafc0b06d951250165057bbe8a2e8fa7232ff96fef1ce31bfe5d710910cce62b4efe09bf5db4d4424bdd5218d4810f59f3
data/README.md CHANGED
@@ -63,7 +63,7 @@ backoff with jitter rather than from the headers.
63
63
  See https://docs.snaptrade.com/docs/ratelimiting.
64
64
 
65
65
 
66
- [![npm](https://img.shields.io/badge/gem-v3.0.17-blue)](https://rubygems.org/gems/snaptrade/versions/3.0.17)
66
+ [![npm](https://img.shields.io/badge/gem-v3.0.19-blue)](https://rubygems.org/gems/snaptrade/versions/3.0.19)
67
67
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
68
68
 
69
69
  </div>
@@ -139,7 +139,7 @@ See https://docs.snaptrade.com/docs/ratelimiting.
139
139
  Add to Gemfile:
140
140
 
141
141
  ```ruby
142
- gem 'snaptrade', '~> 3.0.17'
142
+ gem 'snaptrade', '~> 3.0.19'
143
143
  ```
144
144
 
145
145
  ## Getting Started<a id="getting-started"></a>
@@ -307,7 +307,9 @@ p result
307
307
 
308
308
  Returns a list of all positions in the specified account.
309
309
 
310
- The `results` 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 `instrument.kind` discriminator to determine the schema for each position's `instrument`.
310
+ The `results` 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 `instrument.kind` discriminator to determine the schema for each position's `instrument`.
311
+
312
+ **Beta:** future option positions (`instrument.kind: future_option`) 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 `FutureOptionInstrument` schema may change.
311
313
 
312
314
  Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`, and `crypto` positions may include `tax_lots` 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).
313
315
 
@@ -2090,6 +2092,22 @@ Please refer to the [brokerage trading support page](https://support.snaptrade.c
2090
2092
  - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order.
2091
2093
  - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
2092
2094
 
2095
+ Option OCO peers must trade the same OCC option symbol with the same closing
2096
+ action and positive whole-contract quantity.
2097
+
2098
+ On tastytrade, option OCO supports closing an existing long or short option
2099
+ position with one `Limit` order and one `Stop` or `StopLimit` order. Both
2100
+ `PEER` orders must use `SELL_TO_CLOSE` or both must use `BUY_TO_CLOSE`, with
2101
+ `Day` or `GTC` time in force. Opening option OCOs are not supported.
2102
+
2103
+ On enabled Webull US v3 accounts, option OCO supports closing an existing long
2104
+ option position with one `Limit` take-profit order and one `Stop` stop-loss order.
2105
+ Both `PEER` orders must use `SELL_TO_CLOSE`, `Day`, the same OCC option symbol,
2106
+ and the same positive whole-contract quantity. Webull receives these as
2107
+ `STOP_PROFIT` and `STOP_LOSS` orders sharing a combo ID, without a MASTER order.
2108
+ Opening option OCOs, `BUY_TO_CLOSE`, `StopLimit`, and other option order pairs
2109
+ are not supported on Webull. Equity complex-order behavior is unchanged.
2110
+
2093
2111
 
2094
2112
  #### 🛠️ Usage<a id="🛠️-usage"></a>
2095
2113
 
@@ -290,7 +290,9 @@ module SnapTrade
290
290
  #
291
291
  # Returns a list of all positions in the specified account.
292
292
  #
293
- # The `results` 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 `instrument.kind` discriminator to determine the schema for each position's `instrument`.
293
+ # The `results` 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 `instrument.kind` discriminator to determine the schema for each position's `instrument`.
294
+ #
295
+ # **Beta:** future option positions (`instrument.kind: future_option`) 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 `FutureOptionInstrument` schema may change.
294
296
  #
295
297
  # Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`, and `crypto` positions may include `tax_lots` 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).
296
298
  #
@@ -309,7 +311,9 @@ module SnapTrade
309
311
  #
310
312
  # Returns a list of all positions in the specified account.
311
313
  #
312
- # The `results` 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 `instrument.kind` discriminator to determine the schema for each position's `instrument`.
314
+ # The `results` 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 `instrument.kind` discriminator to determine the schema for each position's `instrument`.
315
+ #
316
+ # **Beta:** future option positions (`instrument.kind: future_option`) 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 `FutureOptionInstrument` schema may change.
313
317
  #
314
318
  # Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`, and `crypto` positions may include `tax_lots` 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).
315
319
  #
@@ -324,7 +328,7 @@ module SnapTrade
324
328
  end
325
329
 
326
330
  # List all account positions
327
- # Returns a list of all positions in the specified account. The `results` 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 `instrument.kind` discriminator to determine the schema for each position's `instrument`. Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`, and `crypto` positions may include `tax_lots` 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.
331
+ # Returns a list of all positions in the specified account. The `results` 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 `instrument.kind` discriminator to determine the schema for each position's `instrument`. **Beta:** future option positions (`instrument.kind: future_option`) 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 `FutureOptionInstrument` schema may change. Positions counted in account cash balance or buying power include `cash_equivalent: true`. `stock`, `adr`, `etf`, `mutualfund`, and `crypto` positions may include `tax_lots` 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.
328
332
  # @param user_id [String]
329
333
  # @param user_secret [String]
330
334
  # @param account_id [String]
@@ -336,7 +340,7 @@ module SnapTrade
336
340
  end
337
341
 
338
342
  # List all account positions
339
- # 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.
343
+ # 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.
340
344
  # @param user_id [String]
341
345
  # @param user_secret [String]
342
346
  # @param account_id [String]
@@ -804,6 +804,22 @@ module SnapTrade
804
804
  # - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled.
805
805
  # - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order.
806
806
  # - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
807
+ #
808
+ # Option OCO peers must trade the same OCC option symbol with the same closing
809
+ # action and positive whole-contract quantity.
810
+ #
811
+ # On tastytrade, option OCO supports closing an existing long or short option
812
+ # position with one `Limit` order and one `Stop` or `StopLimit` order. Both
813
+ # `PEER` orders must use `SELL_TO_CLOSE` or both must use `BUY_TO_CLOSE`, with
814
+ # `Day` or `GTC` time in force. Opening option OCOs are not supported.
815
+ #
816
+ # On enabled Webull US v3 accounts, option OCO supports closing an existing long
817
+ # option position with one `Limit` take-profit order and one `Stop` stop-loss order.
818
+ # Both `PEER` orders must use `SELL_TO_CLOSE`, `Day`, the same OCC option symbol,
819
+ # and the same positive whole-contract quantity. Webull receives these as
820
+ # `STOP_PROFIT` and `STOP_LOSS` orders sharing a combo ID, without a MASTER order.
821
+ # Opening option OCOs, `BUY_TO_CLOSE`, `StopLimit`, and other option order pairs
822
+ # are not supported on Webull. Equity complex-order behavior is unchanged.
807
823
  #
808
824
  # @param type [ManualTradeFormComplexType] The complex order type. - `OCO`: One Cancels the Other — two peer orders. - `OTO`: One Triggers the Other — a trigger order and a conditional order. - `OTOCO`: One Triggers a One Cancels the Other — a trigger order and two peer orders.
809
825
  # @param orders [Array<ComplexOrderLeg>] The orders that make up the complex order. Required counts and roles per type: - `OCO`: exactly 2 orders, both `PEER` - `OTO`: exactly 2 orders, one `TRIGGER` and one `CONDITIONAL` - `OTOCO`: exactly 3 orders, one `TRIGGER` and two `PEER`
@@ -832,6 +848,22 @@ module SnapTrade
832
848
  # - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled.
833
849
  # - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order.
834
850
  # - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
851
+ #
852
+ # Option OCO peers must trade the same OCC option symbol with the same closing
853
+ # action and positive whole-contract quantity.
854
+ #
855
+ # On tastytrade, option OCO supports closing an existing long or short option
856
+ # position with one `Limit` order and one `Stop` or `StopLimit` order. Both
857
+ # `PEER` orders must use `SELL_TO_CLOSE` or both must use `BUY_TO_CLOSE`, with
858
+ # `Day` or `GTC` time in force. Opening option OCOs are not supported.
859
+ #
860
+ # On enabled Webull US v3 accounts, option OCO supports closing an existing long
861
+ # option position with one `Limit` take-profit order and one `Stop` stop-loss order.
862
+ # Both `PEER` orders must use `SELL_TO_CLOSE`, `Day`, the same OCC option symbol,
863
+ # and the same positive whole-contract quantity. Webull receives these as
864
+ # `STOP_PROFIT` and `STOP_LOSS` orders sharing a combo ID, without a MASTER order.
865
+ # Opening option OCOs, `BUY_TO_CLOSE`, `StopLimit`, and other option order pairs
866
+ # are not supported on Webull. Equity complex-order behavior is unchanged.
835
867
  #
836
868
  # @param type [ManualTradeFormComplexType] The complex order type. - `OCO`: One Cancels the Other — two peer orders. - `OTO`: One Triggers the Other — a trigger order and a conditional order. - `OTOCO`: One Triggers a One Cancels the Other — a trigger order and two peer orders.
837
869
  # @param orders [Array<ComplexOrderLeg>] The orders that make up the complex order. Required counts and roles per type: - `OCO`: exactly 2 orders, both `PEER` - `OTO`: exactly 2 orders, one `TRIGGER` and one `CONDITIONAL` - `OTOCO`: exactly 3 orders, one `TRIGGER` and two `PEER`
@@ -851,7 +883,7 @@ module SnapTrade
851
883
  end
852
884
 
853
885
  # Place complex order
854
- # Places a complex conditional order (OCO, OTO, or OTOCO). Only supported on certain brokerages. Please refer to the [brokerage trading support page](https://support.snaptrade.com/brokerages) for details on which brokerages support complex orders and which types they support. - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled. - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order. - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
886
+ # Places a complex conditional order (OCO, OTO, or OTOCO). Only supported on certain brokerages. Please refer to the [brokerage trading support page](https://support.snaptrade.com/brokerages) for details on which brokerages support complex orders and which types they support. - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled. - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order. - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders. Option OCO peers must trade the same OCC option symbol with the same closing action and positive whole-contract quantity. On tastytrade, option OCO supports closing an existing long or short option position with one `Limit` order and one `Stop` or `StopLimit` order. Both `PEER` orders must use `SELL_TO_CLOSE` or both must use `BUY_TO_CLOSE`, with `Day` or `GTC` time in force. Opening option OCOs are not supported. On enabled Webull US v3 accounts, option OCO supports closing an existing long option position with one `Limit` take-profit order and one `Stop` stop-loss order. Both `PEER` orders must use `SELL_TO_CLOSE`, `Day`, the same OCC option symbol, and the same positive whole-contract quantity. Webull receives these as `STOP_PROFIT` and `STOP_LOSS` orders sharing a combo ID, without a MASTER order. Opening option OCOs, `BUY_TO_CLOSE`, `StopLimit`, and other option order pairs are not supported on Webull. Equity complex-order behavior is unchanged.
855
887
  # @param account_id [String] The ID of the account to execute the trade on.
856
888
  # @param user_id [String]
857
889
  # @param user_secret [String]
@@ -864,7 +896,7 @@ module SnapTrade
864
896
  end
865
897
 
866
898
  # Place complex order
867
- # Places a complex conditional order (OCO, OTO, or OTOCO). Only supported on certain brokerages. Please refer to the [brokerage trading support page](https://support.snaptrade.com/brokerages) for details on which brokerages support complex orders and which types they support. - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled. - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order. - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders.
899
+ # Places a complex conditional order (OCO, OTO, or OTOCO). Only supported on certain brokerages. Please refer to the [brokerage trading support page](https://support.snaptrade.com/brokerages) for details on which brokerages support complex orders and which types they support. - **OCO** (One Cancels the Other): Two peer orders; when one fills the other is cancelled. - **OTO** (One Triggers the Other): A trigger order that, when filled, activates a conditional order. - **OTOCO** (One Triggers a One Cancels the Other): A trigger order that, when filled, activates an OCO pair of two peer orders. Option OCO peers must trade the same OCC option symbol with the same closing action and positive whole-contract quantity. On tastytrade, option OCO supports closing an existing long or short option position with one &#x60;Limit&#x60; order and one &#x60;Stop&#x60; or &#x60;StopLimit&#x60; order. Both &#x60;PEER&#x60; orders must use &#x60;SELL_TO_CLOSE&#x60; or both must use &#x60;BUY_TO_CLOSE&#x60;, with &#x60;Day&#x60; or &#x60;GTC&#x60; time in force. Opening option OCOs are not supported. On enabled Webull US v3 accounts, option OCO supports closing an existing long option position with one &#x60;Limit&#x60; take-profit order and one &#x60;Stop&#x60; stop-loss order. Both &#x60;PEER&#x60; orders must use &#x60;SELL_TO_CLOSE&#x60;, &#x60;Day&#x60;, the same OCC option symbol, and the same positive whole-contract quantity. Webull receives these as &#x60;STOP_PROFIT&#x60; and &#x60;STOP_LOSS&#x60; orders sharing a combo ID, without a MASTER order. Opening option OCOs, &#x60;BUY_TO_CLOSE&#x60;, &#x60;StopLimit&#x60;, and other option order pairs are not supported on Webull. Equity complex-order behavior is unchanged.
868
900
  # @param account_id [String] The ID of the account to execute the trade on.
869
901
  # @param user_id [String]
870
902
  # @param user_secret [String]
@@ -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