snaptrade 1.7.0 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +16 -52
- data/docs/AccountInformationApi.md +18 -18
- data/docs/AuthenticationApi.md +20 -20
- data/docs/OptionsApi.md +2 -2
- data/docs/ReferenceDataApi.md +20 -20
- data/docs/TradingApi.md +0 -321
- data/docs/TransactionsAndReportingApi.md +1 -1
- data/lib/snaptrade/api/account_information_api.rb +19 -19
- data/lib/snaptrade/api/authentication_api.rb +20 -20
- data/lib/snaptrade/api/options_api.rb +3 -3
- data/lib/snaptrade/api/reference_data_api.rb +20 -20
- data/lib/snaptrade/api/trading_api.rb +0 -409
- data/lib/snaptrade/api/transactions_and_reporting_api.rb +4 -4
- data/lib/snaptrade/models/account_holdings.rb +2 -0
- data/lib/snaptrade/models/account_holdings_account.rb +3 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +0 -3
- data/spec/api/account_information_api_spec.rb +5 -5
- data/spec/api/authentication_api_spec.rb +5 -5
- data/spec/api/options_api_spec.rb +1 -1
- data/spec/api/reference_data_api_spec.rb +5 -5
- data/spec/api/trading_api_spec.rb +0 -51
- data/spec/api/transactions_and_reporting_api_spec.rb +1 -1
- data/spec/getting_started_spec.rb +0 -36
- metadata +2 -6
- data/docs/PortfolioManagementApi.md +0 -2064
- data/lib/snaptrade/api/portfolio_management_api.rb +0 -2867
- data/spec/api/portfolio_management_api_spec.rb +0 -403
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -150,7 +150,6 @@ require 'snaptrade/api/authentication_api'
|
|
150
150
|
require 'snaptrade/api/connections_api'
|
151
151
|
require 'snaptrade/api/error_logs_api'
|
152
152
|
require 'snaptrade/api/options_api'
|
153
|
-
require 'snaptrade/api/portfolio_management_api'
|
154
153
|
require 'snaptrade/api/reference_data_api'
|
155
154
|
require 'snaptrade/api/trading_api'
|
156
155
|
require 'snaptrade/api/transactions_and_reporting_api'
|
@@ -192,7 +191,6 @@ module SnapTrade
|
|
192
191
|
attr_accessor :connections
|
193
192
|
attr_accessor :error_logs
|
194
193
|
attr_accessor :options
|
195
|
-
attr_accessor :portfolio_management
|
196
194
|
attr_accessor :reference_data
|
197
195
|
attr_accessor :trading
|
198
196
|
attr_accessor :transactions_and_reporting
|
@@ -205,7 +203,6 @@ module SnapTrade
|
|
205
203
|
@connections = SnapTrade::ConnectionsApi.new(@api_client)
|
206
204
|
@error_logs = SnapTrade::ErrorLogsApi.new(@api_client)
|
207
205
|
@options = SnapTrade::OptionsApi.new(@api_client)
|
208
|
-
@portfolio_management = SnapTrade::PortfolioManagementApi.new(@api_client)
|
209
206
|
@reference_data = SnapTrade::ReferenceDataApi.new(@api_client)
|
210
207
|
@trading = SnapTrade::TradingApi.new(@api_client)
|
211
208
|
@transactions_and_reporting = SnapTrade::TransactionsAndReportingApi.new(@api_client)
|
@@ -29,7 +29,7 @@ describe 'AccountInformationApi' do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
# unit tests for get_all_user_holdings
|
32
|
-
# List all accounts for the user, plus balances and
|
32
|
+
# List all accounts for the user, plus balances, positions, and orders for each account.
|
33
33
|
# @param user_id
|
34
34
|
# @param user_secret
|
35
35
|
# @param [Hash] opts the optional parameters
|
@@ -42,7 +42,7 @@ describe 'AccountInformationApi' do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
# unit tests for get_user_account_balance
|
45
|
-
#
|
45
|
+
# List account balances
|
46
46
|
# @param user_id
|
47
47
|
# @param user_secret
|
48
48
|
# @param account_id The ID of the account get positions.
|
@@ -60,7 +60,7 @@ describe 'AccountInformationApi' do
|
|
60
60
|
# @param user_secret
|
61
61
|
# @param account_id The ID of the account to get detail of.
|
62
62
|
# @param [Hash] opts the optional parameters
|
63
|
-
# @return [
|
63
|
+
# @return [Account]
|
64
64
|
describe 'get_user_account_details test' do
|
65
65
|
it 'should work' do
|
66
66
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
@@ -82,7 +82,7 @@ describe 'AccountInformationApi' do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
# unit tests for get_user_account_positions
|
85
|
-
#
|
85
|
+
# List account positions
|
86
86
|
# @param user_id
|
87
87
|
# @param user_secret
|
88
88
|
# @param account_id The ID of the account get positions.
|
@@ -108,7 +108,7 @@ describe 'AccountInformationApi' do
|
|
108
108
|
end
|
109
109
|
|
110
110
|
# unit tests for list_user_accounts
|
111
|
-
# List
|
111
|
+
# List accounts
|
112
112
|
# @param user_id
|
113
113
|
# @param user_secret
|
114
114
|
# @param [Hash] opts the optional parameters
|
@@ -29,7 +29,7 @@ describe 'AuthenticationApi' do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
# unit tests for delete_snap_trade_user
|
32
|
-
# Delete
|
32
|
+
# Delete SnapTrade user
|
33
33
|
# @param user_id
|
34
34
|
# @param [Hash] opts the optional parameters
|
35
35
|
# @return [DeleteUserResponse]
|
@@ -40,7 +40,7 @@ describe 'AuthenticationApi' do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
# unit tests for get_user_jwt
|
43
|
-
#
|
43
|
+
# Generate encrypted JWT token
|
44
44
|
# @param user_id
|
45
45
|
# @param user_secret
|
46
46
|
# @param [Hash] opts the optional parameters
|
@@ -52,7 +52,7 @@ describe 'AuthenticationApi' do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
# unit tests for list_snap_trade_users
|
55
|
-
#
|
55
|
+
# List SnapTrade users
|
56
56
|
# @param [Hash] opts the optional parameters
|
57
57
|
# @return [Array<String>]
|
58
58
|
describe 'list_snap_trade_users test' do
|
@@ -62,7 +62,7 @@ describe 'AuthenticationApi' do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
# unit tests for login_snap_trade_user
|
65
|
-
#
|
65
|
+
# Login user & generate connection link
|
66
66
|
# @param user_id
|
67
67
|
# @param user_secret
|
68
68
|
# @param [Hash] opts the optional parameters
|
@@ -75,7 +75,7 @@ describe 'AuthenticationApi' do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
# unit tests for register_snap_trade_user
|
78
|
-
#
|
78
|
+
# Create SnapTrade user
|
79
79
|
# @param snap_trade_register_user_request_body
|
80
80
|
# @param [Hash] opts the optional parameters
|
81
81
|
# @return [UserIDandSecret]
|
@@ -76,7 +76,7 @@ describe 'OptionsApi' do
|
|
76
76
|
# @param user_secret
|
77
77
|
# @param account_id The ID of the account get positions.
|
78
78
|
# @param [Hash] opts the optional parameters
|
79
|
-
# @return [
|
79
|
+
# @return [Array<OptionsPosition>]
|
80
80
|
describe 'list_option_holdings test' do
|
81
81
|
it 'should work' do
|
82
82
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
@@ -60,7 +60,7 @@ describe 'ReferenceDataApi' do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
# unit tests for get_stock_exchanges
|
63
|
-
#
|
63
|
+
# List exchanges
|
64
64
|
# @param [Hash] opts the optional parameters
|
65
65
|
# @return [Array<Exchange>]
|
66
66
|
describe 'get_stock_exchanges test' do
|
@@ -104,7 +104,7 @@ describe 'ReferenceDataApi' do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
# unit tests for list_all_brokerages
|
107
|
-
# List
|
107
|
+
# List brokerages
|
108
108
|
# @param [Hash] opts the optional parameters
|
109
109
|
# @return [Array<Brokerage>]
|
110
110
|
describe 'list_all_brokerages test' do
|
@@ -114,7 +114,7 @@ describe 'ReferenceDataApi' do
|
|
114
114
|
end
|
115
115
|
|
116
116
|
# unit tests for list_all_currencies
|
117
|
-
# List
|
117
|
+
# List currencies
|
118
118
|
# @param [Hash] opts the optional parameters
|
119
119
|
# @return [Array<Currency>]
|
120
120
|
describe 'list_all_currencies test' do
|
@@ -124,7 +124,7 @@ describe 'ReferenceDataApi' do
|
|
124
124
|
end
|
125
125
|
|
126
126
|
# unit tests for list_all_currencies_rates
|
127
|
-
#
|
127
|
+
# List currency exchange rates
|
128
128
|
# @param [Hash] opts the optional parameters
|
129
129
|
# @return [Array<ExchangeRatePairs>]
|
130
130
|
describe 'list_all_currencies_rates test' do
|
@@ -134,7 +134,7 @@ describe 'ReferenceDataApi' do
|
|
134
134
|
end
|
135
135
|
|
136
136
|
# unit tests for symbol_search_user_account
|
137
|
-
# Search for symbols
|
137
|
+
# Search for symbols available in an account
|
138
138
|
# @param user_id
|
139
139
|
# @param user_secret
|
140
140
|
# @param account_id The ID of the account get positions.
|
@@ -42,31 +42,6 @@ describe 'TradingApi' do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
# unit tests for get_calculated_trade_impact_by_id
|
46
|
-
# Return details of a specific trade before it's placed
|
47
|
-
# @param portfolio_group_id The ID of the PortfolioGroup to perform rebalancing calculations
|
48
|
-
# @param calculated_trade_id The ID of calculated trade to get account impact
|
49
|
-
# @param trade_id The ID of trade object
|
50
|
-
# @param [Hash] opts the optional parameters
|
51
|
-
# @return [Trade]
|
52
|
-
describe 'get_calculated_trade_impact_by_id test' do
|
53
|
-
it 'should work' do
|
54
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
# unit tests for get_calculated_trades_impact
|
59
|
-
# Return the impact of placing a series of trades on the portfolio
|
60
|
-
# @param portfolio_group_id The ID of the PortfolioGroup to perform rebalancing calculations
|
61
|
-
# @param calculated_trade_id The ID of calculated trade to get account impact
|
62
|
-
# @param [Hash] opts the optional parameters
|
63
|
-
# @return [Array<TradeImpact>]
|
64
|
-
describe 'get_calculated_trades_impact test' do
|
65
|
-
it 'should work' do
|
66
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
45
|
# unit tests for get_order_impact
|
71
46
|
# Check impact of trades on account.
|
72
47
|
# @param user_id
|
@@ -95,32 +70,6 @@ describe 'TradingApi' do
|
|
95
70
|
end
|
96
71
|
end
|
97
72
|
|
98
|
-
# unit tests for modify_calculated_trade_by_id
|
99
|
-
# Modify units of a trade before it is placed
|
100
|
-
# @param portfolio_group_id The ID of the PortfolioGroup to perform rebalancing calculations
|
101
|
-
# @param calculated_trade_id The ID of calculated trade to get account impact
|
102
|
-
# @param trade_id The ID of trade object
|
103
|
-
# @param [Hash] opts the optional parameters
|
104
|
-
# @option opts [Trade] :trade
|
105
|
-
# @return [Trade]
|
106
|
-
describe 'modify_calculated_trade_by_id test' do
|
107
|
-
it 'should work' do
|
108
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
# unit tests for place_calculated_trades
|
113
|
-
# Place orders for the CalculatedTrades in series
|
114
|
-
# @param portfolio_group_id The ID of the PortfolioGroup to perform rebalancing calculations
|
115
|
-
# @param calculated_trade_id The ID of calculated trade to get account impact
|
116
|
-
# @param [Hash] opts the optional parameters
|
117
|
-
# @return [Array<TradeExecutionStatus>]
|
118
|
-
describe 'place_calculated_trades test' do
|
119
|
-
it 'should work' do
|
120
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
73
|
# unit tests for place_force_order
|
125
74
|
# Place a trade with NO validation.
|
126
75
|
# @param user_id
|
@@ -38,7 +38,7 @@ describe 'TransactionsAndReportingApi' do
|
|
38
38
|
# @option opts [Date] :end_date
|
39
39
|
# @option opts [String] :accounts Optional comma seperated list of account IDs used to filter the request on specific accounts
|
40
40
|
# @option opts [String] :brokerage_authorizations Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations
|
41
|
-
# @option opts [String] :type Optional comma seperated list of types to filter activities by. Potential values include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT
|
41
|
+
# @option opts [String] :type Optional comma seperated list of types to filter activities by. This is not an exhaustive list, if we fail to match to these types, we will return the raw description from the brokerage. Potential values include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT
|
42
42
|
# @return [Array<UniversalActivity>]
|
43
43
|
describe 'get_activities test' do
|
44
44
|
it 'should work' do
|
@@ -22,29 +22,6 @@ describe 'GettingStarted' do
|
|
22
22
|
# run after each test
|
23
23
|
end
|
24
24
|
|
25
|
-
describe 'non object body parameter' do
|
26
|
-
it 'should work' do
|
27
|
-
configuration = SnapTrade::Configuration.new
|
28
|
-
configuration.client_id = ENV["SNAPTRADE_CLIENT_ID"]
|
29
|
-
configuration.consumer_key = ENV["SNAPTRADE_CONSUMER_KEY"]
|
30
|
-
configuration.host = "http://127.0.0.1:4010"
|
31
|
-
snaptrade = SnapTrade::Client.new(configuration)
|
32
|
-
|
33
|
-
data = snaptrade.portfolio_management.set_portfolio_targets(
|
34
|
-
portfolio_group_id: SecureRandom.uuid,
|
35
|
-
body: [{
|
36
|
-
"id" => SecureRandom.uuid,
|
37
|
-
"symbol" => {
|
38
|
-
"id" => SecureRandom.uuid,
|
39
|
-
"symbol" => "VOO"
|
40
|
-
}
|
41
|
-
}]
|
42
|
-
)
|
43
|
-
puts data
|
44
|
-
expect(data).not_to be_nil
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
25
|
describe 'optional non body parameters should be passed' do
|
49
26
|
it 'should pass' do
|
50
27
|
configuration = SnapTrade::Configuration.new
|
@@ -86,15 +63,6 @@ describe 'GettingStarted' do
|
|
86
63
|
redirect_uri = SnapTrade::Authentication.login_snap_trade_user(user_id: user_id, user_secret: response.user_secret)
|
87
64
|
puts redirect_uri
|
88
65
|
|
89
|
-
SnapTrade::PortfolioManagement.create(
|
90
|
-
user_id: user_id,
|
91
|
-
user_secret: response.user_secret,
|
92
|
-
id: SecureRandom.uuid,
|
93
|
-
name: "MyPortfolio"
|
94
|
-
)
|
95
|
-
portfolios = SnapTrade::PortfolioManagement.list(user_id: user_id, user_secret: response.user_secret)
|
96
|
-
puts portfolios
|
97
|
-
|
98
66
|
# 5) Obtaining account holdings data
|
99
67
|
holdings = SnapTrade::AccountInformation.get_all_user_holdings(user_id: user_id, user_secret: response.user_secret)
|
100
68
|
puts holdings
|
@@ -127,10 +95,6 @@ describe 'GettingStarted' do
|
|
127
95
|
redirect_uri = snaptrade.authentication.login_snap_trade_user(user_id: user_id, user_secret: response.user_secret)
|
128
96
|
puts redirect_uri
|
129
97
|
|
130
|
-
snaptrade.portfolio_management.create(user_id: user_id, user_secret: response.user_secret, id: SecureRandom.uuid, name: "MyPortfolio")
|
131
|
-
portfolios = snaptrade.portfolio_management.list(user_id: user_id, user_secret: response.user_secret)
|
132
|
-
puts portfolios
|
133
|
-
|
134
98
|
# 5) Obtaining account holdings data
|
135
99
|
holdings = snaptrade.account_information.get_all_user_holdings(user_id: user_id, user_secret: response.user_secret)
|
136
100
|
puts holdings
|
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: 1.
|
4
|
+
version: 1.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -163,7 +163,6 @@ files:
|
|
163
163
|
- docs/PortfolioGroupInfo.md
|
164
164
|
- docs/PortfolioGroupPosition.md
|
165
165
|
- docs/PortfolioGroupSettings.md
|
166
|
-
- docs/PortfolioManagementApi.md
|
167
166
|
- docs/Position.md
|
168
167
|
- docs/PositionSymbol.md
|
169
168
|
- docs/RedirectTokenandPin.md
|
@@ -223,7 +222,6 @@ files:
|
|
223
222
|
- lib/snaptrade/api/connections_api.rb
|
224
223
|
- lib/snaptrade/api/error_logs_api.rb
|
225
224
|
- lib/snaptrade/api/options_api.rb
|
226
|
-
- lib/snaptrade/api/portfolio_management_api.rb
|
227
225
|
- lib/snaptrade/api/reference_data_api.rb
|
228
226
|
- lib/snaptrade/api/trading_api.rb
|
229
227
|
- lib/snaptrade/api/transactions_and_reporting_api.rb
|
@@ -364,7 +362,6 @@ files:
|
|
364
362
|
- spec/api/connections_api_spec.rb
|
365
363
|
- spec/api/error_logs_api_spec.rb
|
366
364
|
- spec/api/options_api_spec.rb
|
367
|
-
- spec/api/portfolio_management_api_spec.rb
|
368
365
|
- spec/api/reference_data_api_spec.rb
|
369
366
|
- spec/api/trading_api_spec.rb
|
370
367
|
- spec/api/transactions_and_reporting_api_spec.rb
|
@@ -524,7 +521,6 @@ specification_version: 4
|
|
524
521
|
summary: SnapTrade Ruby Gem
|
525
522
|
test_files:
|
526
523
|
- spec/api/transactions_and_reporting_api_spec.rb
|
527
|
-
- spec/api/portfolio_management_api_spec.rb
|
528
524
|
- spec/api/options_api_spec.rb
|
529
525
|
- spec/api/authentication_api_spec.rb
|
530
526
|
- spec/api/error_logs_api_spec.rb
|