snaptrade 3.0.51 → 3.0.53

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.
@@ -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
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '3.0.51'
11
+ VERSION = '3.0.53'
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'
@@ -241,6 +240,7 @@ require 'snaptrade/models/position'
241
240
  require 'snaptrade/models/position_currency'
242
241
  require 'snaptrade/models/position_symbol'
243
242
  require 'snaptrade/models/price_effect'
243
+ require 'snaptrade/models/priced_in_instrument'
244
244
  require 'snaptrade/models/rate_of_return_object'
245
245
  require 'snaptrade/models/rate_of_return_response'
246
246
  require 'snaptrade/models/recent_orders_response'
@@ -300,6 +300,7 @@ require 'snaptrade/models/trade_detection_subscription'
300
300
  require 'snaptrade/models/trading_get_user_account_option_quotes410_response'
301
301
  require 'snaptrade/models/trading_instrument'
302
302
  require 'snaptrade/models/trading_instrument_type'
303
+ require 'snaptrade/models/trading_place_simple_order409_response'
303
304
  require 'snaptrade/models/trading_search_cryptocurrency_pair_instruments200_response'
304
305
  require 'snaptrade/models/trading_session'
305
306
  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 `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, CFD positions, and tokenized asset 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.
93
+ # 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, CFD positions, and tokenized asset 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`. Security positions (`stock`, `adr`, `etf`, `mutualfund`, `cef`, `crypto`, `bond`, and `other`) may include `tax_lots` 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 and future options are currently 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. All string choices use lower snake_case and are case-sensitive. Symbols retain their native format: equity tickers, OCC equity-option symbols, or the exact tastytrade BrokerageInstrument ticker for futures and future options, including any spaces. 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'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 `ESZ26 C6000`, 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'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
@@ -11,13 +11,28 @@ require 'spec_helper'
11
11
  require 'json'
12
12
  require 'date'
13
13
 
14
- # Unit tests for SnapTrade::ManualTradeFormNotionalValue
15
- describe SnapTrade::ManualTradeFormNotionalValue do
16
- let(:instance) { SnapTrade::ManualTradeFormNotionalValue.new }
14
+ # Unit tests for SnapTrade::PricedInInstrument
15
+ describe SnapTrade::PricedInInstrument do
16
+ describe '.openapi_one_of' do
17
+ it 'lists the items referenced in the oneOf array' do
18
+ expect(described_class.openapi_one_of).to_not be_empty
19
+ end
20
+ end
21
+
22
+ describe '.openapi_discriminator_name' do
23
+ it 'returns the value of the "discriminator" property' do
24
+ expect(described_class.openapi_discriminator_name).to_not be_empty
25
+ end
26
+ end
27
+
28
+ describe '.openapi_discriminator_mapping' do
29
+ it 'returns the key/values of the "mapping" property' do
30
+ expect(described_class.openapi_discriminator_mapping.values.uniq.sort).to eq(described_class.openapi_one_of.sort)
31
+ end
32
+ end
17
33
 
18
- describe 'test an instance of ManualTradeFormNotionalValue' do
19
- it 'should create an instance of ManualTradeFormNotionalValue' do
20
- expect(instance).to be_instance_of(SnapTrade::ManualTradeFormNotionalValue)
34
+ describe '.build' do
35
+ it 'returns the correct model' do
21
36
  end
22
37
  end
23
38
  end
@@ -0,0 +1,41 @@
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::TradingPlaceSimpleOrder409Response
15
+ describe SnapTrade::TradingPlaceSimpleOrder409Response do
16
+ let(:instance) { SnapTrade::TradingPlaceSimpleOrder409Response.new }
17
+
18
+ describe 'test an instance of TradingPlaceSimpleOrder409Response' do
19
+ it 'should create an instance of TradingPlaceSimpleOrder409Response' do
20
+ expect(instance).to be_instance_of(SnapTrade::TradingPlaceSimpleOrder409Response)
21
+ end
22
+ end
23
+ describe 'test attribute "detail"' do
24
+ it 'should work' do
25
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
26
+ end
27
+ end
28
+
29
+ describe 'test attribute "status_code"' do
30
+ it 'should work' do
31
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
32
+ end
33
+ end
34
+
35
+ describe 'test attribute "code"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ end