snaptrade 2.0.33 → 2.0.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/README.md +81 -54
  4. data/lib/snaptrade/api/account_information_api.rb +74 -56
  5. data/lib/snaptrade/api/authentication_api.rb +44 -46
  6. data/lib/snaptrade/api/connections_api.rb +8 -8
  7. data/lib/snaptrade/api/options_api.rb +16 -12
  8. data/lib/snaptrade/api/transactions_and_reporting_api.rb +36 -28
  9. data/lib/snaptrade/models/account.rb +11 -2
  10. data/lib/snaptrade/models/account_balance_total.rb +1 -8
  11. data/lib/snaptrade/models/account_holdings_account.rb +1 -1
  12. data/lib/snaptrade/models/account_order_record.rb +1 -1
  13. data/lib/snaptrade/models/account_order_record_universal_symbol.rb +2 -2
  14. data/lib/snaptrade/models/account_simple.rb +4 -1
  15. data/lib/snaptrade/models/account_sync_status.rb +1 -1
  16. data/lib/snaptrade/models/balance.rb +1 -1
  17. data/lib/snaptrade/models/{snap_trade_holdings_account_account_id_balance.rb → balance_currency.rb} +33 -12
  18. data/lib/snaptrade/models/delete_user_response.rb +12 -3
  19. data/lib/snaptrade/models/holdings_status.rb +4 -4
  20. data/lib/snaptrade/models/login_redirect_uri.rb +3 -2
  21. data/lib/snaptrade/models/snap_trade_login_user_request_body.rb +10 -6
  22. data/lib/snaptrade/models/symbol.rb +16 -10
  23. data/lib/snaptrade/models/{universal_symbol_currency.rb → symbol_currency.rb} +3 -3
  24. data/lib/snaptrade/models/{universal_symbol_exchange.rb → symbol_exchange.rb} +3 -3
  25. data/lib/snaptrade/models/transactions_status.rb +4 -5
  26. data/lib/snaptrade/models/underlying_symbol.rb +1 -1
  27. data/lib/snaptrade/models/universal_activity.rb +91 -81
  28. data/lib/snaptrade/models/{amount.rb → universal_activity_currency.rb} +36 -19
  29. data/lib/snaptrade/models/{snap_trade_holdings_account_account_id.rb → universal_activity_option_symbol.rb} +83 -82
  30. data/lib/snaptrade/models/universal_activity_symbol.rb +304 -0
  31. data/lib/snaptrade/models/universal_symbol.rb +2 -2
  32. data/lib/snaptrade/models/user_i_dand_secret.rb +1 -1
  33. data/lib/snaptrade/version.rb +1 -1
  34. data/lib/snaptrade.rb +6 -5
  35. data/spec/api/account_information_api_spec.rb +13 -13
  36. data/spec/api/authentication_api_spec.rb +7 -7
  37. data/spec/api/connections_api_spec.rb +2 -2
  38. data/spec/api/options_api_spec.rb +3 -3
  39. data/spec/api/transactions_and_reporting_api_spec.rb +7 -7
  40. data/spec/models/{universal_symbol_currency_spec.rb → balance_currency_spec.rb} +6 -6
  41. data/spec/models/delete_user_response_spec.rb +6 -0
  42. data/spec/models/symbol_currency_spec.rb +41 -0
  43. data/spec/models/{universal_symbol_exchange_spec.rb → symbol_exchange_spec.rb} +6 -6
  44. data/spec/models/symbol_spec.rb +1 -1
  45. data/spec/models/universal_activity_currency_spec.rb +41 -0
  46. data/spec/models/universal_activity_option_symbol_spec.rb +65 -0
  47. data/spec/models/universal_activity_spec.rb +15 -15
  48. data/spec/models/{snap_trade_holdings_account_account_id_spec.rb → universal_activity_symbol_spec.rb} +14 -20
  49. metadata +20 -17
  50. data/spec/models/amount_spec.rb +0 -35
  51. data/spec/models/snap_trade_holdings_account_account_id_balance_spec.rb +0 -29
@@ -13,22 +13,22 @@ require 'time'
13
13
  module SnapTrade
14
14
  # Data to login a user via SnapTrade Partner
15
15
  class SnapTradeLoginUserRequestBody
16
- # Slug of the brokerage to connect the user to. See [this document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead) for a list of supported brokerages and their slugs.
16
+ # Slug of the brokerage to connect the user to. See [the integrations page](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=3cfea70ef4254afc89704e47275a7a9a&pvs=4) for a list of supported brokerages and their slugs.
17
17
  attr_accessor :broker
18
18
 
19
- # When set to True, user will be redirected back to the partner's site instead of the connection portal
19
+ # When set to `true`, user will be redirected back to the partner's site instead of the connection portal. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](https://docs.snaptrade.com/docs/implement-connection-portal) for more information.
20
20
  attr_accessor :immediate_redirect
21
21
 
22
- # URL to redirect the user to after the user connects their brokerage account
22
+ # URL to redirect the user to after the user connects their brokerage account. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](https://docs.snaptrade.com/docs/implement-connection-portal) for more information.
23
23
  attr_accessor :custom_redirect
24
24
 
25
- # The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See ‘Reconnecting Accounts’ for more information.
25
+ # The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See the [guide on fixing broken connections](https://docs.snaptrade.com/docs/fix-broken-connections) for more information.
26
26
  attr_accessor :reconnect
27
27
 
28
- # Sets whether the connection should be read or trade
28
+ # Sets whether the connection should be read-only or trade-enabled.
29
29
  attr_accessor :connection_type
30
30
 
31
- # Sets the version of the connection portal to render, with a default to 'v3'
31
+ # Sets the version of the connection portal to render.
32
32
  attr_accessor :connection_portal_version
33
33
 
34
34
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -99,10 +99,14 @@ module SnapTrade
99
99
 
100
100
  if attributes.key?(:'connection_type')
101
101
  self.connection_type = attributes[:'connection_type']
102
+ else
103
+ self.connection_type = 'read'
102
104
  end
103
105
 
104
106
  if attributes.key?(:'connection_portal_version')
105
107
  self.connection_portal_version = attributes[:'connection_portal_version']
108
+ else
109
+ self.connection_portal_version = 'v3'
106
110
  end
107
111
  end
108
112
 
@@ -11,15 +11,19 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module SnapTrade
14
- # Symbol
14
+ # Uniquely describes a single security + exchange combination across all brokerages.
15
15
  class Symbol
16
+ # Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
16
17
  attr_accessor :id
17
18
 
19
+ # The security's trading ticker symbol. For example \"AAPL\" for Apple Inc. We largely follow the [Yahoo Finance ticker format](https://help.yahoo.com/kb/SLN2310.html)(click on \"Yahoo Finance Market Coverage and Data Delays\"). For example, for securities traded on the Toronto Stock Exchange, the symbol has a '.TO' suffix. For securities traded on NASDAQ or NYSE, the symbol does not have a suffix.
18
20
  attr_accessor :symbol
19
21
 
22
+ # The raw symbol is `symbol` with the exchange suffix removed. For example, if `symbol` is \"VAB.TO\", then `raw_symbol` is \"VAB\".
20
23
  attr_accessor :raw_symbol
21
24
 
22
- attr_accessor :name
25
+ # A human-readable description of the security. This is usually the company name or ETF name.
26
+ attr_accessor :description
23
27
 
24
28
  attr_accessor :currency
25
29
 
@@ -27,6 +31,7 @@ module SnapTrade
27
31
 
28
32
  attr_accessor :type
29
33
 
34
+ # This identifier is unique per security per trading venue. See section 1.4.1 of the [FIGI Standard](https://www.openfigi.com/assets/local/figi-allocation-rules.pdf) for more information. This value should be the same as the `figi_code` in the `figi_instrument` child property.
30
35
  attr_accessor :figi_code
31
36
 
32
37
  attr_accessor :figi_instrument
@@ -37,7 +42,7 @@ module SnapTrade
37
42
  :'id' => :'id',
38
43
  :'symbol' => :'symbol',
39
44
  :'raw_symbol' => :'raw_symbol',
40
- :'name' => :'name',
45
+ :'description' => :'description',
41
46
  :'currency' => :'currency',
42
47
  :'exchange' => :'exchange',
43
48
  :'type' => :'type',
@@ -57,9 +62,9 @@ module SnapTrade
57
62
  :'id' => :'String',
58
63
  :'symbol' => :'String',
59
64
  :'raw_symbol' => :'String',
60
- :'name' => :'String',
61
- :'currency' => :'Currency',
62
- :'exchange' => :'Exchange',
65
+ :'description' => :'String',
66
+ :'currency' => :'SymbolCurrency',
67
+ :'exchange' => :'SymbolExchange',
63
68
  :'type' => :'SecurityType',
64
69
  :'figi_code' => :'String',
65
70
  :'figi_instrument' => :'SymbolFigiInstrument'
@@ -69,6 +74,7 @@ module SnapTrade
69
74
  # List of attributes with nullable: true
70
75
  def self.openapi_nullable
71
76
  Set.new([
77
+ :'description',
72
78
  :'figi_code',
73
79
  :'figi_instrument'
74
80
  ])
@@ -101,8 +107,8 @@ module SnapTrade
101
107
  self.raw_symbol = attributes[:'raw_symbol']
102
108
  end
103
109
 
104
- if attributes.key?(:'name')
105
- self.name = attributes[:'name']
110
+ if attributes.key?(:'description')
111
+ self.description = attributes[:'description']
106
112
  end
107
113
 
108
114
  if attributes.key?(:'currency')
@@ -147,7 +153,7 @@ module SnapTrade
147
153
  id == o.id &&
148
154
  symbol == o.symbol &&
149
155
  raw_symbol == o.raw_symbol &&
150
- name == o.name &&
156
+ description == o.description &&
151
157
  currency == o.currency &&
152
158
  exchange == o.exchange &&
153
159
  type == o.type &&
@@ -164,7 +170,7 @@ module SnapTrade
164
170
  # Calculates hash code according to all attributes.
165
171
  # @return [Integer] Hash code
166
172
  def hash
167
- [id, symbol, raw_symbol, name, currency, exchange, type, figi_code, figi_instrument].hash
173
+ [id, symbol, raw_symbol, description, currency, exchange, type, figi_code, figi_instrument].hash
168
174
  end
169
175
 
170
176
  # Builds the object from hash
@@ -12,7 +12,7 @@ require 'time'
12
12
 
13
13
  module SnapTrade
14
14
  # The currency in which the security is traded.
15
- class UniversalSymbolCurrency
15
+ class SymbolCurrency
16
16
  # Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade.
17
17
  attr_accessor :id
18
18
 
@@ -62,13 +62,13 @@ module SnapTrade
62
62
  # @param [Hash] attributes Model attributes in the form of hash
63
63
  def initialize(attributes = {})
64
64
  if (!attributes.is_a?(Hash))
65
- fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::UniversalSymbolCurrency` initialize method"
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::SymbolCurrency` initialize method"
66
66
  end
67
67
 
68
68
  # check to see if the attribute exists and convert string to symbol for hash key
69
69
  attributes = attributes.each_with_object({}) { |(k, v), h|
70
70
  if (!self.class.attribute_map.key?(k.to_sym))
71
- fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::UniversalSymbolCurrency`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::SymbolCurrency`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
72
  end
73
73
  h[k.to_sym] = v
74
74
  }
@@ -12,7 +12,7 @@ require 'time'
12
12
 
13
13
  module SnapTrade
14
14
  # The exchange on which the security is listed and traded.
15
- class UniversalSymbolExchange
15
+ class SymbolExchange
16
16
  # Unique ID for the exchange in SnapTrade.
17
17
  attr_accessor :id
18
18
 
@@ -88,13 +88,13 @@ module SnapTrade
88
88
  # @param [Hash] attributes Model attributes in the form of hash
89
89
  def initialize(attributes = {})
90
90
  if (!attributes.is_a?(Hash))
91
- fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::UniversalSymbolExchange` initialize method"
91
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::SymbolExchange` initialize method"
92
92
  end
93
93
 
94
94
  # check to see if the attribute exists and convert string to symbol for hash key
95
95
  attributes = attributes.each_with_object({}) { |(k, v), h|
96
96
  if (!self.class.attribute_map.key?(k.to_sym))
97
- fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::UniversalSymbolExchange`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
97
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::SymbolExchange`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
98
98
  end
99
99
  h[k.to_sym] = v
100
100
  }
@@ -11,14 +11,15 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module SnapTrade
14
- # Status of account transaction sync
14
+ # Status of account transaction sync. SnapTrade syncs transactions from the brokerage under the following conditions: 1. Initial connection - SnapTrade syncs all transactions from the brokerage account as far back as the brokerage allows. Check [our integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=6fab8012ade6441fa0c6d9af9c55ce3a) for details on how far back we sync for each brokerage. 2. Daily sync - Once a day SnapTrade syncs new transactions from the brokerage. 3. Manual sync - You can retrigger an incremental sync of transactions with the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
15
15
  class TransactionsStatus
16
+ # Indicates if the initial sync of transactions has been completed. For accounts with a large number of transactions, the initial sync may take a while to complete.
16
17
  attr_accessor :initial_sync_completed
17
18
 
18
- # Date in YYYY-MM-DD format or null
19
+ # All transactions up to this date have been successfully synced. Please note that this is not the date of the last transaction, nor the last time SnapTrade attempted to sync transactions.
19
20
  attr_accessor :last_successful_sync
20
21
 
21
- # Date in YYYY-MM-DD format or null
22
+ # The date of the first transaction in the account known to SnapTrade. It's possible that the account has transactions before this date, but they are not known to SnapTrade.
22
23
  attr_accessor :first_transaction_date
23
24
 
24
25
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -47,8 +48,6 @@ module SnapTrade
47
48
  # List of attributes with nullable: true
48
49
  def self.openapi_nullable
49
50
  Set.new([
50
- :'last_successful_sync',
51
- :'first_transaction_date'
52
51
  ])
53
52
  end
54
53
 
@@ -67,7 +67,7 @@ module SnapTrade
67
67
  :'symbol' => :'String',
68
68
  :'raw_symbol' => :'String',
69
69
  :'description' => :'String',
70
- :'currency' => :'UniversalSymbolCurrency',
70
+ :'currency' => :'SymbolCurrency',
71
71
  :'exchange' => :'UnderlyingSymbolExchange',
72
72
  :'type' => :'UnderlyingSymbolType',
73
73
  :'currencies' => :'Array<Currency>',
@@ -13,65 +13,73 @@ require 'time'
13
13
  module SnapTrade
14
14
  # A transaction or activity from an institution
15
15
  class UniversalActivity
16
+ # Unique identifier for the transaction. This is the ID used to reference the transaction in SnapTrade. Please note that this ID _can_ change if the transaction is deleted and re-added. Under normal circumstances, SnapTrade does not delete transactions. The only time this would happen is if SnapTrade re-fetches and reprocesses the data from the brokerage, which is rare. If you require a stable ID, please let us know and we can work with you to provide one.
16
17
  attr_accessor :id
17
18
 
18
19
  attr_accessor :account
19
20
 
20
- attr_accessor :amount
21
+ attr_accessor :symbol
21
22
 
22
- attr_accessor :currency
23
+ attr_accessor :option_symbol
23
24
 
24
- attr_accessor :description
25
+ # The price of the security for the transaction. This is mostly applicable to `BUY`, `SELL`, and `DIVIDEND` transactions.
26
+ attr_accessor :price
25
27
 
26
- attr_accessor :fee
28
+ # The number of units of the security for the transaction. This is mostly applicable to `BUY`, `SELL`, and `DIVIDEND` transactions.
29
+ attr_accessor :units
27
30
 
28
- # The forex conversion rate involved in the transaction if provided by the brokerage. Used in cases where securities of one currency are purchased in a different currency, and the forex conversion is automatic. In those cases, price, amount and fee will be in the top level currency (activity -> currency)
29
- attr_accessor :fx_rate
31
+ # The amount of the transaction denominated in `currency`. This can be positive or negative. In general, transactions that positively affect the account balance (like sell, deposits, dividends, etc) will have a positive amount, while transactions that negatively affect the account balance (like buy, withdrawals, fees, etc) will have a negative amount.
32
+ attr_accessor :amount
30
33
 
31
- attr_accessor :institution
34
+ attr_accessor :currency
32
35
 
33
- # If an option transaction, then it's type (BUY_TO_OPEN, SELL_TO_CLOSE, etc), otherwise empty string
34
- attr_accessor :option_type
36
+ # A string representing the type of transaction. SnapTrade does a best effort to categorize the brokerage transaction types into a common set of values. Here are some of the most popular values: - BUY - SELL - DIVIDEND - CONTRIBUTION - WITHDRAWAL - REI - INTEREST - FEE
37
+ attr_accessor :type
35
38
 
36
- attr_accessor :price
39
+ # If an option `BUY` or `SELL` transaction, this further specifies the type of action. The possible values are: - BUY_TO_OPEN - BUY_TO_CLOSE - SELL_TO_OPEN - SELL_TO_CLOSE
40
+ attr_accessor :option_type
37
41
 
38
- attr_accessor :settlement_date
42
+ # A human-readable description of the transaction. This is usually the brokerage's description of the transaction.
43
+ attr_accessor :description
39
44
 
40
- # Reference ID from brokerage used to identify related transactions. For example if an order comprises of several transactions (buy, fee, fx), they can be grouped if they share the same external_reference_id
41
- attr_accessor :external_reference_id
45
+ # The recorded time for the transaction. The granularity of this timestamp depends on the brokerage. Some brokerages provide the exact time of the transaction, while others provide only the date. Please check the [integrations page](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=6fab8012ade6441fa0c6d9af9c55ce3a) for the specific brokerage to see the granularity of the timestamps. Note that even though the field is named `trade_date`, it can represent any type of transaction, not just trades.
46
+ attr_accessor :trade_date
42
47
 
43
- attr_accessor :symbol
48
+ # The date on which the transaction is settled.
49
+ attr_accessor :settlement_date
44
50
 
45
- attr_accessor :option_symbol
51
+ # Any fee associated with the transaction if provided by the brokerage.
52
+ attr_accessor :fee
46
53
 
47
- attr_accessor :trade_date
54
+ # The forex conversion rate involved in the transaction if provided by the brokerage. Used in cases where securities of one currency are purchased in a different currency, and the forex conversion is automatic. In those cases, price, amount and fee will be in the top level currency (activity -> currency)
55
+ attr_accessor :fx_rate
48
56
 
49
- # Potential values include (but are not limited to) - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT
50
- attr_accessor :type
57
+ # The institution that the transaction is associated with. This is usually the brokerage name.
58
+ attr_accessor :institution
51
59
 
52
- # Usually but not necessarily an integer
53
- attr_accessor :units
60
+ # Reference ID from brokerage used to identify related transactions. For example if an order comprises of several transactions (buy, fee, fx), they can be grouped if they share the same `external_reference_id`
61
+ attr_accessor :external_reference_id
54
62
 
55
63
  # Attribute mapping from ruby-style variable name to JSON key.
56
64
  def self.attribute_map
57
65
  {
58
66
  :'id' => :'id',
59
67
  :'account' => :'account',
68
+ :'symbol' => :'symbol',
69
+ :'option_symbol' => :'option_symbol',
70
+ :'price' => :'price',
71
+ :'units' => :'units',
60
72
  :'amount' => :'amount',
61
73
  :'currency' => :'currency',
74
+ :'type' => :'type',
75
+ :'option_type' => :'option_type',
62
76
  :'description' => :'description',
77
+ :'trade_date' => :'trade_date',
78
+ :'settlement_date' => :'settlement_date',
63
79
  :'fee' => :'fee',
64
80
  :'fx_rate' => :'fx_rate',
65
81
  :'institution' => :'institution',
66
- :'option_type' => :'option_type',
67
- :'price' => :'price',
68
- :'settlement_date' => :'settlement_date',
69
- :'external_reference_id' => :'external_reference_id',
70
- :'symbol' => :'symbol',
71
- :'option_symbol' => :'option_symbol',
72
- :'trade_date' => :'trade_date',
73
- :'type' => :'type',
74
- :'units' => :'units'
82
+ :'external_reference_id' => :'external_reference_id'
75
83
  }
76
84
  end
77
85
 
@@ -85,31 +93,33 @@ module SnapTrade
85
93
  {
86
94
  :'id' => :'String',
87
95
  :'account' => :'AccountSimple',
96
+ :'symbol' => :'UniversalActivitySymbol',
97
+ :'option_symbol' => :'UniversalActivityOptionSymbol',
98
+ :'price' => :'Float',
99
+ :'units' => :'Float',
88
100
  :'amount' => :'Float',
89
- :'currency' => :'Currency',
101
+ :'currency' => :'UniversalActivityCurrency',
102
+ :'type' => :'String',
103
+ :'option_type' => :'String',
90
104
  :'description' => :'String',
105
+ :'trade_date' => :'Time',
106
+ :'settlement_date' => :'Time',
91
107
  :'fee' => :'Float',
92
108
  :'fx_rate' => :'Float',
93
109
  :'institution' => :'String',
94
- :'option_type' => :'String',
95
- :'price' => :'Float',
96
- :'settlement_date' => :'String',
97
- :'external_reference_id' => :'String',
98
- :'symbol' => :'Symbol',
99
- :'option_symbol' => :'OptionsSymbol',
100
- :'trade_date' => :'String',
101
- :'type' => :'String',
102
- :'units' => :'Float'
110
+ :'external_reference_id' => :'String'
103
111
  }
104
112
  end
105
113
 
106
114
  # List of attributes with nullable: true
107
115
  def self.openapi_nullable
108
116
  Set.new([
117
+ :'symbol',
118
+ :'option_symbol',
109
119
  :'amount',
110
- :'fx_rate',
111
- :'external_reference_id',
112
120
  :'trade_date',
121
+ :'fx_rate',
122
+ :'external_reference_id'
113
123
  ])
114
124
  end
115
125
 
@@ -136,64 +146,64 @@ module SnapTrade
136
146
  self.account = attributes[:'account']
137
147
  end
138
148
 
139
- if attributes.key?(:'amount')
140
- self.amount = attributes[:'amount']
149
+ if attributes.key?(:'symbol')
150
+ self.symbol = attributes[:'symbol']
141
151
  end
142
152
 
143
- if attributes.key?(:'currency')
144
- self.currency = attributes[:'currency']
153
+ if attributes.key?(:'option_symbol')
154
+ self.option_symbol = attributes[:'option_symbol']
145
155
  end
146
156
 
147
- if attributes.key?(:'description')
148
- self.description = attributes[:'description']
157
+ if attributes.key?(:'price')
158
+ self.price = attributes[:'price']
149
159
  end
150
160
 
151
- if attributes.key?(:'fee')
152
- self.fee = attributes[:'fee']
161
+ if attributes.key?(:'units')
162
+ self.units = attributes[:'units']
153
163
  end
