snaptrade 2.0.218 → 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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/README.md +20 -549
  4. data/lib/snaptrade/api/account_information_api.rb +0 -231
  5. data/lib/snaptrade/api/connections_api.rb +0 -201
  6. data/lib/snaptrade/api/experimental_endpoints_api.rb +123 -0
  7. data/lib/snaptrade/api/reference_data_api.rb +0 -316
  8. data/lib/snaptrade/api/trading_api.rb +0 -290
  9. data/lib/snaptrade/models/connection_account.rb +51 -0
  10. data/lib/snaptrade/models/{connections_session_events200_response_inner.rb → connection_account_sync_status.rb} +35 -77
  11. data/lib/snaptrade/models/investment_account.rb +372 -0
  12. data/lib/snaptrade/models/investment_account_market_value.rb +228 -0
  13. data/lib/snaptrade/models/kind.rb +2 -2
  14. data/lib/snaptrade/models/stock_instrument.rb +1 -1
  15. data/lib/snaptrade/models/stock_instrument_kind.rb +36 -0
  16. data/lib/snaptrade/version.rb +1 -1
  17. data/lib/snaptrade.rb +5 -7
  18. data/spec/api/account_information_api_spec.rb +0 -28
  19. data/spec/api/connections_api_spec.rb +0 -28
  20. data/spec/api/experimental_endpoints_api_spec.rb +14 -0
  21. data/spec/api/reference_data_api_spec.rb +0 -45
  22. data/spec/api/trading_api_spec.rb +0 -30
  23. data/spec/getting_started_spec.rb +6 -6
  24. data/spec/models/connection_account_spec.rb +38 -0
  25. data/spec/models/connection_account_sync_status_spec.rb +47 -0
  26. data/spec/models/investment_account_market_value_spec.rb +35 -0
  27. data/spec/models/investment_account_spec.rb +101 -0
  28. data/spec/models/stock_instrument_kind_spec.rb +23 -0
  29. metadata +212 -206
  30. data/lib/snaptrade/api/options_api.rb +0 -137
  31. data/lib/snaptrade/api/transactions_and_reporting_api.rb +0 -302
  32. data/spec/api/options_api_spec.rb +0 -44
  33. data/spec/api/transactions_and_reporting_api_spec.rb +0 -66
  34. data/spec/models/connections_session_events200_response_inner_spec.rb +0 -65
