snaptrade 2.0.73 → 2.0.74

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6b9fd0bb5d593e4e45d7df23cf688af3873e20cfa0a9a3f6322b699f4b2f682
4
- data.tar.gz: 9b1a7afc8ddaf2b2bda76704b0ca44aae0332541c0a084862a9567e77747b538
3
+ metadata.gz: 10510d1b0e28e82d9e28b3736e5c54a65a388dd809320e1f2d42b9dd729ee0ac
4
+ data.tar.gz: a758897cb02823c1edbd25eac795d1affda2e56f56a245e745c3fa9fe5bff7d7
5
5
  SHA512:
6
- metadata.gz: f9e14da6a88313fd33e88b105bc6db1bb86975c41488c2da2e6dd30e1d7b0dde627a07432d7cd70c85e2c4da5b8d932585240027fb41f1b9218fcc6d19772b7b
7
- data.tar.gz: b99d7d90c5018952d949b05296bac8434a85417c877519ca376aca6f64f00f8ea02955f8f5285b3797ccbb561f04546cfc97f9c6bcc169881b1a788a52a18ce5
6
+ metadata.gz: 4ffdcd5168be3bbe67c5482bf430ba73466d1f253aa7384dd1abbd65e94362f9c8c4615ce1053a7d5528602c3f2874be38c895bab232b1fab60c3b6ef6c43c31
7
+ data.tar.gz: 5c4944425a9384ac96fea0afbbc1c3e35b6d6c32d97b60e3d887416f56227979f4217901c4a3d9bcfa779509d8ac10cd2856c6c322716cfa32c29381123c2481
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.73)
4
+ snaptrade (2.0.74)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart (~> 1.0, >= 1.0.4)
7
7
 
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Connect brokerage accounts to your app for live positions and trading
8
8
 
