snaptrade 2.0.197 → 2.0.198
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 +1 -1
- data/README.md +38 -3
- data/lib/snaptrade/api/account_information_api.rb +4 -4
- data/lib/snaptrade/api/connections_api.rb +103 -0
- data/lib/snaptrade/models/account_value_history_item.rb +1 -1
- data/lib/snaptrade/models/exchange.rb +1 -1
- data/lib/snaptrade/models/performance_custom.rb +1 -1
- data/lib/snaptrade/models/symbol_exchange.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/spec/api/account_information_api_spec.rb +1 -1
- data/spec/api/connections_api_spec.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 549dce81d5aba7fd22eb51ae0c30a30bd265beaf349ae8e494d6f548e93d8dad
|
|
4
|
+
data.tar.gz: a848545dc765563b8f295e6fe64a440949290ebc37217b820e9c0f4397a998f3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5cf4015c11eff238a93863fe4cb99e9441693da9b9f5d1725f5014b168478fde0060e16bd66d997bfc5cbce3d875159b69b5a7026441e2e18d9bce411469672b
|
|
7
|
+
data.tar.gz: 33af1227b4f7025da23afe774d5b6abee0792678c0e55322ce30bab5d47c8a927623c93d72e62c653d976cb13b088217577548fcadd31ef15356849e097b7af2
|
data/Gemfile.lock
CHANGED
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
|
-
[](https://rubygems.org/gems/snaptrade/versions/2.0.198)
|
|
10
10
|
[](https://snaptrade.com/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
@@ -48,6 +48,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
48
48
|
* [`snaptrade.connections.remove_brokerage_authorization`](#snaptradeconnectionsremove_brokerage_authorization)
|
|
49
49
|
* [`snaptrade.connections.return_rates`](#snaptradeconnectionsreturn_rates)
|
|
50
50
|
* [`snaptrade.connections.session_events`](#snaptradeconnectionssession_events)
|
|
51
|
+
* [`snaptrade.connections.sync_brokerage_authorization_transactions`](#snaptradeconnectionssync_brokerage_authorization_transactions)
|
|
51
52
|
* [`snaptrade.options.list_option_holdings`](#snaptradeoptionslist_option_holdings)
|
|
52
53
|
* [`snaptrade.reference_data.get_currency_exchange_rate_pair`](#snaptradereference_dataget_currency_exchange_rate_pair)
|
|
53
54
|
* [`snaptrade.reference_data.get_partner_info`](#snaptradereference_dataget_partner_info)
|
|
@@ -87,7 +88,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
87
88
|
Add to Gemfile:
|
|
88
89
|
|
|
89
90
|
```ruby
|
|
90
|
-
gem 'snaptrade', '~> 2.0.
|
|
91
|
+
gem 'snaptrade', '~> 2.0.198'
|
|
91
92
|
```
|
|
92
93
|
|
|
93
94
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -486,7 +487,7 @@ p result
|
|
|
486
487
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
487
488
|
##### account_id: `String`<a id="account_id-string"></a>
|
|
488
489
|
##### state: `String`<a id="state-string"></a>
|
|
489
|
-
defaults
|
|
490
|
+
defaults to \"all\"
|
|
490
491
|
|
|
491
492
|
##### days: `Integer`<a id="days-integer"></a>
|
|
492
493
|
Number of days in the past to fetch the most recent orders. Defaults to the last
|
|
@@ -1299,6 +1300,40 @@ specific users
|
|
|
1299
1300
|
---
|
|
1300
1301
|
|
|
1301
1302
|
|
|
1303
|
+
### `snaptrade.connections.sync_brokerage_authorization_transactions`<a id="snaptradeconnectionssync_brokerage_authorization_transactions"></a>
|
|
1304
|
+
|
|
1305
|
+
Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
|
|
1306
|
+
|
|
1307
|
+
|
|
1308
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1309
|
+
|
|
1310
|
+
```ruby
|
|
1311
|
+
result = snaptrade.connections.sync_brokerage_authorization_transactions(
|
|
1312
|
+
authorization_id: "87b24961-b51e-4db8-9226-f198f6518a89",
|
|
1313
|
+
user_id: "snaptrade-user-123",
|
|
1314
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1315
|
+
)
|
|
1316
|
+
p result
|
|
1317
|
+
```
|
|
1318
|
+
|
|
1319
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1320
|
+
|
|
1321
|
+
##### authorization_id: `String`<a id="authorization_id-string"></a>
|
|
1322
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
1323
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
1324
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
1325
|
+
|
|
1326
|
+
[BrokerageAuthorizationTransactionsSyncConfirmation](./lib/snaptrade/models/brokerage_authorization_transactions_sync_confirmation.rb)
|
|
1327
|
+
|
|
1328
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1329
|
+
|
|
1330
|
+
`/authorizations/{authorizationId}/transactions/sync` `POST`
|
|
1331
|
+
|
|
1332
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1333
|
+
|
|
1334
|
+
---
|
|
1335
|
+
|
|
1336
|
+
|
|
1302
1337
|
### `snaptrade.options.list_option_holdings`<a id="snaptradeoptionslist_option_holdings"></a>
|
|
1303
1338
|
|
|
1304
1339
|
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).
|
|
@@ -888,7 +888,7 @@ module SnapTrade
|
|
|
888
888
|
# @param user_id [String]
|
|
889
889
|
# @param user_secret [String]
|
|
890
890
|
# @param account_id [String]
|
|
891
|
-
# @param state [String] defaults
|
|
891
|
+
# @param state [String] defaults to \"all\"
|
|
892
892
|
# @param days [Integer] Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
893
893
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
894
894
|
def get_user_account_orders(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
|
|
@@ -911,7 +911,7 @@ module SnapTrade
|
|
|
911
911
|
# @param user_id [String]
|
|
912
912
|
# @param user_secret [String]
|
|
913
913
|
# @param account_id [String]
|
|
914
|
-
# @param state [String] defaults
|
|
914
|
+
# @param state [String] defaults to \"all\"
|
|
915
915
|
# @param days [Integer] Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
916
916
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
917
917
|
def get_user_account_orders_with_http_info(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
|
|
@@ -926,7 +926,7 @@ module SnapTrade
|
|
|
926
926
|
# @param user_secret [String]
|
|
927
927
|
# @param account_id [String]
|
|
928
928
|
# @param [Hash] opts the optional parameters
|
|
929
|
-
# @option opts [String] :state defaults
|
|
929
|
+
# @option opts [String] :state defaults to \"all\"
|
|
930
930
|
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
931
931
|
# @return [Array<AccountOrderRecord>]
|
|
932
932
|
private def get_user_account_orders_impl(user_id, user_secret, account_id, opts = {})
|
|
@@ -940,7 +940,7 @@ module SnapTrade
|
|
|
940
940
|
# @param user_secret [String]
|
|
941
941
|
# @param account_id [String]
|
|
942
942
|
# @param [Hash] opts the optional parameters
|
|
943
|
-
# @option opts [String] :state defaults
|
|
943
|
+
# @option opts [String] :state defaults to \"all\"
|
|
944
944
|
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
945
945
|
# @return [Array<(Array<AccountOrderRecord>, Integer, Hash)>] Array<AccountOrderRecord> data, response status code and response headers
|
|
946
946
|
private def get_user_account_orders_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
|
@@ -970,6 +970,109 @@ module SnapTrade
|
|
|
970
970
|
end
|
|
971
971
|
return data, status_code, headers, response
|
|
972
972
|
end
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
# Sync transactions for a connection
|
|
976
|
+
#
|
|
977
|
+
# Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
|
|
978
|
+
#
|
|
979
|
+
# @param authorization_id [String]
|
|
980
|
+
# @param user_id [String]
|
|
981
|
+
# @param user_secret [String]
|
|
982
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
983
|
+
def sync_brokerage_authorization_transactions(authorization_id:, user_id:, user_secret:, extra: {})
|
|
984
|
+
data, _status_code, _headers = sync_brokerage_authorization_transactions_with_http_info_impl(authorization_id, user_id, user_secret, extra)
|
|
985
|
+
data
|
|
986
|
+
end
|
|
987
|
+
|
|
988
|
+
# Sync transactions for a connection
|
|
989
|
+
#
|
|
990
|
+
# Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
|
|
991
|
+
#
|
|
992
|
+
# @param authorization_id [String]
|
|
993
|
+
# @param user_id [String]
|
|
994
|
+
# @param user_secret [String]
|
|
995
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
996
|
+
def sync_brokerage_authorization_transactions_with_http_info(authorization_id:, user_id:, user_secret:, extra: {})
|
|
997
|
+
sync_brokerage_authorization_transactions_with_http_info_impl(authorization_id, user_id, user_secret, extra)
|
|
998
|
+
end
|
|
999
|
+
|
|
1000
|
+
# Sync transactions for a connection
|
|
1001
|
+
# Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
|
|
1002
|
+
# @param authorization_id [String]
|
|
1003
|
+
# @param user_id [String]
|
|
1004
|
+
# @param user_secret [String]
|
|
1005
|
+
# @param [Hash] opts the optional parameters
|
|
1006
|
+
# @return [BrokerageAuthorizationTransactionsSyncConfirmation]
|
|
1007
|
+
private def sync_brokerage_authorization_transactions_impl(authorization_id, user_id, user_secret, opts = {})
|
|
1008
|
+
data, _status_code, _headers = sync_brokerage_authorization_transactions_with_http_info(authorization_id, user_id, user_secret, opts)
|
|
1009
|
+
data
|
|
1010
|
+
end
|
|
1011
|
+
|
|
1012
|
+
# Sync transactions for a connection
|
|
1013
|
+
# Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
|
|
1014
|
+
# @param authorization_id [String]
|
|
1015
|
+
# @param user_id [String]
|
|
1016
|
+
# @param user_secret [String]
|
|
1017
|
+
# @param [Hash] opts the optional parameters
|
|
1018
|
+
# @return [Array<(BrokerageAuthorizationTransactionsSyncConfirmation, Integer, Hash)>] BrokerageAuthorizationTransactionsSyncConfirmation data, response status code and response headers
|
|
1019
|
+
private def sync_brokerage_authorization_transactions_with_http_info_impl(authorization_id, user_id, user_secret, opts = {})
|
|
1020
|
+
if @api_client.config.debugging
|
|
1021
|
+
@api_client.config.logger.debug 'Calling API: ConnectionsApi.sync_brokerage_authorization_transactions ...'
|
|
1022
|
+
end
|
|
1023
|
+
# verify the required parameter 'authorization_id' is set
|
|
1024
|
+
if @api_client.config.client_side_validation && authorization_id.nil?
|
|
1025
|
+
fail ArgumentError, "Missing the required parameter 'authorization_id' when calling ConnectionsApi.sync_brokerage_authorization_transactions"
|
|
1026
|
+
end
|
|
1027
|
+
# verify the required parameter 'user_id' is set
|
|
1028
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
|
1029
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling ConnectionsApi.sync_brokerage_authorization_transactions"
|
|
1030
|
+
end
|
|
1031
|
+
# verify the required parameter 'user_secret' is set
|
|
1032
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
|
1033
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling ConnectionsApi.sync_brokerage_authorization_transactions"
|
|
1034
|
+
end
|
|
1035
|
+
# resource path
|
|
1036
|
+
local_var_path = '/authorizations/{authorizationId}/transactions/sync'.sub('{' + 'authorizationId' + '}', CGI.escape(authorization_id.to_s))
|
|
1037
|
+
|
|
1038
|
+
# query parameters
|
|
1039
|
+
query_params = opts[:query_params] || {}
|
|
1040
|
+
query_params[:'userId'] = user_id
|
|
1041
|
+
query_params[:'userSecret'] = user_secret
|
|
1042
|
+
|
|
1043
|
+
# header parameters
|
|
1044
|
+
header_params = opts[:header_params] || {}
|
|
1045
|
+
# HTTP header 'Accept' (if needed)
|
|
1046
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
1047
|
+
|
|
1048
|
+
# form parameters
|
|
1049
|
+
form_params = opts[:form_params] || {}
|
|
1050
|
+
|
|
1051
|
+
# http body (model)
|
|
1052
|
+
post_body = opts[:debug_body]
|
|
1053
|
+
|
|
1054
|
+
# return_type
|
|
1055
|
+
return_type = opts[:debug_return_type] || 'BrokerageAuthorizationTransactionsSyncConfirmation'
|
|
1056
|
+
|
|
1057
|
+
# auth_names
|
|
1058
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
1059
|
+
|
|
1060
|
+
new_options = opts.merge(
|
|
1061
|
+
:operation => :"ConnectionsApi.sync_brokerage_authorization_transactions",
|
|
1062
|
+
:header_params => header_params,
|
|
1063
|
+
:query_params => query_params,
|
|
1064
|
+
:form_params => form_params,
|
|
1065
|
+
:body => post_body,
|
|
1066
|
+
:auth_names => auth_names,
|
|
1067
|
+
:return_type => return_type
|
|
1068
|
+
)
|
|
1069
|
+
|
|
1070
|
+
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
|
1071
|
+
if @api_client.config.debugging
|
|
1072
|
+
@api_client.config.logger.debug "API called: ConnectionsApi#sync_brokerage_authorization_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
1073
|
+
end
|
|
1074
|
+
return data, status_code, headers, response
|
|
1075
|
+
end
|
|
973
1076
|
end
|
|
974
1077
|
|
|
975
1078
|
# top-level client access to avoid having the user to insantiate their own API instances
|
|
@@ -11,7 +11,7 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module SnapTrade
|
|
14
|
-
# The
|
|
14
|
+
# The estimated account value at a specific point in time.
|
|
15
15
|
class AccountValueHistoryItem
|
|
16
16
|
# The date of the estimated account value
|
|
17
17
|
attr_accessor :date
|
|
@@ -16,7 +16,7 @@ module SnapTrade
|
|
|
16
16
|
# Unique ID for the exchange in SnapTrade.
|
|
17
17
|
attr_accessor :id
|
|
18
18
|
|
|
19
|
-
# A short name for the exchange. For standardized exchange code, please
|
|
19
|
+
# A short name for the exchange. For standardized exchange code, please use the `mic_code` field.
|
|
20
20
|
attr_accessor :code
|
|
21
21
|
|
|
22
22
|
# The [Market Identifier Code](https://en.wikipedia.org/wiki/Market_Identifier_Code) (MIC) for the exchange.
|
|
@@ -23,7 +23,7 @@ module SnapTrade
|
|
|
23
23
|
|
|
24
24
|
attr_accessor :withdrawal_timeframe
|
|
25
25
|
|
|
26
|
-
# Current streak of
|
|
26
|
+
# Current streak of consecutive months where contributions were made
|
|
27
27
|
attr_accessor :contribution_streak
|
|
28
28
|
|
|
29
29
|
# Number of months in the timeframe with contributions
|
|
@@ -16,7 +16,7 @@ module SnapTrade
|
|
|
16
16
|
# Unique ID for the exchange in SnapTrade.
|
|
17
17
|
attr_accessor :id
|
|
18
18
|
|
|
19
|
-
# A short name for the exchange. For standardized exchange code, please
|
|
19
|
+
# A short name for the exchange. For standardized exchange code, please use the `mic_code` field.
|
|
20
20
|
attr_accessor :code
|
|
21
21
|
|
|
22
22
|
# The [Market Identifier Code](https://en.wikipedia.org/wiki/Market_Identifier_Code) (MIC) for the exchange.
|
data/lib/snaptrade/version.rb
CHANGED
|
@@ -138,7 +138,7 @@ describe 'AccountInformationApi' do
|
|
|
138
138
|
# @param user_secret
|
|
139
139
|
# @param account_id
|
|
140
140
|
# @param [Hash] opts the optional parameters
|
|
141
|
-
# @option opts [String] :state defaults
|
|
141
|
+
# @option opts [String] :state defaults to \"all\"
|
|
142
142
|
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
143
143
|
# @return [Array<AccountOrderRecord>]
|
|
144
144
|
describe 'get_user_account_orders test' do
|
|
@@ -153,4 +153,18 @@ describe 'ConnectionsApi' do
|
|
|
153
153
|
end
|
|
154
154
|
end
|
|
155
155
|
|
|
156
|
+
# unit tests for sync_brokerage_authorization_transactions
|
|
157
|
+
# Sync transactions for a connection
|
|
158
|
+
# Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
|
|
159
|
+
# @param authorization_id
|
|
160
|
+
# @param user_id
|
|
161
|
+
# @param user_secret
|
|
162
|
+
# @param [Hash] opts the optional parameters
|
|
163
|
+
# @return [BrokerageAuthorizationTransactionsSyncConfirmation]
|
|
164
|
+
describe 'sync_brokerage_authorization_transactions test' do
|
|
165
|
+
it 'should work' do
|
|
166
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
156
170
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: snaptrade
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.198
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SnapTrade
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-05-
|
|
11
|
+
date: 2026-05-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|