@@ -1,137 +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 OptionsApi
14
- attr_accessor :api_client
15
-
16
- def initialize(api_client = ApiClient.default)
17
- @api_client = api_client
18
- end
19
-
20
- # List account option positions
21
- #
22
- # **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.
23
- #
24
- # 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).
25
- #
26
- # 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:
27
- # - If you do, this endpoint returns real-time data.
28
- # - 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.
29
- #
30
- # @param user_id [String]
31
- # @param user_secret [String]
32
- # @param account_id [String]
33
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
34
- def list_option_holdings(user_id:, user_secret:, account_id:, extra: {})
35
- data, _status_code, _headers = list_option_holdings_with_http_info_impl(user_id, user_secret, account_id, extra)
36
- data
37
- end
38
-
39
- # List account option positions
40
- #
41
- # **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.
42
- #
43
- # 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).
44
- #
45
- # 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:
46
- # - If you do, this endpoint returns real-time data.
47
- # - 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.
48
- #
49
- # @param user_id [String]
50
- # @param user_secret [String]
51
- # @param account_id [String]
52
- # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
53
- def list_option_holdings_with_http_info(user_id:, user_secret:, account_id:, extra: {})
54
- list_option_holdings_with_http_info_impl(user_id, user_secret, account_id, extra)
55
- end
56
-
57
- # List account option positions
58
- # **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.
59
- # @param user_id [String]
60
- # @param user_secret [String]
61
- # @param account_id [String]
62
- # @param [Hash] opts the optional parameters
63
- # @return [Array<OptionsPosition>]
64
- private def list_option_holdings_impl(user_id, user_secret, account_id, opts = {})
65
- data, _status_code, _headers = list_option_holdings_with_http_info(user_id, user_secret, account_id, opts)
66
- data
67
- end
68
-
69
- # List account option positions
70
- # **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&#39;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.
71
- # @param user_id [String]
72
- # @param user_secret [String]
73
- # @param account_id [String]
74
- # @param [Hash] opts the optional parameters
75
- # @return [Array<(Array<OptionsPosition>, Integer, Hash)>] Array<OptionsPosition> data, response status code and response headers
76
- private def list_option_holdings_with_http_info_impl(user_id, user_secret, account_id, opts = {})
77
- if @api_client.config.debugging
78
- @api_client.config.logger.debug 'Calling API: OptionsApi.list_option_holdings ...'
79
- end
80
- # verify the required parameter 'user_id' is set
81
- if @api_client.config.client_side_validation && user_id.nil?
82
- fail ArgumentError, "Missing the required parameter 'user_id' when calling OptionsApi.list_option_holdings"
83
- end
84
- # verify the required parameter 'user_secret' is set
85
- if @api_client.config.client_side_validation && user_secret.nil?
86
- fail ArgumentError, "Missing the required parameter 'user_secret' when calling OptionsApi.list_option_holdings"
87
- end
88
- # verify the required parameter 'account_id' is set
89
- if @api_client.config.client_side_validation && account_id.nil?
90
- fail ArgumentError, "Missing the required parameter 'account_id' when calling OptionsApi.list_option_holdings"
91
- end
92
- # resource path
93
- local_var_path = '/accounts/{accountId}/options'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
94
-
95
- # query parameters
96
- query_params = opts[:query_params] || {}
97
- query_params[:'userId'] = user_id
98
- query_params[:'userSecret'] = user_secret
99
-
100
- # header parameters
101
- header_params = opts[:header_params] || {}
102
- # HTTP header 'Accept' (if needed)
103
- header_params['Accept'] = @api_client.select_header_accept(['application/json'])
104
-
105
- # form parameters
106
- form_params = opts[:form_params] || {}
107
-
108
- # http body (model)
109
- post_body = opts[:debug_body]
110
-
111
- # return_type
112
- return_type = opts[:debug_return_type] || 'Array<OptionsPosition>'
113
-
114
- # auth_names
115
- auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
116
-
117
- new_options = opts.merge(
118
- :operation => :"OptionsApi.list_option_holdings",
119
- :header_params => header_params,
120
- :query_params => query_params,
121
- :form_params => form_params,
122
- :body => post_body,
123
- :auth_names => auth_names,
124
- :return_type => return_type
125
- )
126
-
127
- data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
128
- if @api_client.config.debugging
129
- @api_client.config.logger.debug "API called: OptionsApi#list_option_holdings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
130
- end
131
- return data, status_code, headers, response
132
- end
133
- end
134
-
135
- # top-level client access to avoid having the user to insantiate their own API instances
136
- Options = OptionsApi::new
137
- end
@@ -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&#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. 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,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&#39;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
@@ -1,66 +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::TransactionsAndReportingApi
14
- describe 'TransactionsAndReportingApi' do
15
- before do
16
- # run before each test
17
- @api_instance = SnapTrade::TransactionsAndReportingApi.new
18
- end
19
-
20
- after do
21
- # run after each test
22
- end
23
-
24
- describe 'test an instance of TransactionsAndReportingApi' do
25
- it 'should create an instance of TransactionsAndReportingApi' do
26
- expect(@api_instance).to be_instance_of(SnapTrade::TransactionsAndReportingApi)
27
- end
28
- end
29
-
30
- # unit tests for get_activities
31
- # Get transaction history for a user
32
- # **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&#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. This endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage.
33
- # @param user_id
34
- # @param user_secret
35
- # @param [Hash] opts the optional parameters
36
- # @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 &#x60;trade_date&#x60;.
37
- # @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 &#x60;trade_date&#x60;.
38
- # @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 &#x60;brokerageAuthorizations&#x60; parameter takes precedence over this parameter.
39
- # @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 &#x60;accounts&#x60; parameter.
40
- # @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: - &#x60;BUY&#x60; - Asset bought. - &#x60;SELL&#x60; - Asset sold. - &#x60;DIVIDEND&#x60; - Dividend payout. - &#x60;SUBSTITUTE_DIVIDEND&#x60; - Payment in lieu of a dividend. - &#x60;CONTRIBUTION&#x60; - Cash contribution. - &#x60;WITHDRAWAL&#x60; - Cash withdrawal. - &#x60;REI&#x60; - Dividend reinvestment. - &#x60;INTEREST&#x60; - Interest deposited into the account. - &#x60;FEE&#x60; - Fee withdrawn from the account. - &#x60;OPTIONEXPIRATION&#x60; - Option expiration event. - &#x60;OPTIONASSIGNMENT&#x60; - Option assignment event. - &#x60;OPTIONEXERCISE&#x60; - Option exercise event. - &#x60;TRANSFER&#x60; - Transfer of assets from one account to another
41
- # @return [Array<UniversalActivity>]
42
- describe 'get_activities test' do
43
- it 'should work' do
44
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
45
- end
46
- end
47
-
48
- # unit tests for get_reporting_custom_range
49
- # Get performance information for a specific timeframe
50
- # **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.
51
- # @param start_date
52
- # @param end_date
53
- # @param user_id
54
- # @param user_secret
55
- # @param [Hash] opts the optional parameters
56
- # @option opts [String] :accounts Optional comma separated list of account IDs used to filter the request on specific accounts
57
- # @option opts [Boolean] :detailed Optional, increases frequency of data points for the total value and contribution charts if set to true
58
- # @option opts [String] :frequency Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly.
59
- # @return [PerformanceCustom]
60
- describe 'get_reporting_custom_range test' do
61
- it 'should work' do
62
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
63
- end
64
- end
65
-
66
- end
@@ -1,65 +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
- require 'date'
13
-
14
- # Unit tests for SnapTrade::ConnectionsSessionEvents200ResponseInner
15
- describe SnapTrade::ConnectionsSessionEvents200ResponseInner do
16
- let(:instance) { SnapTrade::ConnectionsSessionEvents200ResponseInner.new }
17
-
18
- describe 'test an instance of ConnectionsSessionEvents200ResponseInner' do
19
- it 'should create an instance of ConnectionsSessionEvents200ResponseInner' do
20
- expect(instance).to be_instance_of(SnapTrade::ConnectionsSessionEvents200ResponseInner)
21
- end
22
- end
23
- describe 'test attribute "id"' do
24
- it 'should work' do
25
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
26
- end
27
- end
28
-
29
- describe 'test attribute "session_event_type"' do
30
- it 'should work' do
31
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
32
- end
33
- end
34
-
35
- describe 'test attribute "session_id"' do
36
- it 'should work' do
37
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
- end
39
- end
40
-
41
- describe 'test attribute "user_id"' do
42
- it 'should work' do
43
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
- end
45
- end
46
-
47
- describe 'test attribute "created_date"' do
48
- it 'should work' do
49
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
- end
51
- end
52
-
53
- describe 'test attribute "brokerage_status_code"' do
54
- it 'should work' do
55
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
- end
57
- end
58
-
59
- describe 'test attribute "brokerage_authorization_id"' do
60
- it 'should work' do
61
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
62
- end
63
- end
64
-
65
- end