9
- [![npm](https://img.shields.io/badge/gem-v2.0.73-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.73)
9
+ [![npm](https://img.shields.io/badge/gem-v2.0.74-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.74)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
11
11
 
12
12
  </div>
@@ -74,7 +74,7 @@ Connect brokerage accounts to your app for live positions and trading
74
74
  Add to Gemfile:
75
75
 
76
76
  ```ruby
77
- gem 'snaptrade', '~> 2.0.73'
77
+ gem 'snaptrade', '~> 2.0.74'
78
78
  ```
79
79
 
80
80
  ## Getting Started<a id="getting-started"></a>
@@ -92,6 +92,8 @@ result = snaptrade.account_information.get_account_activities(
92
92
  user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
93
93
  start_date: "2022-01-24",
94
94
  end_date: "2022-01-24",
95
+ offset: 0,
96
+ limit: 1,
95
97
  type: "BUY,SELL,DIVIDEND",
96
98
  )
97
99
  p result
@@ -108,9 +110,11 @@ result = snaptrade.account_information.get_account_activities_with_http_info(
108
110
  user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
109
111
  start_date: "2022-01-24",
110
112
  end_date: "2022-01-24",
113
+ offset: 0,
114
+ limit: 1,
111
115
  type: "BUY,SELL,DIVIDEND",
112
116
  )
113
- p result[0] # [Array<UniversalActivity>] Deserialized data
117
+ p result[0] # [Array<PaginatedUniversalActivity>] Deserialized data
114
118
  p.result[1] # [Integer] HTTP status code
115
119
  p.result[2] # [Hash] HTTP headers
116
120
  p.result[3] # [Faraday::Response] Raw HTTP response
@@ -121,9 +125,11 @@ p.result[3] # [Faraday::Response] Raw HTTP response
121
125
 
122
126
  ### `snaptrade.account_information.get_account_activities`<a id="snaptradeaccount_informationget_account_activities"></a>
123
127
 
124
- Returns all historical transactions for the specified account. It's recommended to use `startDate` and `endDate` to paginate through the data, as the response may be very large for accounts with a long history and/or a lot of activity. There's a max number of 10000 transactions returned per request.
128
+ Returns all historical transactions for the specified account.
125
129
 
126
- There is no guarantee to the ordering of the transactions returned. Please sort the transactions based on the `trade_date` field if you need them in a specific order.
130
+ This endpoint is paginated and will return a maximum of 1000 transactions per request. See the query parameters for pagination options.
131
+
132
+ Transaction are returned in reverse chronological order, using the `trade_date` field.
127
133
 
128
134
  The data returned here is always cached and refreshed once a day.
129
135
 
@@ -137,6 +143,8 @@ result = snaptrade.account_information.get_account_activities(
137
143
  user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
138
144
  start_date: "2022-01-24",
139
145
  end_date: "2022-01-24",
146
+ offset: 0,
147
+ limit: 1,
140
148
  type: "BUY,SELL,DIVIDEND",
141
149
  )
142
150
  p result
@@ -157,6 +165,14 @@ The end date (inclusive) of the transaction history to retrieve. If not
157
165
  provided, the default is the last transaction known to SnapTrade based on
158
166
  `trade_date`.
159
167
 
168
+ ##### offset: `Integer`<a id="offset-integer"></a>
169
+ An integer that specifies the starting point of the paginated results. Default
170
+ is 0.
171
+
172
+ ##### limit: `Integer`<a id="limit-integer"></a>
173
+ An integer that specifies the maximum number of transactions to return. Default
174
+ of 1000.
175
+
160
176
  ##### type: `String`<a id="type-string"></a>
161
177
  Optional comma separated list of transaction types to filter by. SnapTrade does
162
178
  a best effort to categorize brokerage transaction types into a common set of
@@ -170,7 +186,7 @@ exercise event. - `TRANSFER` - Transfer of assets from one account to another
170
186
 
171
187
  #### 🔄 Return<a id="🔄-return"></a>
172
188
 
173
- [UniversalActivity](./lib/snaptrade/models/universal_activity.rb)
189
+ [PaginatedUniversalActivity](./lib/snaptrade/models/paginated_universal_activity.rb)
174
190
 
175
191
  #### 🌐 Endpoint<a id="🌐-endpoint"></a>
176
192
 
@@ -19,9 +19,11 @@ module SnapTrade
19
19
 
20
20
  # List account activities
21
21
  #
22
- # Returns all historical transactions for the specified account. It's recommended to use `startDate` and `endDate` to paginate through the data, as the response may be very large for accounts with a long history and/or a lot of activity. There's a max number of 10000 transactions returned per request.
22
+ # Returns all historical transactions for the specified account.
23
23
  #
24
- # There is no guarantee to the ordering of the transactions returned. Please sort the transactions based on the `trade_date` field if you need them in a specific order.
24
+ # This endpoint is paginated and will return a maximum of 1000 transactions per request. See the query parameters for pagination options.
25
+ #
26
+ # Transaction are returned in reverse chronological order, using the `trade_date` field.
25
27
  #
26
28
  # The data returned here is always cached and refreshed once a day.
27
29
  #
@@ -30,11 +32,15 @@ module SnapTrade
30
32
  # @param user_secret [String]
31
33
  # @param start_date [Date] The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`.
32
34
  # @param end_date [Date] The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`.
35
+ # @param offset [Integer] An integer that specifies the starting point of the paginated results. Default is 0.
36
+ # @param limit [Integer] An integer that specifies the maximum number of transactions to return. Default of 1000.
33
37
  # @param type [String] Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another
34
38
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
35
- def get_account_activities(account_id:, user_id:, user_secret:, start_date: SENTINEL, end_date: SENTINEL, type: SENTINEL, extra: {})
39
+ def get_account_activities(account_id:, user_id:, user_secret:, start_date: SENTINEL, end_date: SENTINEL, offset: SENTINEL, limit: SENTINEL, type: SENTINEL, extra: {})
36
40
  extra[:start_date] = start_date if start_date != SENTINEL
37
41
  extra[:end_date] = end_date if end_date != SENTINEL
42
+ extra[:offset] = offset if offset != SENTINEL
43
+ extra[:limit] = limit if limit != SENTINEL
38
44
  extra[:type] = type if type != SENTINEL
39
45
  data, _status_code, _headers = get_account_activities_with_http_info_impl(account_id, user_id, user_secret, extra)
40
46
  data
@@ -42,9 +48,11 @@ module SnapTrade
42
48
 
43
49
  # List account activities
44
50
  #
45
- # Returns all historical transactions for the specified account. It's recommended to use `startDate` and `endDate` to paginate through the data, as the response may be very large for accounts with a long history and/or a lot of activity. There's a max number of 10000 transactions returned per request.
51
+ # Returns all historical transactions for the specified account.
52
+ #
53
+ # This endpoint is paginated and will return a maximum of 1000 transactions per request. See the query parameters for pagination options.
46
54
  #
47
- # There is no guarantee to the ordering of the transactions returned. Please sort the transactions based on the `trade_date` field if you need them in a specific order.
55
+ # Transaction are returned in reverse chronological order, using the `trade_date` field.
48
56
  #
49
57
  # The data returned here is always cached and refreshed once a day.
50
58
  #
@@ -53,40 +61,48 @@ module SnapTrade
53
61
  # @param user_secret [String]
54
62
  # @param start_date [Date] The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`.
55
63
  # @param end_date [Date] The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`.
64
+ # @param offset [Integer] An integer that specifies the starting point of the paginated results. Default is 0.
65
+ # @param limit [Integer] An integer that specifies the maximum number of transactions to return. Default of 1000.
56
66
  # @param type [String] Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another
57
67
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
58
- def get_account_activities_with_http_info(account_id:, user_id:, user_secret:, start_date: SENTINEL, end_date: SENTINEL, type: SENTINEL, extra: {})
68
+ def get_account_activities_with_http_info(account_id:, user_id:, user_secret:, start_date: SENTINEL, end_date: SENTINEL, offset: SENTINEL, limit: SENTINEL, type: SENTINEL, extra: {})
59
69
  extra[:start_date] = start_date if start_date != SENTINEL
60
70
  extra[:end_date] = end_date if end_date != SENTINEL
71
+ extra[:offset] = offset if offset != SENTINEL
72
+ extra[:limit] = limit if limit != SENTINEL
61
73
  extra[:type] = type if type != SENTINEL
62
74
  get_account_activities_with_http_info_impl(account_id, user_id, user_secret, extra)
63
75
  end
64
76
 
65
77
  # List account activities
66
- # Returns all historical transactions for the specified account. It's recommended to use `startDate` and `endDate` to paginate through the data, as the response may be very large for accounts with a long history and/or a lot of activity. There's a max number of 10000 transactions returned per request. There is no guarantee to the ordering of the transactions returned. Please sort the transactions based on the `trade_date` field if you need them in a specific order. The data returned here is always cached and refreshed once a day.
78
+ # Returns all historical transactions for the specified account. This endpoint is paginated and will return a maximum of 1000 transactions per request. See the query parameters for pagination options. Transaction are returned in reverse chronological order, using the `trade_date` field. The data returned here is always cached and refreshed once a day.
67
79
  # @param account_id [String]
68
80
  # @param user_id [String]
69
81
  # @param user_secret [String]
70
82
  # @param [Hash] opts the optional parameters
71
83
  # @option opts [Date] :start_date The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`.
72
84
  # @option opts [Date] :end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`.
85
+ # @option opts [Integer] :offset An integer that specifies the starting point of the paginated results. Default is 0.
86
+ # @option opts [Integer] :limit An integer that specifies the maximum number of transactions to return. Default of 1000.
73
87
  # @option opts [String] :type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another
74
- # @return [Array<UniversalActivity>]
88
+ # @return [Array<PaginatedUniversalActivity>]
75
89
  private def get_account_activities_impl(account_id, user_id, user_secret, opts = {})
76
90
  data, _status_code, _headers = get_account_activities_with_http_info(account_id, user_id, user_secret, opts)
77
91
  data
78
92
  end
79
93
 
80
94
  # List account activities
81
- # Returns all historical transactions for the specified account. It&#39;s recommended to use &#x60;startDate&#x60; and &#x60;endDate&#x60; to paginate through the data, as the response may be very large for accounts with a long history and/or a lot of activity. There&#39;s a max number of 10000 transactions returned per request. There is no guarantee to the ordering of the transactions returned. Please sort the transactions based on the &#x60;trade_date&#x60; field if you need them in a specific order. The data returned here is always cached and refreshed once a day.
95
+ # Returns all historical transactions for the specified account. This endpoint is paginated and will return a maximum of 1000 transactions per request. See the query parameters for pagination options. Transaction are returned in reverse chronological order, using the &#x60;trade_date&#x60; field. The data returned here is always cached and refreshed once a day.
82
96
  # @param account_id [String]
83
97
  # @param user_id [String]
84
98
  # @param user_secret [String]
85
99
  # @param [Hash] opts the optional parameters
86
100
  # @option opts [Date] :start_date The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`.
87
101
  # @option opts [Date] :end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`.
102
+ # @option opts [Integer] :offset An integer that specifies the starting point of the paginated results. Default is 0.
103
+ # @option opts [Integer] :limit An integer that specifies the maximum number of transactions to return. Default of 1000.
88
104
  # @option opts [String] :type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another
89
- # @return [Array<(Array<UniversalActivity>, Integer, Hash)>] Array<UniversalActivity> data, response status code and response headers
105
+ # @return [Array<(Array<PaginatedUniversalActivity>, Integer, Hash)>] Array<PaginatedUniversalActivity> data, response status code and response headers
90
106
  private def get_account_activities_with_http_info_impl(account_id, user_id, user_secret, opts = {})
91
107
  if @api_client.config.debugging
92
108
  @api_client.config.logger.debug 'Calling API: AccountInformationApi.get_account_activities ...'
@@ -103,6 +119,14 @@ module SnapTrade
103
119
  if @api_client.config.client_side_validation && user_secret.nil?
104
120
  fail ArgumentError, "Missing the required parameter 'user_secret' when calling AccountInformationApi.get_account_activities"
105
121
  end
122
+ if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
123
+ fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling AccountInformationApi.get_account_activities, must be greater than or equal to 0.'
124
+ end
125
+
126
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
127
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling AccountInformationApi.get_account_activities, must be greater than or equal to 1.'
128
+ end
129
+
106
130
  # resource path
107
131
  local_var_path = '/accounts/{accountId}/activities'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
108
132
 
@@ -112,6 +136,8 @@ module SnapTrade
112
136
  query_params[:'userSecret'] = user_secret
113
137
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
114
138
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
139
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
140
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
115
141
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
116
142
 
117
143
  # header parameters
@@ -126,7 +152,7 @@ module SnapTrade
126
152
  post_body = opts[:debug_body]
127
153
 
128
154
  # return_type
129
- return_type = opts[:debug_return_type] || 'Array<UniversalActivity>'
155
+ return_type = opts[:debug_return_type] || 'Array<PaginatedUniversalActivity>'
130
156
 
131
157
  # auth_names
132
158
  auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
@@ -0,0 +1,371 @@
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
+ # A transaction or activity from an institution
15
+ class AccountUniversalActivity
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.
17
+ attr_accessor :id
18
+
19
+ attr_accessor :symbol
20
+
21
+ attr_accessor :option_symbol
22
+
23
+ # The price of the security for the transaction. This is mostly applicable to `BUY`, `SELL`, and `DIVIDEND` transactions.
24
+ attr_accessor :price
25
+
26
+ # The number of units of the security for the transaction. This is mostly applicable to `BUY`, `SELL`, and `DIVIDEND` transactions.
27
+ attr_accessor :units
28
+
29
+ # 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.
30
+ attr_accessor :amount
31
+
32
+ attr_accessor :currency
33
+
34
+ # 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` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. `option_symbol` contains the related option contract info. - `OPTIONASSIGNMENT` - Option assignment event. `option_symbol` contains the related option contract info. - `OPTIONEXERCISE` - Option exercise event. `option_symbol` contains the related option contract info.
35
+ attr_accessor :type
36
+
37
+ # 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
38
+ attr_accessor :option_type
39
+
40
+ # A human-readable description of the transaction. This is usually the brokerage's description of the transaction.
41
+ attr_accessor :description
42
+
43
+ # 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.
44
+ attr_accessor :trade_date
45
+
46
+ # The date on which the transaction is settled.
47
+ attr_accessor :settlement_date
48
+
49
+ # Any fee associated with the transaction if provided by the brokerage.
50
+ attr_accessor :fee
51
+
52
+ # 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)
53
+ attr_accessor :fx_rate
54
+
55
+ # The institution that the transaction is associated with. This is usually the brokerage name.
56
+ attr_accessor :institution
57
+
58
+ # 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`
59
+ attr_accessor :external_reference_id
60
+
61
+ # Attribute mapping from ruby-style variable name to JSON key.
62
+ def self.attribute_map
63
+ {
64
+ :'id' => :'id',
65
+ :'symbol' => :'symbol',
66
+ :'option_symbol' => :'option_symbol',
67
+ :'price' => :'price',
68
+ :'units' => :'units',
69
+ :'amount' => :'amount',
70
+ :'currency' => :'currency',
71
+ :'type' => :'type',
72
+ :'option_type' => :'option_type',
73
+ :'description' => :'description',
74
+ :'trade_date' => :'trade_date',
75
+ :'settlement_date' => :'settlement_date',
76
+ :'fee' => :'fee',
77
+ :'fx_rate' => :'fx_rate',
78
+ :'institution' => :'institution',
79
+ :'external_reference_id' => :'external_reference_id'
80
+ }
81
+ end
82
+
83
+ # Returns all the JSON keys this model knows about
84
+ def self.acceptable_attributes
85
+ attribute_map.values
86
+ end
87
+
88
+ # Attribute type mapping.
89
+ def self.openapi_types
90
+ {
91
+ :'id' => :'String',
92
+ :'symbol' => :'AccountUniversalActivitySymbol',
93
+ :'option_symbol' => :'AccountUniversalActivityOptionSymbol',
94
+ :'price' => :'Float',
95
+ :'units' => :'Float',
96
+ :'amount' => :'Float',
97
+ :'currency' => :'AccountUniversalActivityCurrency',
98
+ :'type' => :'String',
99
+ :'option_type' => :'String',
100
+ :'description' => :'String',
101
+ :'trade_date' => :'Time',
102
+ :'settlement_date' => :'Time',
103
+ :'fee' => :'Float',
104
+ :'fx_rate' => :'Float',
105
+ :'institution' => :'String',
106
+ :'external_reference_id' => :'String'
107
+ }
108
+ end
109
+
110
+ # List of attributes with nullable: true
111
+ def self.openapi_nullable
112
+ Set.new([
113
+ :'symbol',
114
+ :'option_symbol',
115
+ :'amount',
116
+ :'trade_date',
117
+ :'fx_rate',
118
+ :'external_reference_id'
119
+ ])
120
+ end
121
+
122
+ # Initializes the object
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ def initialize(attributes = {})
125
+ if (!attributes.is_a?(Hash))
126
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountUniversalActivity` initialize method"
127
+ end
128
+
129
+ # check to see if the attribute exists and convert string to symbol for hash key
130
+ attributes = attributes.each_with_object({}) { |(k, v), h|
131
+ if (!self.class.attribute_map.key?(k.to_sym))
132
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountUniversalActivity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
133
+ end
134
+ h[k.to_sym] = v
135
+ }
136
+
137
+ if attributes.key?(:'id')
138
+ self.id = attributes[:'id']
139
+ end
140
+
141
+ if attributes.key?(:'symbol')
142
+ self.symbol = attributes[:'symbol']
143
+ end
144
+
145
+ if attributes.key?(:'option_symbol')
146
+ self.option_symbol = attributes[:'option_symbol']
147
+ end
148
+
149
+ if attributes.key?(:'price')
150
+ self.price = attributes[:'price']
151
+ end
152
+
153
+ if attributes.key?(:'units')
154
+ self.units = attributes[:'units']
155
+ end
156
+
157
+ if attributes.key?(:'amount')
158
+ self.amount = attributes[:'amount']
159
+ end
160
+
161
+ if attributes.key?(:'currency')
162
+ self.currency = attributes[:'currency']
163
+ end
164
+
165
+ if attributes.key?(:'type')
166
+ self.type = attributes[:'type']
167
+ end
168
+
169
+ if attributes.key?(:'option_type')
170
+ self.option_type = attributes[:'option_type']
171
+ end
172
+
173
+ if attributes.key?(:'description')
174
+ self.description = attributes[:'description']
175
+ end
176
+
177
+ if attributes.key?(:'trade_date')
178
+ self.trade_date = attributes[:'trade_date']
179
+ end
180
+
181
+ if attributes.key?(:'settlement_date')
182
+ self.settlement_date = attributes[:'settlement_date']
183
+ end
184
+
185
+ if attributes.key?(:'fee')
186
+ self.fee = attributes[:'fee']
187
+ end
188
+
189
+ if attributes.key?(:'fx_rate')
190
+ self.fx_rate = attributes[:'fx_rate']
191
+ end
192
+
193
+ if attributes.key?(:'institution')
194
+ self.institution = attributes[:'institution']
195
+ end
196
+
197
+ if attributes.key?(:'external_reference_id')
198
+ self.external_reference_id = attributes[:'external_reference_id']
199
+ end
200
+ end
201
+
202
+ # Show invalid properties with the reasons. Usually used together with valid?
203
+ # @return Array for valid properties with the reasons
204
+ def list_invalid_properties
205
+ invalid_properties = Array.new
206
+ invalid_properties
207
+ end
208
+
209
+ # Check to see if the all the properties in the model are valid
210
+ # @return true if the model is valid
211
+ def valid?
212
+ true
213
+ end
214
+
215
+ # Checks equality by comparing each attribute.
216
+ # @param [Object] Object to be compared
217
+ def ==(o)
218
+ return true if self.equal?(o)
219
+ self.class == o.class &&
220
+ id == o.id &&
221
+ symbol == o.symbol &&
222
+ option_symbol == o.option_symbol &&
223
+ price == o.price &&
224
+ units == o.units &&
225
+ amount == o.amount &&
226
+ currency == o.currency &&
227
+ type == o.type &&
228
+ option_type == o.option_type &&
229
+ description == o.description &&
230
+ trade_date == o.trade_date &&
231
+ settlement_date == o.settlement_date &&
232
+ fee == o.fee &&
233
+ fx_rate == o.fx_rate &&
234
+ institution == o.institution &&
235
+ external_reference_id == o.external_reference_id
236
+ end
237
+
238
+ # @see the `==` method
239
+ # @param [Object] Object to be compared
240
+ def eql?(o)
241
+ self == o
242
+ end
243
+
244
+ # Calculates hash code according to all attributes.
245
+ # @return [Integer] Hash code
246
+ def hash
247
+ [id, symbol, option_symbol, price, units, amount, currency, type, option_type, description, trade_date, settlement_date, fee, fx_rate, institution, external_reference_id].hash
248
+ end
249
+
250
+ # Builds the object from hash
251
+ # @param [Hash] attributes Model attributes in the form of hash
252
+ # @return [Object] Returns the model itself
253
+ def self.build_from_hash(attributes)
254
+ new.build_from_hash(attributes)
255
+ end
256
+
257
+ # Builds the object from hash
258
+ # @param [Hash] attributes Model attributes in the form of hash
259
+ # @return [Object] Returns the model itself
260
+ def build_from_hash(attributes)
261
+ return nil unless attributes.is_a?(Hash)
262
+ attributes = attributes.transform_keys(&:to_sym)
263
+ self.class.openapi_types.each_pair do |key, type|
264
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
265
+ self.send("#{key}=", nil)
266
+ elsif type =~ /\AArray<(.*)>/i
267
+ # check to ensure the input is an array given that the attribute
268
+ # is documented as an array but the input is not
269
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
270
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
271
+ end
272
+ elsif !attributes[self.class.attribute_map[key]].nil?
273
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
274
+ end
275
+ end
276
+
277
+ self
278
+ end
279
+
280
+ # Deserializes the data based on type
281
+ # @param string type Data type
282
+ # @param string value Value to be deserialized
283
+ # @return [Object] Deserialized data
284
+ def _deserialize(type, value)
285
+ case type.to_sym
286
+ when :Time
287
+ Time.parse(value)
288
+ when :Date
289
+ Date.parse(value)
290
+ when :String
291
+ value.to_s
292
+ when :Integer
293
+ value.to_i
294
+ when :Float
295
+ value.to_f
296
+ when :Boolean
297
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
298
+ true
299
+ else
300
+ false
301
+ end
302
+ when :Object
303
+ # generic object (usually a Hash), return directly
304
+ value
305
+ when /\AArray<(?<inner_type>.+)>\z/
306
+ inner_type = Regexp.last_match[:inner_type]
307
+ value.map { |v| _deserialize(inner_type, v) }
308
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
309
+ k_type = Regexp.last_match[:k_type]
310
+ v_type = Regexp.last_match[:v_type]
311
+ {}.tap do |hash|
312
+ value.each do |k, v|
313
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
314
+ end
315
+ end
316
+ else # model
317
+ # models (e.g. Pet) or oneOf
318
+ klass = SnapTrade.const_get(type)
319
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
320
+ end
321
+ end
322
+
323
+ # Returns the string representation of the object
324
+ # @return [String] String presentation of the object
325
+ def to_s
326
+ to_hash.to_s
327
+ end
328
+
329
+ # to_body is an alias to to_hash (backward compatibility)
330
+ # @return [Hash] Returns the object in the form of hash
331
+ def to_body
332
+ to_hash
333
+ end
334
+
335
+ # Returns the object in the form of hash
336
+ # @return [Hash] Returns the object in the form of hash
337
+ def to_hash
338
+ hash = {}
339
+ self.class.attribute_map.each_pair do |attr, param|
340
+ value = self.send(attr)
341
+ if value.nil?
342
+ is_nullable = self.class.openapi_nullable.include?(attr)
343
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
344
+ end
345
+
346
+ hash[param] = _to_hash(value)
347
+ end
348
+ hash
349
+ end
350
+
351
+ # Outputs non-array value in the form of hash
352
+ # For object, use to_hash. Otherwise, just return the value
353
+ # @param [Object] value Any valid value
354
+ # @return [Hash] Returns the value in the form of hash
355
+ def _to_hash(value)
356
+ if value.is_a?(Array)
357
+ value.compact.map { |v| _to_hash(v) }
358
+ elsif value.is_a?(Hash)
359
+ {}.tap do |hash|
360
+ value.each { |k, v| hash[k] = _to_hash(v) }
361
+ end
362
+ elsif value.respond_to? :to_hash
363
+ value.to_hash
364
+ else
365
+ value
366
+ end
367
+ end
368
+
369
+ end
370
+
371
+ end
@@ -12,7 +12,7 @@ require 'time'
12
12
 
13
13
  module SnapTrade
14
14
  # The currency in which the transaction `price` and `amount` is denominated.
15
- class UniversalActivityCurrency
15
+ class AccountUniversalActivityCurrency
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::UniversalActivityCurrency` initialize method"
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountUniversalActivityCurrency` 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::UniversalActivityCurrency`. 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::AccountUniversalActivityCurrency`. 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
  }