snaptrade 2.1.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +2 -576
- data/lib/snaptrade/api/account_information_api.rb +0 -231
- data/lib/snaptrade/api/connections_api.rb +0 -201
- data/lib/snaptrade/api/reference_data_api.rb +0 -316
- data/lib/snaptrade/api/trading_api.rb +0 -290
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +0 -7
- data/spec/api/account_information_api_spec.rb +0 -28
- data/spec/api/connections_api_spec.rb +0 -28
- data/spec/api/reference_data_api_spec.rb +0 -45
- data/spec/api/trading_api_spec.rb +0 -30
- metadata +202 -211
- data/lib/snaptrade/api/options_api.rb +0 -137
- data/lib/snaptrade/api/transactions_and_reporting_api.rb +0 -302
- data/lib/snaptrade/models/connections_session_events200_response_inner.rb +0 -292
- data/spec/api/options_api_spec.rb +0 -44
- data/spec/api/transactions_and_reporting_api_spec.rb +0 -66
- data/spec/models/connections_session_events200_response_inner_spec.rb +0 -65
|
@@ -1,302 +0,0 @@
|
|
|
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 'cgi'
|
|
11
|
-
|
|
12
|
-
module SnapTrade
|
|
13
|
-
class TransactionsAndReportingApi
|
|
14
|
-
attr_accessor :api_client
|
|
15
|
-
|
|
16
|
-
def initialize(api_client = ApiClient.default)
|
|
17
|
-
@api_client = api_client
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# Get transaction history for a user
|
|
21
|
-
#
|
|
22
|
-
# **Deprecated.** Use [the account level endpoint](/reference/Account%20Information/AccountInformation_getAccountActivities) instead, if possible.
|
|
23
|
-
#
|
|
24
|
-
# This endpoint will return HTTP 410 Gone for all customers that sign up after April 25, 2026.
|
|
25
|
-
#
|
|
26
|
-
# Returns all historical transactions for the specified user and filtering criteria. 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.
|
|
27
|
-
#
|
|
28
|
-
# 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.
|
|
29
|
-
#
|
|
30
|
-
# This endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage.
|
|
31
|
-
#
|
|
32
|
-
# @param user_id [String]
|
|
33
|
-
# @param user_secret [String]
|
|
34
|
-
# @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`.
|
|
35
|
-
# @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`.
|
|
36
|
-
# @param accounts [String] Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter.
|
|
37
|
-
# @param brokerage_authorizations [String] Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter.
|
|
38
|
-
# @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. - `SUBSTITUTE_DIVIDEND` - Payment in lieu of a dividend. - `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
|
|
39
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
40
|
-
def get_activities(user_id:, user_secret:, start_date: SENTINEL, end_date: SENTINEL, accounts: SENTINEL, brokerage_authorizations: SENTINEL, type: SENTINEL, extra: {})
|
|
41
|
-
extra[:start_date] = start_date if start_date != SENTINEL
|
|
42
|
-
extra[:end_date] = end_date if end_date != SENTINEL
|
|
43
|
-
extra[:accounts] = accounts if accounts != SENTINEL
|
|
44
|
-
extra[:brokerage_authorizations] = brokerage_authorizations if brokerage_authorizations != SENTINEL
|
|
45
|
-
extra[:type] = type if type != SENTINEL
|
|
46
|
-
data, _status_code, _headers = get_activities_with_http_info_impl(user_id, user_secret, extra)
|
|
47
|
-
data
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
# Get transaction history for a user
|
|
51
|
-
#
|
|
52
|
-
# **Deprecated.** Use [the account level endpoint](/reference/Account%20Information/AccountInformation_getAccountActivities) instead, if possible.
|
|
53
|
-
#
|
|
54
|
-
# This endpoint will return HTTP 410 Gone for all customers that sign up after April 25, 2026.
|
|
55
|
-
#
|
|
56
|
-
# Returns all historical transactions for the specified user and filtering criteria. 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.
|
|
57
|
-
#
|
|
58
|
-
# 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.
|
|
59
|
-
#
|
|
60
|
-
# This endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage.
|
|
61
|
-
#
|
|
62
|
-
# @param user_id [String]
|
|
63
|
-
# @param user_secret [String]
|
|
64
|
-
# @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`.
|
|
65
|
-
# @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`.
|
|
66
|
-
# @param accounts [String] Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter.
|
|
67
|
-
# @param brokerage_authorizations [String] Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter.
|
|
68
|
-
# @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. - `SUBSTITUTE_DIVIDEND` - Payment in lieu of a dividend. - `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
|
|
69
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
70
|
-
def get_activities_with_http_info(user_id:, user_secret:, start_date: SENTINEL, end_date: SENTINEL, accounts: SENTINEL, brokerage_authorizations: SENTINEL, type: SENTINEL, extra: {})
|
|
71
|
-
extra[:start_date] = start_date if start_date != SENTINEL
|
|
72
|
-
extra[:end_date] = end_date if end_date != SENTINEL
|
|
73
|
-
extra[:accounts] = accounts if accounts != SENTINEL
|
|
74
|
-
extra[:brokerage_authorizations] = brokerage_authorizations if brokerage_authorizations != SENTINEL
|
|
75
|
-
extra[:type] = type if type != SENTINEL
|
|
76
|
-
get_activities_with_http_info_impl(user_id, user_secret, extra)
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
# Get transaction history for a user
|
|
80
|
-
# **Deprecated.** Use [the account level endpoint](/reference/Account%20Information/AccountInformation_getAccountActivities) instead, if possible. This endpoint will return HTTP 410 Gone for all customers that sign up after April 25, 2026. Returns all historical transactions for the specified user and filtering criteria. 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. This endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage.
|
|
81
|
-
# @param user_id [String]
|
|
82
|
-
# @param user_secret [String]
|
|
83
|
-
# @param [Hash] opts the optional parameters
|
|
84
|
-
# @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`.
|
|
85
|
-
# @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`.
|
|
86
|
-
# @option opts [String] :accounts Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter.
|
|
87
|
-
# @option opts [String] :brokerage_authorizations Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter.
|
|
88
|
-
# @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. - `SUBSTITUTE_DIVIDEND` - Payment in lieu of a dividend. - `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<UniversalActivity>]
|
|
90
|
-
private def get_activities_impl(user_id, user_secret, opts = {})
|
|
91
|
-
data, _status_code, _headers = get_activities_with_http_info(user_id, user_secret, opts)
|
|
92
|
-
data
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
# Get transaction history for a user
|
|
96
|
-
# **Deprecated.** Use [the account level endpoint](/reference/Account%20Information/AccountInformation_getAccountActivities) instead, if possible. This endpoint will return HTTP 410 Gone for all customers that sign up after April 25, 2026. Returns all historical transactions for the specified user and filtering criteria. 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. This endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage.
|
|
97
|
-
# @param user_id [String]
|
|
98
|
-
# @param user_secret [String]
|
|
99
|
-
# @param [Hash] opts the optional parameters
|
|
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`.
|
|
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 [String] :accounts Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter.
|
|
103
|
-
# @option opts [String] :brokerage_authorizations Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter.
|
|
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. - `SUBSTITUTE_DIVIDEND` - Payment in lieu of a dividend. - `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
|
|
105
|
-
# @return [Array<(Array<UniversalActivity>, Integer, Hash)>] Array<UniversalActivity> data, response status code and response headers
|
|
106
|
-
private def get_activities_with_http_info_impl(user_id, user_secret, opts = {})
|
|
107
|
-
if @api_client.config.debugging
|
|
108
|
-
@api_client.config.logger.debug 'Calling API: TransactionsAndReportingApi.get_activities ...'
|
|
109
|
-
end
|
|
110
|
-
# verify the required parameter 'user_id' is set
|
|
111
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
|
112
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling TransactionsAndReportingApi.get_activities"
|
|
113
|
-
end
|
|
114
|
-
# verify the required parameter 'user_secret' is set
|
|
115
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
|
116
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TransactionsAndReportingApi.get_activities"
|
|
117
|
-
end
|
|
118
|
-
# resource path
|
|
119
|
-
local_var_path = '/activities'
|
|
120
|
-
|
|
121
|
-
# query parameters
|
|
122
|
-
query_params = opts[:query_params] || {}
|
|
123
|
-
query_params[:'userId'] = user_id
|
|
124
|
-
query_params[:'userSecret'] = user_secret
|
|
125
|
-
query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
|
|
126
|
-
query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
|
|
127
|
-
query_params[:'accounts'] = opts[:'accounts'] if !opts[:'accounts'].nil?
|
|
128
|
-
query_params[:'brokerageAuthorizations'] = opts[:'brokerage_authorizations'] if !opts[:'brokerage_authorizations'].nil?
|
|
129
|
-
query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
|
|
130
|
-
|
|
131
|
-
# header parameters
|
|
132
|
-
header_params = opts[:header_params] || {}
|
|
133
|
-
# HTTP header 'Accept' (if needed)
|
|
134
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
135
|
-
|
|
136
|
-
# form parameters
|
|
137
|
-
form_params = opts[:form_params] || {}
|
|
138
|
-
|
|
139
|
-
# http body (model)
|
|
140
|
-
post_body = opts[:debug_body]
|
|
141
|
-
|
|
142
|
-
# return_type
|
|
143
|
-
return_type = opts[:debug_return_type] || 'Array<UniversalActivity>'
|
|
144
|
-
|
|
145
|
-
# auth_names
|
|
146
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
147
|
-
|
|
148
|
-
new_options = opts.merge(
|
|
149
|
-
:operation => :"TransactionsAndReportingApi.get_activities",
|
|
150
|
-
:header_params => header_params,
|
|
151
|
-
:query_params => query_params,
|
|
152
|
-
:form_params => form_params,
|
|
153
|
-
:body => post_body,
|
|
154
|
-
:auth_names => auth_names,
|
|
155
|
-
:return_type => return_type
|
|
156
|
-
)
|
|
157
|
-
|
|
158
|
-
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
|
159
|
-
if @api_client.config.debugging
|
|
160
|
-
@api_client.config.logger.debug "API called: TransactionsAndReportingApi#get_activities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
161
|
-
end
|
|
162
|
-
return data, status_code, headers, response
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
# Get performance information for a specific timeframe
|
|
167
|
-
#
|
|
168
|
-
# **Deprecated.** Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Please note that Total Equity Timeframe and Rate of Returns are experimental features. Please contact support@snaptrade.com if you notice any inconsistencies.
|
|
169
|
-
#
|
|
170
|
-
# @param start_date [Date]
|
|
171
|
-
# @param end_date [Date]
|
|
172
|
-
# @param user_id [String]
|
|
173
|
-
# @param user_secret [String]
|
|
174
|
-
# @param accounts [String] Optional comma separated list of account IDs used to filter the request on specific accounts
|
|
175
|
-
# @param detailed [Boolean] Optional, increases frequency of data points for the total value and contribution charts if set to true
|
|
176
|
-
# @param frequency [String] Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly.
|
|
177
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
178
|
-
def get_reporting_custom_range(start_date:, end_date:, user_id:, user_secret:, accounts: SENTINEL, detailed: SENTINEL, frequency: SENTINEL, extra: {})
|
|
179
|
-
extra[:accounts] = accounts if accounts != SENTINEL
|
|
180
|
-
extra[:detailed] = detailed if detailed != SENTINEL
|
|
181
|
-
extra[:frequency] = frequency if frequency != SENTINEL
|
|
182
|
-
data, _status_code, _headers = get_reporting_custom_range_with_http_info_impl(start_date, end_date, user_id, user_secret, extra)
|
|
183
|
-
data
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
# Get performance information for a specific timeframe
|
|
187
|
-
#
|
|
188
|
-
# **Deprecated.** Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Please note that Total Equity Timeframe and Rate of Returns are experimental features. Please contact support@snaptrade.com if you notice any inconsistencies.
|
|
189
|
-
#
|
|
190
|
-
# @param start_date [Date]
|
|
191
|
-
# @param end_date [Date]
|
|
192
|
-
# @param user_id [String]
|
|
193
|
-
# @param user_secret [String]
|
|
194
|
-
# @param accounts [String] Optional comma separated list of account IDs used to filter the request on specific accounts
|
|
195
|
-
# @param detailed [Boolean] Optional, increases frequency of data points for the total value and contribution charts if set to true
|
|
196
|
-
# @param frequency [String] Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly.
|
|
197
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
198
|
-
def get_reporting_custom_range_with_http_info(start_date:, end_date:, user_id:, user_secret:, accounts: SENTINEL, detailed: SENTINEL, frequency: SENTINEL, extra: {})
|
|
199
|
-
extra[:accounts] = accounts if accounts != SENTINEL
|
|
200
|
-
extra[:detailed] = detailed if detailed != SENTINEL
|
|
201
|
-
extra[:frequency] = frequency if frequency != SENTINEL
|
|
202
|
-
get_reporting_custom_range_with_http_info_impl(start_date, end_date, user_id, user_secret, extra)
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
# Get performance information for a specific timeframe
|
|
206
|
-
# **Deprecated.** Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Please note that Total Equity Timeframe and Rate of Returns are experimental features. Please contact support@snaptrade.com if you notice any inconsistencies.
|
|
207
|
-
# @param start_date [Date]
|
|
208
|
-
# @param end_date [Date]
|
|
209
|
-
# @param user_id [String]
|
|
210
|
-
# @param user_secret [String]
|
|
211
|
-
# @param [Hash] opts the optional parameters
|
|
212
|
-
# @option opts [String] :accounts Optional comma separated list of account IDs used to filter the request on specific accounts
|
|
213
|
-
# @option opts [Boolean] :detailed Optional, increases frequency of data points for the total value and contribution charts if set to true
|
|
214
|
-
# @option opts [String] :frequency Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly.
|
|
215
|
-
# @return [PerformanceCustom]
|
|
216
|
-
private def get_reporting_custom_range_impl(start_date, end_date, user_id, user_secret, opts = {})
|
|
217
|
-
data, _status_code, _headers = get_reporting_custom_range_with_http_info(start_date, end_date, user_id, user_secret, opts)
|
|
218
|
-
data
|
|
219
|
-
end
|
|
220
|
-
|
|
221
|
-
# Get performance information for a specific timeframe
|
|
222
|
-
# **Deprecated.** Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Please note that Total Equity Timeframe and Rate of Returns are experimental features. Please contact support@snaptrade.com if you notice any inconsistencies.
|
|
223
|
-
# @param start_date [Date]
|
|
224
|
-
# @param end_date [Date]
|
|
225
|
-
# @param user_id [String]
|
|
226
|
-
# @param user_secret [String]
|
|
227
|
-
# @param [Hash] opts the optional parameters
|
|
228
|
-
# @option opts [String] :accounts Optional comma separated list of account IDs used to filter the request on specific accounts
|
|
229
|
-
# @option opts [Boolean] :detailed Optional, increases frequency of data points for the total value and contribution charts if set to true
|
|
230
|
-
# @option opts [String] :frequency Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly.
|
|
231
|
-
# @return [Array<(PerformanceCustom, Integer, Hash)>] PerformanceCustom data, response status code and response headers
|
|
232
|
-
private def get_reporting_custom_range_with_http_info_impl(start_date, end_date, user_id, user_secret, opts = {})
|
|
233
|
-
if @api_client.config.debugging
|
|
234
|
-
@api_client.config.logger.debug 'Calling API: TransactionsAndReportingApi.get_reporting_custom_range ...'
|
|
235
|
-
end
|
|
236
|
-
# verify the required parameter 'start_date' is set
|
|
237
|
-
if @api_client.config.client_side_validation && start_date.nil?
|
|
238
|
-
fail ArgumentError, "Missing the required parameter 'start_date' when calling TransactionsAndReportingApi.get_reporting_custom_range"
|
|
239
|
-
end
|
|
240
|
-
# verify the required parameter 'end_date' is set
|
|
241
|
-
if @api_client.config.client_side_validation && end_date.nil?
|
|
242
|
-
fail ArgumentError, "Missing the required parameter 'end_date' when calling TransactionsAndReportingApi.get_reporting_custom_range"
|
|
243
|
-
end
|
|
244
|
-
# verify the required parameter 'user_id' is set
|
|
245
|
-
if @api_client.config.client_side_validation && user_id.nil?
|
|
246
|
-
fail ArgumentError, "Missing the required parameter 'user_id' when calling TransactionsAndReportingApi.get_reporting_custom_range"
|
|
247
|
-
end
|
|
248
|
-
# verify the required parameter 'user_secret' is set
|
|
249
|
-
if @api_client.config.client_side_validation && user_secret.nil?
|
|
250
|
-
fail ArgumentError, "Missing the required parameter 'user_secret' when calling TransactionsAndReportingApi.get_reporting_custom_range"
|
|
251
|
-
end
|
|
252
|
-
# resource path
|
|
253
|
-
local_var_path = '/performance/custom'
|
|
254
|
-
|
|
255
|
-
# query parameters
|
|
256
|
-
query_params = opts[:query_params] || {}
|
|
257
|
-
query_params[:'startDate'] = start_date
|
|
258
|
-
query_params[:'endDate'] = end_date
|
|
259
|
-
query_params[:'userId'] = user_id
|
|
260
|
-
query_params[:'userSecret'] = user_secret
|
|
261
|
-
query_params[:'accounts'] = opts[:'accounts'] if !opts[:'accounts'].nil?
|
|
262
|
-
query_params[:'detailed'] = opts[:'detailed'] if !opts[:'detailed'].nil?
|
|
263
|
-
query_params[:'frequency'] = opts[:'frequency'] if !opts[:'frequency'].nil?
|
|
264
|
-
|
|
265
|
-
# header parameters
|
|
266
|
-
header_params = opts[:header_params] || {}
|
|
267
|
-
# HTTP header 'Accept' (if needed)
|
|
268
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
269
|
-
|
|
270
|
-
# form parameters
|
|
271
|
-
form_params = opts[:form_params] || {}
|
|
272
|
-
|
|
273
|
-
# http body (model)
|
|
274
|
-
post_body = opts[:debug_body]
|
|
275
|
-
|
|
276
|
-
# return_type
|
|
277
|
-
return_type = opts[:debug_return_type] || 'PerformanceCustom'
|
|
278
|
-
|
|
279
|
-
# auth_names
|
|
280
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
281
|
-
|
|
282
|
-
new_options = opts.merge(
|
|
283
|
-
:operation => :"TransactionsAndReportingApi.get_reporting_custom_range",
|
|
284
|
-
:header_params => header_params,
|
|
285
|
-
:query_params => query_params,
|
|
286
|
-
:form_params => form_params,
|
|
287
|
-
:body => post_body,
|
|
288
|
-
:auth_names => auth_names,
|
|
289
|
-
:return_type => return_type
|
|
290
|
-
)
|
|
291
|
-
|
|
292
|
-
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
|
293
|
-
if @api_client.config.debugging
|
|
294
|
-
@api_client.config.logger.debug "API called: TransactionsAndReportingApi#get_reporting_custom_range\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
295
|
-
end
|
|
296
|
-
return data, status_code, headers, response
|
|
297
|
-
end
|
|
298
|
-
end
|
|
299
|
-
|
|
300
|
-
# top-level client access to avoid having the user to insantiate their own API instances
|
|
301
|
-
TransactionsAndReporting = TransactionsAndReportingApi::new
|
|
302
|
-
end
|
|
@@ -1,292 +0,0 @@
|
|
|
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
|
-
class ConnectionsSessionEvents200ResponseInner
|
|
15
|
-
attr_accessor :id
|
|
16
|
-
|
|
17
|
-
attr_accessor :session_event_type
|
|
18
|
-
|
|
19
|
-
attr_accessor :session_id
|
|
20
|
-
|
|
21
|
-
# SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
|
22
|
-
attr_accessor :user_id
|
|
23
|
-
|
|
24
|
-
# Time
|
|
25
|
-
attr_accessor :created_date
|
|
26
|
-
|
|
27
|
-
attr_accessor :brokerage_status_code
|
|
28
|
-
|
|
29
|
-
attr_accessor :brokerage_authorization_id
|
|
30
|
-
|
|
31
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
|
32
|
-
def self.attribute_map
|
|
33
|
-
{
|
|
34
|
-
:'id' => :'id',
|
|
35
|
-
:'session_event_type' => :'session_event_type',
|
|
36
|
-
:'session_id' => :'session_id',
|
|
37
|
-
:'user_id' => :'user_id',
|
|
38
|
-
:'created_date' => :'created_date',
|
|
39
|
-
:'brokerage_status_code' => :'brokerage_status_code',
|
|
40
|
-
:'brokerage_authorization_id' => :'brokerage_authorization_id'
|
|
41
|
-
}
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
# Returns all the JSON keys this model knows about
|
|
45
|
-
def self.acceptable_attributes
|
|
46
|
-
attribute_map.values
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
# Attribute type mapping.
|
|
50
|
-
def self.openapi_types
|
|
51
|
-
{
|
|
52
|
-
:'id' => :'String',
|
|
53
|
-
:'session_event_type' => :'SessionEventType',
|
|
54
|
-
:'session_id' => :'String',
|
|
55
|
-
:'user_id' => :'String',
|
|
56
|
-
:'created_date' => :'String',
|
|
57
|
-
:'brokerage_status_code' => :'Integer',
|
|
58
|
-
:'brokerage_authorization_id' => :'String'
|
|
59
|
-
}
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
# List of attributes with nullable: true
|
|
63
|
-
def self.openapi_nullable
|
|
64
|
-
Set.new([
|
|
65
|
-
:'brokerage_status_code',
|
|
66
|
-
])
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
# List of class defined in anyOf (OpenAPI v3)
|
|
70
|
-
def self.openapi_any_of
|
|
71
|
-
[
|
|
72
|
-
:'SessionEvent'
|
|
73
|
-
]
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# Initializes the object
|
|
77
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
|
78
|
-
def initialize(attributes = {})
|
|
79
|
-
if (!attributes.is_a?(Hash))
|
|
80
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::ConnectionsSessionEvents200ResponseInner` initialize method"
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
|
84
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
85
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
|
86
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::ConnectionsSessionEvents200ResponseInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
87
|
-
end
|
|
88
|
-
h[k.to_sym] = v
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if attributes.key?(:'id')
|
|
92
|
-
self.id = attributes[:'id']
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
if attributes.key?(:'session_event_type')
|
|
96
|
-
self.session_event_type = attributes[:'session_event_type']
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
if attributes.key?(:'session_id')
|
|
100
|
-
self.session_id = attributes[:'session_id']
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
if attributes.key?(:'user_id')
|
|
104
|
-
self.user_id = attributes[:'user_id']
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
if attributes.key?(:'created_date')
|
|
108
|
-
self.created_date = attributes[:'created_date']
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
if attributes.key?(:'brokerage_status_code')
|
|
112
|
-
self.brokerage_status_code = attributes[:'brokerage_status_code']
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
if attributes.key?(:'brokerage_authorization_id')
|
|
116
|
-
self.brokerage_authorization_id = attributes[:'brokerage_authorization_id']
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
|
121
|
-
# @return Array for valid properties with the reasons
|
|
122
|
-
def list_invalid_properties
|
|
123
|
-
invalid_properties = Array.new
|
|
124
|
-
invalid_properties
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
# Check to see if the all the properties in the model are valid
|
|
128
|
-
# @return true if the model is valid
|
|
129
|
-
def valid?
|
|
130
|
-
_any_of_found = false
|
|
131
|
-
self.class.openapi_any_of.each do |_class|
|
|
132
|
-
_any_of = SnapTrade.const_get(_class).build_from_hash(self.to_hash)
|
|
133
|
-
if _any_of.valid?
|
|
134
|
-
_any_of_found = true
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
if !_any_of_found
|
|
139
|
-
return false
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
true
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
# Checks equality by comparing each attribute.
|
|
146
|
-
# @param [Object] Object to be compared
|
|
147
|
-
def ==(o)
|
|
148
|
-
return true if self.equal?(o)
|
|
149
|
-
self.class == o.class &&
|
|
150
|
-
id == o.id &&
|
|
151
|
-
session_event_type == o.session_event_type &&
|
|
152
|
-
session_id == o.session_id &&
|
|
153
|
-
user_id == o.user_id &&
|
|
154
|
-
created_date == o.created_date &&
|
|
155
|
-
brokerage_status_code == o.brokerage_status_code &&
|
|
156
|
-
brokerage_authorization_id == o.brokerage_authorization_id
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
# @see the `==` method
|
|
160
|
-
# @param [Object] Object to be compared
|
|
161
|
-
def eql?(o)
|
|
162
|
-
self == o
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
# Calculates hash code according to all attributes.
|
|
166
|
-
# @return [Integer] Hash code
|
|
167
|
-
def hash
|
|
168
|
-
[id, session_event_type, session_id, user_id, created_date, brokerage_status_code, brokerage_authorization_id].hash
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
# Builds the object from hash
|
|
172
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
|
173
|
-
# @return [Object] Returns the model itself
|
|
174
|
-
def self.build_from_hash(attributes)
|
|
175
|
-
new.build_from_hash(attributes)
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
# Builds the object from hash
|
|
179
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
|
180
|
-
# @return [Object] Returns the model itself
|
|
181
|
-
def build_from_hash(attributes)
|
|
182
|
-
return nil unless attributes.is_a?(Hash)
|
|
183
|
-
attributes = attributes.transform_keys(&:to_sym)
|
|
184
|
-
self.class.openapi_types.each_pair do |key, type|
|
|
185
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
186
|
-
self.send("#{key}=", nil)
|
|
187
|
-
elsif type =~ /\AArray<(.*)>/i
|
|
188
|
-
# check to ensure the input is an array given that the attribute
|
|
189
|
-
# is documented as an array but the input is not
|
|
190
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
191
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
192
|
-
end
|
|
193
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
194
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
195
|
-
end
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
self
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
# Deserializes the data based on type
|
|
202
|
-
# @param string type Data type
|
|
203
|
-
# @param string value Value to be deserialized
|
|
204
|
-
# @return [Object] Deserialized data
|
|
205
|
-
def _deserialize(type, value)
|
|
206
|
-
case type.to_sym
|
|
207
|
-
when :Time
|
|
208
|
-
Time.parse(value)
|
|
209
|
-
when :Date
|
|
210
|
-
Date.parse(value)
|
|
211
|
-
when :String
|
|
212
|
-
value.to_s
|
|
213
|
-
when :Integer
|
|
214
|
-
value.to_i
|
|
215
|
-
when :Float
|
|
216
|
-
value.to_f
|
|
217
|
-
when :Boolean
|
|
218
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
219
|
-
true
|
|
220
|
-
else
|
|
221
|
-
false
|
|
222
|
-
end
|
|
223
|
-
when :Object
|
|
224
|
-
# generic object (usually a Hash), return directly
|
|
225
|
-
value
|
|
226
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
|
227
|
-
inner_type = Regexp.last_match[:inner_type]
|
|
228
|
-
value.map { |v| _deserialize(inner_type, v) }
|
|
229
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
230
|
-
k_type = Regexp.last_match[:k_type]
|
|
231
|
-
v_type = Regexp.last_match[:v_type]
|
|
232
|
-
{}.tap do |hash|
|
|
233
|
-
value.each do |k, v|
|
|
234
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
235
|
-
end
|
|
236
|
-
end
|
|
237
|
-
else # model
|
|
238
|
-
# models (e.g. Pet) or oneOf
|
|
239
|
-
klass = SnapTrade.const_get(type)
|
|
240
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
241
|
-
end
|
|
242
|
-
end
|
|
243
|
-
|
|
244
|
-
# Returns the string representation of the object
|
|
245
|
-
# @return [String] String presentation of the object
|
|
246
|
-
def to_s
|
|
247
|
-
to_hash.to_s
|
|
248
|
-
end
|
|
249
|
-
|
|
250
|
-
# to_body is an alias to to_hash (backward compatibility)
|
|
251
|
-
# @return [Hash] Returns the object in the form of hash
|
|
252
|
-
def to_body
|
|
253
|
-
to_hash
|
|
254
|
-
end
|
|
255
|
-
|
|
256
|
-
# Returns the object in the form of hash
|
|
257
|
-
# @return [Hash] Returns the object in the form of hash
|
|
258
|
-
def to_hash
|
|
259
|
-
hash = {}
|
|
260
|
-
self.class.attribute_map.each_pair do |attr, param|
|
|
261
|
-
value = self.send(attr)
|
|
262
|
-
if value.nil?
|
|
263
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
264
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
265
|
-
end
|
|
266
|
-
|
|
267
|
-
hash[param] = _to_hash(value)
|
|
268
|
-
end
|
|
269
|
-
hash
|
|
270
|
-
end
|
|
271
|
-
|
|
272
|
-
# Outputs non-array value in the form of hash
|
|
273
|
-
# For object, use to_hash. Otherwise, just return the value
|
|
274
|
-
# @param [Object] value Any valid value
|
|
275
|
-
# @return [Hash] Returns the value in the form of hash
|
|
276
|
-
def _to_hash(value)
|
|
277
|
-
if value.is_a?(Array)
|
|
278
|
-
value.compact.map { |v| _to_hash(v) }
|
|
279
|
-
elsif value.is_a?(Hash)
|
|
280
|
-
{}.tap do |hash|
|
|
281
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
282
|
-
end
|
|
283
|
-
elsif value.respond_to? :to_hash
|
|
284
|
-
value.to_hash
|
|
285
|
-
else
|
|
286
|
-
value
|
|
287
|
-
end
|
|
288
|
-
end
|
|
289
|
-
|
|
290
|
-
end
|
|
291
|
-
|
|
292
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
|
|
13
|
-
# Unit tests for SnapTrade::OptionsApi
|
|
14
|
-
describe 'OptionsApi' do
|
|
15
|
-
before do
|
|
16
|
-
# run before each test
|
|
17
|
-
@api_instance = SnapTrade::OptionsApi.new
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
after do
|
|
21
|
-
# run after each test
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
describe 'test an instance of OptionsApi' do
|
|
25
|
-
it 'should create an instance of OptionsApi' do
|
|
26
|
-
expect(@api_instance).to be_instance_of(SnapTrade::OptionsApi)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# unit tests for list_option_holdings
|
|
31
|
-
# List account option positions
|
|
32
|
-
# **Deprecated.** Use the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions) instead. This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
33
|
-
# @param user_id
|
|
34
|
-
# @param user_secret
|
|
35
|
-
# @param account_id
|
|
36
|
-
# @param [Hash] opts the optional parameters
|
|
37
|
-
# @return [Array<OptionsPosition>]
|
|
38
|
-
describe 'list_option_holdings test' do
|
|
39
|
-
it 'should work' do
|
|
40
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
end
|