154
164
 
155
- if attributes.key?(:'fx_rate')
156
- self.fx_rate = attributes[:'fx_rate']
165
+ if attributes.key?(:'amount')
166
+ self.amount = attributes[:'amount']
157
167
  end
158
168
 
159
- if attributes.key?(:'institution')
160
- self.institution = attributes[:'institution']
169
+ if attributes.key?(:'currency')
170
+ self.currency = attributes[:'currency']
161
171
  end
162
172
 
163
- if attributes.key?(:'option_type')
164
- self.option_type = attributes[:'option_type']
173
+ if attributes.key?(:'type')
174
+ self.type = attributes[:'type']
165
175
  end
166
176
 
167
- if attributes.key?(:'price')
168
- self.price = attributes[:'price']
177
+ if attributes.key?(:'option_type')
178
+ self.option_type = attributes[:'option_type']
169
179
  end
170
180
 
171
- if attributes.key?(:'settlement_date')
172
- self.settlement_date = attributes[:'settlement_date']
181
+ if attributes.key?(:'description')
182
+ self.description = attributes[:'description']
173
183
  end
174
184
 
175
- if attributes.key?(:'external_reference_id')
176
- self.external_reference_id = attributes[:'external_reference_id']
185
+ if attributes.key?(:'trade_date')
186
+ self.trade_date = attributes[:'trade_date']
177
187
  end
178
188
 
179
- if attributes.key?(:'symbol')
180
- self.symbol = attributes[:'symbol']
189
+ if attributes.key?(:'settlement_date')
190
+ self.settlement_date = attributes[:'settlement_date']
181
191
  end
182
192
 
183
- if attributes.key?(:'option_symbol')
184
- self.option_symbol = attributes[:'option_symbol']
193
+ if attributes.key?(:'fee')
194
+ self.fee = attributes[:'fee']
185
195
  end
186
196
 
187
- if attributes.key?(:'trade_date')
188
- self.trade_date = attributes[:'trade_date']
197
+ if attributes.key?(:'fx_rate')
198
+ self.fx_rate = attributes[:'fx_rate']
189
199
  end
190
200
 
191
- if attributes.key?(:'type')
192
- self.type = attributes[:'type']
201
+ if attributes.key?(:'institution')
202
+ self.institution = attributes[:'institution']
193
203
  end
194
204
 
195
- if attributes.key?(:'units')
196
- self.units = attributes[:'units']
205
+ if attributes.key?(:'external_reference_id')
206
+ self.external_reference_id = attributes[:'external_reference_id']
197
207
  end
198
208
  end
199
209
 
@@ -217,21 +227,21 @@ module SnapTrade
217
227
  self.class == o.class &&
218
228
  id == o.id &&
219
229
  account == o.account &&
230
+ symbol == o.symbol &&
231
+ option_symbol == o.option_symbol &&
232
+ price == o.price &&
233
+ units == o.units &&
220
234
  amount == o.amount &&
221
235
  currency == o.currency &&
236
+ type == o.type &&
237
+ option_type == o.option_type &&
222
238
  description == o.description &&
239
+ trade_date == o.trade_date &&
240
+ settlement_date == o.settlement_date &&
223
241
  fee == o.fee &&
224
242
  fx_rate == o.fx_rate &&
225
243
  institution == o.institution &&
226
- option_type == o.option_type &&
227
- price == o.price &&
228
- settlement_date == o.settlement_date &&
229
- external_reference_id == o.external_reference_id &&
230
- symbol == o.symbol &&
231
- option_symbol == o.option_symbol &&
232
- trade_date == o.trade_date &&
233
- type == o.type &&
234
- units == o.units
244
+ external_reference_id == o.external_reference_id
235
245
  end
236
246
 
237
247
  # @see the `==` method
@@ -243,7 +253,7 @@ module SnapTrade
243
253
  # Calculates hash code according to all attributes.
244
254
  # @return [Integer] Hash code
245
255
  def hash
246
- [id, account, amount, currency, description, fee, fx_rate, institution, option_type, price, settlement_date, external_reference_id, symbol, option_symbol, trade_date, type, units].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
247
257
  end
248
258
 
249
259
  # Builds the object from hash
@@ -11,19 +11,23 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module SnapTrade
14
- # Total value of the account, as reported by the brokerage
15
- class Amount
16
- # Total value denominated in the currency of the `currency` field.
17
- attr_accessor :amount
14
+ # The currency in which the transaction `price` and `amount` is denominated.
15
+ class UniversalActivityCurrency
16
+ # Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade.
17
+ attr_accessor :id
18
18
 
19
- # The ISO-4217 currency code for the amount.
20
- attr_accessor :currency
19
+ # The ISO-4217 currency code for the currency.
20
+ attr_accessor :code
21
+
22
+ # A human-friendly name of the currency.
23
+ attr_accessor :name
21
24
 
22
25
  # Attribute mapping from ruby-style variable name to JSON key.
23
26
  def self.attribute_map
24
27
  {
25
- :'amount' => :'amount',
26
- :'currency' => :'currency'
28
+ :'id' => :'id',
29
+ :'code' => :'code',
30
+ :'name' => :'name'
27
31
  }
28
32
  end
29
33
 
@@ -35,8 +39,9 @@ module SnapTrade
35
39
  # Attribute type mapping.
36
40
  def self.openapi_types
37
41
  {
38
- :'amount' => :'Float',
39
- :'currency' => :'String'
42
+ :'id' => :'String',
43
+ :'code' => :'String',
44
+ :'name' => :'String'
40
45
  }
41
46
  end
42
47
 
@@ -46,27 +51,38 @@ module SnapTrade
46
51
  ])
47
52
  end
48
53
 
54
+ # List of class defined in allOf (OpenAPI v3)
55
+ def self.openapi_all_of
56
+ [
57
+ :'Currency'
58
+ ]
59
+ end
60
+
49
61
  # Initializes the object
50
62
  # @param [Hash] attributes Model attributes in the form of hash
51
63
  def initialize(attributes = {})
52
64
  if (!attributes.is_a?(Hash))
53
- fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::Amount` initialize method"
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::UniversalActivityCurrency` initialize method"
54
66
  end
55
67
 
56
68
  # check to see if the attribute exists and convert string to symbol for hash key
57
69
  attributes = attributes.each_with_object({}) { |(k, v), h|
58
70
  if (!self.class.attribute_map.key?(k.to_sym))
59
- fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::Amount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::UniversalActivityCurrency`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
72
  end
61
73
  h[k.to_sym] = v
62
74
  }
63
75
 
64
- if attributes.key?(:'amount')
65
- self.amount = attributes[:'amount']
76
+ if attributes.key?(:'id')
77
+ self.id = attributes[:'id']
78
+ end
79
+
80
+ if attributes.key?(:'code')
81
+ self.code = attributes[:'code']
66
82
  end
67
83
 
68
- if attributes.key?(:'currency')
69
- self.currency = attributes[:'currency']
84
+ if attributes.key?(:'name')
85
+ self.name = attributes[:'name']
70
86
  end
71
87
  end
72
88
 
@@ -88,8 +104,9 @@ module SnapTrade
88
104
  def ==(o)
89
105
  return true if self.equal?(o)
90
106
  self.class == o.class &&
91
- amount == o.amount &&
92
- currency == o.currency
107
+ id == o.id &&
108
+ code == o.code &&
109
+ name == o.name
93
110
  end
94
111
 
95
112
  # @see the `==` method
@@ -101,7 +118,7 @@ module SnapTrade
101
118
  # Calculates hash code according to all attributes.
102
119
  # @return [Integer] Hash code
103
120
  def hash
104
- [amount, currency].hash
121
+ [id, code, name].hash
105
122
  end
106
123
 
107
124
  # Builds the object from hash