snaptrade 2.0.204 → 2.0.205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,238 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
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
+ # Example for a rate-limited request response
15
+ class Model429TooManyRequestsResponse
16
+ attr_accessor :detail
17
+
18
+ attr_accessor :status_code
19
+
20
+ attr_accessor :code
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'detail' => :'detail',
26
+ :'status_code' => :'status_code',
27
+ :'code' => :'code'
28
+ }
29
+ end
30
+
31
+ # Returns all the JSON keys this model knows about
32
+ def self.acceptable_attributes
33
+ attribute_map.values
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'detail' => :'Object',
40
+ :'status_code' => :'Object',
41
+ :'code' => :'Object'
42
+ }
43
+ end
44
+
45
+ # List of attributes with nullable: true
46
+ def self.openapi_nullable
47
+ Set.new([
48
+ :'detail',
49
+ :'status_code',
50
+ :'code'
51
+ ])
52
+ end
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ def initialize(attributes = {})
57
+ if (!attributes.is_a?(Hash))
58
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::Model429TooManyRequestsResponse` initialize method"
59
+ end
60
+
61
+ # check to see if the attribute exists and convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}) { |(k, v), h|
63
+ if (!self.class.attribute_map.key?(k.to_sym))
64
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::Model429TooManyRequestsResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ end
66
+ h[k.to_sym] = v
67
+ }
68
+
69
+ if attributes.key?(:'detail')
70
+ self.detail = attributes[:'detail']
71
+ end
72
+
73
+ if attributes.key?(:'status_code')
74
+ self.status_code = attributes[:'status_code']
75
+ end
76
+
77
+ if attributes.key?(:'code')
78
+ self.code = attributes[:'code']
79
+ end
80
+ end
81
+
82
+ # Show invalid properties with the reasons. Usually used together with valid?
83
+ # @return Array for valid properties with the reasons
84
+ def list_invalid_properties
85
+ invalid_properties = Array.new
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ detail == o.detail &&
101
+ status_code == o.status_code &&
102
+ code == o.code
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [detail, status_code, code].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ new.build_from_hash(attributes)
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ attributes = attributes.transform_keys(&:to_sym)
130
+ self.class.openapi_types.each_pair do |key, type|
131
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
132
+ self.send("#{key}=", nil)
133
+ elsif type =~ /\AArray<(.*)>/i
134
+ # check to ensure the input is an array given that the attribute
135
+ # is documented as an array but the input is not
136
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
137
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
138
+ end
139
+ elsif !attributes[self.class.attribute_map[key]].nil?
140
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
141
+ end
142
+ end
143
+
144
+ self
145
+ end
146
+
147
+ # Deserializes the data based on type
148
+ # @param string type Data type
149
+ # @param string value Value to be deserialized
150
+ # @return [Object] Deserialized data
151
+ def _deserialize(type, value)
152
+ case type.to_sym
153
+ when :Time
154
+ Time.parse(value)
155
+ when :Date
156
+ Date.parse(value)
157
+ when :String
158
+ value.to_s
159
+ when :Integer
160
+ value.to_i
161
+ when :Float
162
+ value.to_f
163
+ when :Boolean
164
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
165
+ true
166
+ else
167
+ false
168
+ end
169
+ when :Object
170
+ # generic object (usually a Hash), return directly
171
+ value
172
+ when /\AArray<(?<inner_type>.+)>\z/
173
+ inner_type = Regexp.last_match[:inner_type]
174
+ value.map { |v| _deserialize(inner_type, v) }
175
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
176
+ k_type = Regexp.last_match[:k_type]
177
+ v_type = Regexp.last_match[:v_type]
178
+ {}.tap do |hash|
179
+ value.each do |k, v|
180
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
181
+ end
182
+ end
183
+ else # model
184
+ # models (e.g. Pet) or oneOf
185
+ klass = SnapTrade.const_get(type)
186
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
187
+ end
188
+ end
189
+
190
+ # Returns the string representation of the object
191
+ # @return [String] String presentation of the object
192
+ def to_s
193
+ to_hash.to_s
194
+ end
195
+
196
+ # to_body is an alias to to_hash (backward compatibility)
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_body
199
+ to_hash
200
+ end
201
+
202
+ # Returns the object in the form of hash
203
+ # @return [Hash] Returns the object in the form of hash
204
+ def to_hash
205
+ hash = {}
206
+ self.class.attribute_map.each_pair do |attr, param|
207
+ value = self.send(attr)
208
+ if value.nil?
209
+ is_nullable = self.class.openapi_nullable.include?(attr)
210
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
211
+ end
212
+
213
+ hash[param] = _to_hash(value)
214
+ end
215
+ hash
216
+ end
217
+
218
+ # Outputs non-array value in the form of hash
219
+ # For object, use to_hash. Otherwise, just return the value
220
+ # @param [Object] value Any valid value
221
+ # @return [Hash] Returns the value in the form of hash
222
+ def _to_hash(value)
223
+ if value.is_a?(Array)
224
+ value.compact.map { |v| _to_hash(v) }
225
+ elsif value.is_a?(Hash)
226
+ {}.tap do |hash|
227
+ value.each { |k, v| hash[k] = _to_hash(v) }
228
+ end
229
+ elsif value.respond_to? :to_hash
230
+ value.to_hash
231
+ else
232
+ value
233
+ end
234
+ end
235
+
236
+ end
237
+
238
+ end
@@ -35,7 +35,7 @@ module SnapTrade
35
35
  # If the position is a cash equivalent (usually a money market fund) that is also counted in account cash balance and buying power
36
36
  attr_accessor :cash_equivalent
37
37
 
38
- # List of tax lots for the given position (disabled by default, contact support if needed)
38
+ # List of tax lots for the given position (disabled by default, only available on paid plans, contact support if needed)
39
39
  attr_accessor :tax_lots
40
40
 
41
41
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -20,6 +20,8 @@ module SnapTrade
20
20
 
21
21
  attr_accessor :symbol
22
22
 
23
+ attr_accessor :currency_universal_symbol
24
+
23
25
  attr_accessor :option_symbol
24
26
 
25
27
  # The price of the security for the transaction. This is mostly applicable to `BUY`, `SELL`, and `DIVIDEND` transactions.
@@ -66,6 +68,7 @@ module SnapTrade
66
68
  :'id' => :'id',
67
69
  :'account' => :'account',
68
70
  :'symbol' => :'symbol',
71
+ :'currency_universal_symbol' => :'currency_universal_symbol',
69
72
  :'option_symbol' => :'option_symbol',
70
73
  :'price' => :'price',
71
74
  :'units' => :'units',
@@ -94,6 +97,7 @@ module SnapTrade
94
97
  :'id' => :'String',
95
98
  :'account' => :'AccountSimple',
96
99
  :'symbol' => :'AccountUniversalActivitySymbol',
100
+ :'currency_universal_symbol' => :'AccountUniversalActivityCurrencyUniversalSymbol',
97
101
  :'option_symbol' => :'AccountUniversalActivityOptionSymbol',
98
102
  :'price' => :'Float',
99
103
  :'units' => :'Float',
@@ -115,8 +119,10 @@ module SnapTrade
115
119
  def self.openapi_nullable
116
120
  Set.new([
117
121
  :'symbol',
122
+ :'currency_universal_symbol',
118
123
  :'option_symbol',
119
124
  :'amount',
125
+ :'currency',
120
126
  :'trade_date',
121
127
  :'fx_rate',
122
128
  :'external_reference_id'
@@ -150,6 +156,10 @@ module SnapTrade
150
156
  self.symbol = attributes[:'symbol']
151
157
  end
152
158
 
159
+ if attributes.key?(:'currency_universal_symbol')
160
+ self.currency_universal_symbol = attributes[:'currency_universal_symbol']
161
+ end
162
+
153
163
  if attributes.key?(:'option_symbol')
154
164
  self.option_symbol = attributes[:'option_symbol']
155
165
  end
@@ -228,6 +238,7 @@ module SnapTrade
228
238
  id == o.id &&
229
239
  account == o.account &&
230
240
  symbol == o.symbol &&
241
+ currency_universal_symbol == o.currency_universal_symbol &&
231
242
  option_symbol == o.option_symbol &&
232
243
  price == o.price &&
233
244
  units == o.units &&
@@ -253,7 +264,7 @@ module SnapTrade
253
264
  # Calculates hash code according to all attributes.
254
265
  # @return [Integer] Hash code
255
266
  def hash
256
- [id, account, symbol, option_symbol, price, units, amount, currency, type, option_type, description, trade_date, settlement_date, fee, fx_rate, institution, external_reference_id].hash
267
+ [id, account, symbol, currency_universal_symbol, option_symbol, price, units, amount, currency, type, option_type, description, trade_date, settlement_date, fee, fx_rate, institution, external_reference_id].hash
257
268
  end
258
269
 
259
270
  # Builds the object from hash
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.204'
11
+ VERSION = '2.0.205'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -42,6 +42,7 @@ require 'snaptrade/models/account_status'
42
42
  require 'snaptrade/models/account_sync_status'
43
43
  require 'snaptrade/models/account_universal_activity'
44
44
  require 'snaptrade/models/account_universal_activity_currency'
45
+ require 'snaptrade/models/account_universal_activity_currency_universal_symbol'
45
46
  require 'snaptrade/models/account_universal_activity_option_symbol'
46
47
  require 'snaptrade/models/account_universal_activity_symbol'
47
48
  require 'snaptrade/models/account_value_history_item'
@@ -136,6 +137,7 @@ require 'snaptrade/models/model403_failed_request_response'
136
137
  require 'snaptrade/models/model403_feature_not_enabled_response'
137
138
  require 'snaptrade/models/model404_failed_request_response'
138
139
  require 'snaptrade/models/model425_failed_request_response'
140
+ require 'snaptrade/models/model429_too_many_requests_response'
139
141
  require 'snaptrade/models/model500_unexpected_exception_response'
140
142
  require 'snaptrade/models/monthly_dividends'
141
143
  require 'snaptrade/models/mutual_fund_instrument'
@@ -98,7 +98,7 @@ describe 'ConnectionsApi' do
98
98
 
99
99
  # unit tests for refresh_brokerage_authorization
100
100
  # Refresh holdings for a connection
101
- # Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [&#x60;ACCOUNT_HOLDINGS_UPDATED&#x60; webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred. **Because of the cost of refreshing a connection, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)** **Please note this endpoint is disabled for Personal and Pay as you Go Real-time plans. Real-time plans do not benefit from this feature since data is refreshed when calls are made**
101
+ # Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [&#x60;ACCOUNT_HOLDINGS_UPDATED&#x60; webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred. **Because of the cost of refreshing a connection, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)** **Please note this endpoint is disabled for Real-time plans (Personal and Pay as you go) unless the connection is delayed. Real-time connections do not benefit from this feature since data is refreshed when calls are made. Refer to the &#x60;data_freshness_mode&#x60; field on a connection to determine this.**
102
102
  # @param authorization_id
103
103
  # @param user_id
104
104
  # @param user_secret
@@ -149,7 +149,7 @@ describe 'TradingApi' do
149
149
 
150
150
  # unit tests for place_complex_order
151
151
  # Place complex order
152
- # Places a complex conditional order (OCO, OTO, or OTOCO). Disabled by default — contact support to enable. 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.
152
+ # 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.
153
153
  # @param account_id The ID of the account to execute the trade on.
154
154
  # @param user_id
155
155
  # @param user_secret
@@ -0,0 +1,77 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
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::AccountUniversalActivityCurrencyUniversalSymbol
15
+ describe SnapTrade::AccountUniversalActivityCurrencyUniversalSymbol do
16
+ let(:instance) { SnapTrade::AccountUniversalActivityCurrencyUniversalSymbol.new }
17
+
18
+ describe 'test an instance of AccountUniversalActivityCurrencyUniversalSymbol' do
19
+ it 'should create an instance of AccountUniversalActivityCurrencyUniversalSymbol' do
20
+ expect(instance).to be_instance_of(SnapTrade::AccountUniversalActivityCurrencyUniversalSymbol)
21
+ end
22
+ end
23
+ describe 'test attribute "id"' 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 "symbol"' 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 "raw_symbol"' 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
+ describe 'test attribute "description"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "currency"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ describe 'test attribute "exchange"' do
54
+ it 'should work' do
55
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
+ end
57
+ end
58
+
59
+ describe 'test attribute "type"' do
60
+ it 'should work' do
61
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
+ end
63
+ end
64
+
65
+ describe 'test attribute "figi_code"' do
66
+ it 'should work' do
67
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
68
+ end
69
+ end
70
+
71
+ describe 'test attribute "figi_instrument"' do
72
+ it 'should work' do
73
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
74
+ end
75
+ end
76
+
77
+ end
@@ -32,6 +32,12 @@ describe SnapTrade::AccountUniversalActivity do
32
32
  end
33
33
  end
34
34
 
35
+ describe 'test attribute "currency_universal_symbol"' 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
+
35
41
  describe 'test attribute "option_symbol"' do
36
42
  it 'should work' do
37
43
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
@@ -80,4 +80,10 @@ describe SnapTrade::BrokerageAuthorization do
80
80
  end
81
81
  end
82
82
 
83
+ describe 'test attribute "data_freshness_mode"' do
84
+ it 'should work' do
85
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
86
+ end
87
+ end
88
+
83
89
  end
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #SnapTrade
3
+
4
+ #Connect brokerage accounts to your app for live positions and trading
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::Model429TooManyRequestsResponse
15
+ describe SnapTrade::Model429TooManyRequestsResponse do
16
+ let(:instance) { SnapTrade::Model429TooManyRequestsResponse.new }
17
+
18
+ describe 'test an instance of Model429TooManyRequestsResponse' do
19
+ it 'should create an instance of Model429TooManyRequestsResponse' do
20
+ expect(instance).to be_instance_of(SnapTrade::Model429TooManyRequestsResponse)
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
@@ -38,6 +38,12 @@ describe SnapTrade::UniversalActivity do
38
38
  end
39
39
  end
40
40
 
41
+ describe 'test attribute "currency_universal_symbol"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
41
47
  describe 'test attribute "option_symbol"' do
42
48
  it 'should work' do
43
49
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers