snaptrade 1.7.0 → 1.9.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 +1 -37
- data/docs/AccountInformationApi.md +2 -2
- data/docs/OptionsApi.md +2 -2
- data/docs/TradingApi.md +0 -321
- data/lib/snaptrade/api/account_information_api.rb +3 -3
- data/lib/snaptrade/api/options_api.rb +3 -3
- data/lib/snaptrade/api/trading_api.rb +0 -409
- 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 +1 -1
- data/spec/api/options_api_spec.rb +1 -1
- data/spec/api/trading_api_spec.rb +0 -51
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0c86a14ebff544a61cd5f4a0ab54ebbf1e20d6f9e572f56c71cc33f9c25234e
|
4
|
+
data.tar.gz: dc5aaea89b2ba568a1213debc1c91e3f90590226c6acbb92a79b5c89af7ed2c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bb453c0df3ef145f20bfdebfb3e4c984a73721dc257378443fea6bd7f31cd89875e620bfd184340af509c270b7131d92e1506dcbe140b896b3d1e8b279a2a03
|
7
|
+
data.tar.gz: abf01a016a2e67a194bccd4d8faa74a7fe33e9f8be213e0c77906a4902fe73d91762acba81ba966c549c30d740273c73b7c219f6cc5c7843276071a02dea365d
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
snaptrade (1.
|
4
|
+
snaptrade (1.9.0)
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
7
7
|
|
@@ -15,7 +15,7 @@ GEM
|
|
15
15
|
irb (>= 1.5.0)
|
16
16
|
reline (>= 0.3.1)
|
17
17
|
diff-lcs (1.5.0)
|
18
|
-
faraday (2.7.
|
18
|
+
faraday (2.7.10)
|
19
19
|
faraday-net_http (>= 2.0, < 3.1)
|
20
20
|
ruby2_keywords (>= 0.0.4)
|
21
21
|
faraday-multipart (1.0.4)
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ For more information, please visit [https://snaptrade.com/](https://snaptrade.co
|
|
9
9
|
Add to Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem 'snaptrade', '~> 1.
|
12
|
+
gem 'snaptrade', '~> 1.9.0'
|
13
13
|
```
|
14
14
|
|
15
15
|
## Getting Started
|
@@ -67,38 +67,6 @@ Class | Method | HTTP request | Description
|
|
67
67
|
*SnapTrade::OptionsApi* | [**get_options_strategy_quote**](docs/OptionsApi.md#get_options_strategy_quote) | **GET** /accounts/{accountId}/optionStrategy/{optionStrategyId} | Get latest market data of option strategy
|
68
68
|
*SnapTrade::OptionsApi* | [**list_option_holdings**](docs/OptionsApi.md#list_option_holdings) | **GET** /accounts/{accountId}/options | Get the options holdings in the account
|
69
69
|
*SnapTrade::OptionsApi* | [**place_option_strategy**](docs/OptionsApi.md#place_option_strategy) | **POST** /accounts/{accountId}/optionStrategy/{optionStrategyId}/execute | Place an option strategy order on the brokerage
|
70
|
-
*SnapTrade::PortfolioManagementApi* | [**add_portfolio_excluded_asset**](docs/PortfolioManagementApi.md#add_portfolio_excluded_asset) | **POST** /portfolioGroups/{portfolioGroupId}/excludedassets | Adds an asset to exclude to a portfolio group
|
71
|
-
*SnapTrade::PortfolioManagementApi* | [**create**](docs/PortfolioManagementApi.md#create) | **POST** /portfolioGroups | Create new portfolio group
|
72
|
-
*SnapTrade::PortfolioManagementApi* | [**create_asset_class**](docs/PortfolioManagementApi.md#create_asset_class) | **POST** /modelAssetClass | Create a new model asset class
|
73
|
-
*SnapTrade::PortfolioManagementApi* | [**create_model_portfolio**](docs/PortfolioManagementApi.md#create_model_portfolio) | **POST** /modelPortfolio | Creates a new model portfolio
|
74
|
-
*SnapTrade::PortfolioManagementApi* | [**delete_asset_class**](docs/PortfolioManagementApi.md#delete_asset_class) | **DELETE** /modelAssetClass/{modelAssetClassId} | Deletes a model asset class
|
75
|
-
*SnapTrade::PortfolioManagementApi* | [**delete_excluded_asset**](docs/PortfolioManagementApi.md#delete_excluded_asset) | **DELETE** /portfolioGroups/{portfolioGroupId}/excludedassets/{symbolId} | Unexclude an asset from a portfolio group
|
76
|
-
*SnapTrade::PortfolioManagementApi* | [**delete_model_portfolio_by_id**](docs/PortfolioManagementApi.md#delete_model_portfolio_by_id) | **DELETE** /modelPortfolio/{modelPortfolioId} | Deletes a model portfolio
|
77
|
-
*SnapTrade::PortfolioManagementApi* | [**delete_portfoli**](docs/PortfolioManagementApi.md#delete_portfoli) | **DELETE** /portfolioGroups/{portfolioGroupId} | Remove a target portfolio.
|
78
|
-
*SnapTrade::PortfolioManagementApi* | [**delete_portfolio_target_by_id**](docs/PortfolioManagementApi.md#delete_portfolio_target_by_id) | **DELETE** /portfolioGroups/{portfolioGroupId}/targets/{targetAssetId} | Remove a TargetAsset.
|
79
|
-
*SnapTrade::PortfolioManagementApi* | [**detail_asset_class**](docs/PortfolioManagementApi.md#detail_asset_class) | **GET** /modelAssetClass/{modelAssetClassId} | Get details of a model asset class
|
80
|
-
*SnapTrade::PortfolioManagementApi* | [**get_calculated_trade_by_id**](docs/PortfolioManagementApi.md#get_calculated_trade_by_id) | **GET** /portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/{TradeId} | Return an individual trade
|
81
|
-
*SnapTrade::PortfolioManagementApi* | [**get_model_details_by_id**](docs/PortfolioManagementApi.md#get_model_details_by_id) | **GET** /modelPortfolio/{modelPortfolioId} | Get details of a model portfolio
|
82
|
-
*SnapTrade::PortfolioManagementApi* | [**get_portfolio_balances**](docs/PortfolioManagementApi.md#get_portfolio_balances) | **GET** /portfolioGroups/{portfolioGroupId}/balances | Get sum of cash balances in portfolio group
|
83
|
-
*SnapTrade::PortfolioManagementApi* | [**get_portfolio_details_by_id**](docs/PortfolioManagementApi.md#get_portfolio_details_by_id) | **GET** /portfolioGroups/{portfolioGroupId} | Get details of a target portfolio
|
84
|
-
*SnapTrade::PortfolioManagementApi* | [**get_portfolio_info**](docs/PortfolioManagementApi.md#get_portfolio_info) | **GET** /portfolioGroups/{portfolioGroupId}/info | Return a whole bunch of relevant information relating to a portfolio group.
|
85
|
-
*SnapTrade::PortfolioManagementApi* | [**get_portfolio_settings**](docs/PortfolioManagementApi.md#get_portfolio_settings) | **GET** /portfolioGroups/{portfolioGroupId}/settings | Get portfolio group settings
|
86
|
-
*SnapTrade::PortfolioManagementApi* | [**get_portfolio_target_by_id**](docs/PortfolioManagementApi.md#get_portfolio_target_by_id) | **GET** /portfolioGroups/{portfolioGroupId}/targets/{targetAssetId} | Get a specific target from a portfolio group
|
87
|
-
*SnapTrade::PortfolioManagementApi* | [**get_portfolio_targets**](docs/PortfolioManagementApi.md#get_portfolio_targets) | **GET** /portfolioGroups/{portfolioGroupId}/targets | Get all target assets under the specified PortfolioGroup.
|
88
|
-
*SnapTrade::PortfolioManagementApi* | [**get_portoflio_excluded_assets**](docs/PortfolioManagementApi.md#get_portoflio_excluded_assets) | **GET** /portfolioGroups/{portfolioGroupId}/excludedassets | Get an array of excluded assets associated with a portfolio group\\
|
89
|
-
*SnapTrade::PortfolioManagementApi* | [**import_model_portfolio**](docs/PortfolioManagementApi.md#import_model_portfolio) | **POST** /portfolioGroups/{portfolioGroupId}/import | Import target allocation based on portfolio group
|
90
|
-
*SnapTrade::PortfolioManagementApi* | [**list**](docs/PortfolioManagementApi.md#list) | **GET** /portfolioGroups | List all portfolio groups
|
91
|
-
*SnapTrade::PortfolioManagementApi* | [**list_asset_classes**](docs/PortfolioManagementApi.md#list_asset_classes) | **GET** /modelAssetClass | List of model asset class
|
92
|
-
*SnapTrade::PortfolioManagementApi* | [**list_calculated_trades**](docs/PortfolioManagementApi.md#list_calculated_trades) | **GET** /portfolioGroups/{portfolioGroupId}/calculatedtrades | List of trades to make to rebalance portfolio group
|
93
|
-
*SnapTrade::PortfolioManagementApi* | [**list_model_portfolio**](docs/PortfolioManagementApi.md#list_model_portfolio) | **GET** /modelPortfolio | List of model portfolio
|
94
|
-
*SnapTrade::PortfolioManagementApi* | [**list_portfolio_accounts**](docs/PortfolioManagementApi.md#list_portfolio_accounts) | **GET** /portfolioGroups/{portfolioGroupId}/accounts | Get all accounts associated with a portfolio group
|
95
|
-
*SnapTrade::PortfolioManagementApi* | [**modify_model_portfolio_by_id**](docs/PortfolioManagementApi.md#modify_model_portfolio_by_id) | **POST** /modelPortfolio/{modelPortfolioId} | Updates model portfolio object
|
96
|
-
*SnapTrade::PortfolioManagementApi* | [**save_portfolio**](docs/PortfolioManagementApi.md#save_portfolio) | **PATCH** /portfolioGroups/{portfolioGroupId} | Update an existing target portfolio.
|
97
|
-
*SnapTrade::PortfolioManagementApi* | [**search_portfolio_symbols**](docs/PortfolioManagementApi.md#search_portfolio_symbols) | **POST** /portfolioGroups/{portfolioGroupId}/symbols | Search for symbols limited to brokerages under the specified portfolio group
|
98
|
-
*SnapTrade::PortfolioManagementApi* | [**set_portfolio_targets**](docs/PortfolioManagementApi.md#set_portfolio_targets) | **POST** /portfolioGroups/{portfolioGroupId}/targets | Set a new list of target assets under the specified PortfolioGroup. All existing target assets under this portfolio group will be replaced with the new list.
|
99
|
-
*SnapTrade::PortfolioManagementApi* | [**update_asset_class**](docs/PortfolioManagementApi.md#update_asset_class) | **POST** /modelAssetClass/{modelAssetClassId} | Updates model asset class objects
|
100
|
-
*SnapTrade::PortfolioManagementApi* | [**update_portfolio_settings**](docs/PortfolioManagementApi.md#update_portfolio_settings) | **PATCH** /portfolioGroups/{portfolioGroupId}/settings | Updates portfolio group settings
|
101
|
-
*SnapTrade::PortfolioManagementApi* | [**update_portfolio_target_by_id**](docs/PortfolioManagementApi.md#update_portfolio_target_by_id) | **PATCH** /portfolioGroups/{portfolioGroupId}/targets/{targetAssetId} | Update a TargetAsset under the specified PortfolioGroup.
|
102
70
|
*SnapTrade::ReferenceDataApi* | [**get_currency_exchange_rate_pair**](docs/ReferenceDataApi.md#get_currency_exchange_rate_pair) | **GET** /currencies/rates/{currencyPair} | Return the exchange rate of a currency pair
|
103
71
|
*SnapTrade::ReferenceDataApi* | [**get_partner_info**](docs/ReferenceDataApi.md#get_partner_info) | **GET** /snapTrade/partners | Get metadata related to Snaptrade partner
|
104
72
|
*SnapTrade::ReferenceDataApi* | [**get_security_types**](docs/ReferenceDataApi.md#get_security_types) | **GET** /securityTypes | List of all security types.
|
@@ -111,12 +79,8 @@ Class | Method | HTTP request | Description
|
|
111
79
|
*SnapTrade::ReferenceDataApi* | [**list_all_currencies_rates**](docs/ReferenceDataApi.md#list_all_currencies_rates) | **GET** /currencies/rates | Return the exchange rates of all supported currencies
|
112
80
|
*SnapTrade::ReferenceDataApi* | [**symbol_search_user_account**](docs/ReferenceDataApi.md#symbol_search_user_account) | **POST** /accounts/{accountId}/symbols | Search for symbols that are supported by a brokerage account using a substring
|
113
81
|
*SnapTrade::TradingApi* | [**cancel_user_account_order**](docs/TradingApi.md#cancel_user_account_order) | **POST** /accounts/{accountId}/orders/cancel | Cancel open order in account
|
114
|
-
*SnapTrade::TradingApi* | [**get_calculated_trade_impact_by_id**](docs/TradingApi.md#get_calculated_trade_impact_by_id) | **GET** /portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/modify/{tradeId} | Return details of a specific trade before it's placed
|
115
|
-
*SnapTrade::TradingApi* | [**get_calculated_trades_impact**](docs/TradingApi.md#get_calculated_trades_impact) | **GET** /portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/impact | Return the impact of placing a series of trades on the portfolio
|
116
82
|
*SnapTrade::TradingApi* | [**get_order_impact**](docs/TradingApi.md#get_order_impact) | **POST** /trade/impact | Check impact of trades on account.
|
117
83
|
*SnapTrade::TradingApi* | [**get_user_account_quotes**](docs/TradingApi.md#get_user_account_quotes) | **GET** /accounts/{accountId}/quotes | Get symbol quotes
|
118
|
-
*SnapTrade::TradingApi* | [**modify_calculated_trade_by_id**](docs/TradingApi.md#modify_calculated_trade_by_id) | **PATCH** /portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/modify/{tradeId} | Modify units of a trade before it is placed
|
119
|
-
*SnapTrade::TradingApi* | [**place_calculated_trades**](docs/TradingApi.md#place_calculated_trades) | **POST** /portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/placeOrders | Place orders for the CalculatedTrades in series
|
120
84
|
*SnapTrade::TradingApi* | [**place_force_order**](docs/TradingApi.md#place_force_order) | **POST** /trade/place | Place a trade with NO validation.
|
121
85
|
*SnapTrade::TradingApi* | [**place_oco_order**](docs/TradingApi.md#place_oco_order) | **POST** /trade/oco | Place a OCO (One Cancels Other) order
|
122
86
|
*SnapTrade::TradingApi* | [**place_order**](docs/TradingApi.md#place_order) | **POST** /trade/{tradeId} | Place order
|
@@ -190,7 +190,7 @@ begin
|
|
190
190
|
)
|
191
191
|
p status_code # => 2xx
|
192
192
|
p headers # => { ... }
|
193
|
-
p data # =>
|
193
|
+
p data # => Account
|
194
194
|
rescue SnapTrade::ApiError => e
|
195
195
|
puts "Exception when calling SnapTrade::AccountInformation.get_user_account_details: #{e}"
|
196
196
|
end
|
@@ -206,7 +206,7 @@ end
|
|
206
206
|
|
207
207
|
### Return type
|
208
208
|
|
209
|
-
[**
|
209
|
+
[**Account**](Account.md)
|
210
210
|
|
211
211
|
## get_user_account_orders
|
212
212
|
|
data/docs/OptionsApi.md
CHANGED
@@ -287,7 +287,7 @@ begin
|
|
287
287
|
)
|
288
288
|
p status_code # => 2xx
|
289
289
|
p headers # => { ... }
|
290
|
-
p data # => OptionsHoldings
|
290
|
+
p data # => Array<OptionsHoldings>
|
291
291
|
rescue SnapTrade::ApiError => e
|
292
292
|
puts "Exception when calling SnapTrade::Options.list_option_holdings: #{e}"
|
293
293
|
end
|
@@ -303,7 +303,7 @@ end
|
|
303
303
|
|
304
304
|
### Return type
|
305
305
|
|
306
|
-
[**OptionsHoldings
|
306
|
+
[**Array<OptionsHoldings>**](OptionsHoldings.md)
|
307
307
|
|
308
308
|
## place_option_strategy
|
309
309
|
|
data/docs/TradingApi.md
CHANGED
@@ -5,12 +5,8 @@ All URIs are relative to *https://api.snaptrade.com/api/v1*
|
|
5
5
|
| Method | HTTP request | Description |
|
6
6
|
| ------ | ------------ | ----------- |
|
7
7
|
| [**cancel_user_account_order**](TradingApi.md#cancel_user_account_order) | **POST** /accounts/{accountId}/orders/cancel | Cancel open order in account |
|
8
|
-
| [**get_calculated_trade_impact_by_id**](TradingApi.md#get_calculated_trade_impact_by_id) | **GET** /portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/modify/{tradeId} | Return details of a specific trade before it's placed |
|
9
|
-
| [**get_calculated_trades_impact**](TradingApi.md#get_calculated_trades_impact) | **GET** /portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/impact | Return the impact of placing a series of trades on the portfolio |
|
10
8
|
| [**get_order_impact**](TradingApi.md#get_order_impact) | **POST** /trade/impact | Check impact of trades on account. |
|
11
9
|
| [**get_user_account_quotes**](TradingApi.md#get_user_account_quotes) | **GET** /accounts/{accountId}/quotes | Get symbol quotes |
|
12
|
-
| [**modify_calculated_trade_by_id**](TradingApi.md#modify_calculated_trade_by_id) | **PATCH** /portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/modify/{tradeId} | Modify units of a trade before it is placed |
|
13
|
-
| [**place_calculated_trades**](TradingApi.md#place_calculated_trades) | **POST** /portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/placeOrders | Place orders for the CalculatedTrades in series |
|
14
10
|
| [**place_force_order**](TradingApi.md#place_force_order) | **POST** /trade/place | Place a trade with NO validation. |
|
15
11
|
| [**place_oco_order**](TradingApi.md#place_oco_order) | **POST** /trade/oco | Place a OCO (One Cancels Other) order |
|
16
12
|
| [**place_order**](TradingApi.md#place_order) | **POST** /trade/{tradeId} | Place order |
|
@@ -85,131 +81,6 @@ end
|
|
85
81
|
|
86
82
|
[**AccountOrderRecord**](AccountOrderRecord.md)
|
87
83
|
|
88
|
-
## get_calculated_trade_impact_by_id
|
89
|
-
|
90
|
-
Return details of a specific trade before it's placed
|
91
|
-
|
92
|
-
### Example
|
93
|
-
|
94
|
-
```ruby
|
95
|
-
require 'snaptrade'
|
96
|
-
|
97
|
-
SnapTrade.client_id = "YOUR_CLIENT_ID"
|
98
|
-
SnapTrade.consumer_key = "YOUR_CONSUMER_KEY"
|
99
|
-
|
100
|
-
portfolio_group_id = "portfolioGroupId_example"
|
101
|
-
calculated_trade_id = "calculatedTradeId_example"
|
102
|
-
trade_id = "tradeId_example"
|
103
|
-
|
104
|
-
begin
|
105
|
-
# Return details of a specific trade before it's placed
|
106
|
-
result = SnapTrade::Trading.get_calculated_trade_impact_by_id(
|
107
|
-
portfolio_group_id: portfolio_group_id,
|
108
|
-
calculated_trade_id: calculated_trade_id,
|
109
|
-
trade_id: trade_id,
|
110
|
-
)
|
111
|
-
p result
|
112
|
-
rescue SnapTrade::ApiError => e
|
113
|
-
puts "Exception when calling SnapTrade::Trading.get_calculated_trade_impact_by_id: #{e}"
|
114
|
-
end
|
115
|
-
```
|
116
|
-
|
117
|
-
#### Using the get_calculated_trade_impact_by_id_with_http_info variant
|
118
|
-
|
119
|
-
This returns an Array which contains the response data, status code and headers.
|
120
|
-
|
121
|
-
```ruby
|
122
|
-
portfolio_group_id = "portfolioGroupId_example"
|
123
|
-
calculated_trade_id = "calculatedTradeId_example"
|
124
|
-
trade_id = "tradeId_example"
|
125
|
-
|
126
|
-
begin
|
127
|
-
# Return details of a specific trade before it's placed
|
128
|
-
data, status_code, headers, response = SnapTrade::Trading.get_calculated_trade_impact_by_id_with_http_info(
|
129
|
-
portfolio_group_id: portfolio_group_id,
|
130
|
-
calculated_trade_id: calculated_trade_id,
|
131
|
-
trade_id: trade_id,
|
132
|
-
)
|
133
|
-
p status_code # => 2xx
|
134
|
-
p headers # => { ... }
|
135
|
-
p data # => Trade
|
136
|
-
rescue SnapTrade::ApiError => e
|
137
|
-
puts "Exception when calling SnapTrade::Trading.get_calculated_trade_impact_by_id: #{e}"
|
138
|
-
end
|
139
|
-
```
|
140
|
-
|
141
|
-
### Parameters
|
142
|
-
|
143
|
-
| Name | Type | Description | Notes |
|
144
|
-
| ---- | ---- | ----------- | ----- |
|
145
|
-
| **portfolio_group_id** | **String** | The ID of the PortfolioGroup to perform rebalancing calculations | |
|
146
|
-
| **calculated_trade_id** | **String** | The ID of calculated trade to get account impact | |
|
147
|
-
| **trade_id** | **String** | The ID of trade object | |
|
148
|
-
|
149
|
-
### Return type
|
150
|
-
|
151
|
-
[**Trade**](Trade.md)
|
152
|
-
|
153
|
-
## get_calculated_trades_impact
|
154
|
-
|
155
|
-
Return the impact of placing a series of trades on the portfolio
|
156
|
-
|
157
|
-
### Example
|
158
|
-
|
159
|
-
```ruby
|
160
|
-
require 'snaptrade'
|
161
|
-
|
162
|
-
SnapTrade.client_id = "YOUR_CLIENT_ID"
|
163
|
-
SnapTrade.consumer_key = "YOUR_CONSUMER_KEY"
|
164
|
-
|
165
|
-
portfolio_group_id = "portfolioGroupId_example"
|
166
|
-
calculated_trade_id = "calculatedTradeId_example"
|
167
|
-
|
168
|
-
begin
|
169
|
-
# Return the impact of placing a series of trades on the portfolio
|
170
|
-
result = SnapTrade::Trading.get_calculated_trades_impact(
|
171
|
-
portfolio_group_id: portfolio_group_id,
|
172
|
-
calculated_trade_id: calculated_trade_id,
|
173
|
-
)
|
174
|
-
p result
|
175
|
-
rescue SnapTrade::ApiError => e
|
176
|
-
puts "Exception when calling SnapTrade::Trading.get_calculated_trades_impact: #{e}"
|
177
|
-
end
|
178
|
-
```
|
179
|
-
|
180
|
-
#### Using the get_calculated_trades_impact_with_http_info variant
|
181
|
-
|
182
|
-
This returns an Array which contains the response data, status code and headers.
|
183
|
-
|
184
|
-
```ruby
|
185
|
-
portfolio_group_id = "portfolioGroupId_example"
|
186
|
-
calculated_trade_id = "calculatedTradeId_example"
|
187
|
-
|
188
|
-
begin
|
189
|
-
# Return the impact of placing a series of trades on the portfolio
|
190
|
-
data, status_code, headers, response = SnapTrade::Trading.get_calculated_trades_impact_with_http_info(
|
191
|
-
portfolio_group_id: portfolio_group_id,
|
192
|
-
calculated_trade_id: calculated_trade_id,
|
193
|
-
)
|
194
|
-
p status_code # => 2xx
|
195
|
-
p headers # => { ... }
|
196
|
-
p data # => Array<TradeImpact>
|
197
|
-
rescue SnapTrade::ApiError => e
|
198
|
-
puts "Exception when calling SnapTrade::Trading.get_calculated_trades_impact: #{e}"
|
199
|
-
end
|
200
|
-
```
|
201
|
-
|
202
|
-
### Parameters
|
203
|
-
|
204
|
-
| Name | Type | Description | Notes |
|
205
|
-
| ---- | ---- | ----------- | ----- |
|
206
|
-
| **portfolio_group_id** | **String** | The ID of the PortfolioGroup to perform rebalancing calculations | |
|
207
|
-
| **calculated_trade_id** | **String** | The ID of calculated trade to get account impact | |
|
208
|
-
|
209
|
-
### Return type
|
210
|
-
|
211
|
-
[**Array<TradeImpact>**](TradeImpact.md)
|
212
|
-
|
213
84
|
## get_order_impact
|
214
85
|
|
215
86
|
Check impact of trades on account.
|
@@ -378,198 +249,6 @@ end
|
|
378
249
|
|
379
250
|
[**Array<SymbolsQuotesInner>**](SymbolsQuotesInner.md)
|
380
251
|
|
381
|
-
## modify_calculated_trade_by_id
|
382
|
-
|
383
|
-
Modify units of a trade before it is placed
|
384
|
-
|
385
|
-
### Example
|
386
|
-
|
387
|
-
```ruby
|
388
|
-
require 'snaptrade'
|
389
|
-
|
390
|
-
SnapTrade.client_id = "YOUR_CLIENT_ID"
|
391
|
-
SnapTrade.consumer_key = "YOUR_CONSUMER_KEY"
|
392
|
-
|
393
|
-
portfolio_group_id = "portfolioGroupId_example"
|
394
|
-
calculated_trade_id = "calculatedTradeId_example"
|
395
|
-
trade_id = "tradeId_example"
|
396
|
-
id = "2bcd7cc3-e922-4976-bce1-9858296801c3"
|
397
|
-
account = {
|
398
|
-
"id" => "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
399
|
-
"brokerage_authorization" => "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
400
|
-
"portfolio_group" => "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
401
|
-
"name" => "Registered Retirement Savings Account",
|
402
|
-
"number" => "Q6542138443",
|
403
|
-
"institution_name" => "Alpaca",
|
404
|
-
"created_date" => "2021-06-04T16:26:46.523Z",
|
405
|
-
}
|
406
|
-
symbol = {
|
407
|
-
"id" => "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
408
|
-
"description" => "VANGUARD CDN AGGREGATE BOND INDEX ETF",
|
409
|
-
"allows_fractional_units" => True,
|
410
|
-
}
|
411
|
-
universal_symbol = {
|
412
|
-
"id" => "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
413
|
-
"symbol" => "VAB.TO",
|
414
|
-
"raw_symbol" => "VAB",
|
415
|
-
"description" => "VANGUARD CDN AGGREGATE BOND INDEX ETF",
|
416
|
-
}
|
417
|
-
action = "BUY"
|
418
|
-
units = 6
|
419
|
-
price = 24.81
|
420
|
-
sequence = 1
|
421
|
-
|
422
|
-
begin
|
423
|
-
# Modify units of a trade before it is placed
|
424
|
-
result = SnapTrade::Trading.modify_calculated_trade_by_id(
|
425
|
-
portfolio_group_id: portfolio_group_id,
|
426
|
-
calculated_trade_id: calculated_trade_id,
|
427
|
-
trade_id: trade_id,
|
428
|
-
id: id,
|
429
|
-
account: account,
|
430
|
-
symbol: symbol,
|
431
|
-
universal_symbol: universal_symbol,
|
432
|
-
action: action,
|
433
|
-
units: units,
|
434
|
-
price: price,
|
435
|
-
sequence: sequence,
|
436
|
-
)
|
437
|
-
p result
|
438
|
-
rescue SnapTrade::ApiError => e
|
439
|
-
puts "Exception when calling SnapTrade::Trading.modify_calculated_trade_by_id: #{e}"
|
440
|
-
end
|
441
|
-
```
|
442
|
-
|
443
|
-
#### Using the modify_calculated_trade_by_id_with_http_info variant
|
444
|
-
|
445
|
-
This returns an Array which contains the response data, status code and headers.
|
446
|
-
|
447
|
-
```ruby
|
448
|
-
portfolio_group_id = "portfolioGroupId_example"
|
449
|
-
calculated_trade_id = "calculatedTradeId_example"
|
450
|
-
trade_id = "tradeId_example"
|
451
|
-
id = "2bcd7cc3-e922-4976-bce1-9858296801c3"
|
452
|
-
account = {
|
453
|
-
"id" => "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
454
|
-
"brokerage_authorization" => "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
455
|
-
"portfolio_group" => "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
456
|
-
"name" => "Registered Retirement Savings Account",
|
457
|
-
"number" => "Q6542138443",
|
458
|
-
"institution_name" => "Alpaca",
|
459
|
-
"created_date" => "2021-06-04T16:26:46.523Z",
|
460
|
-
}
|
461
|
-
symbol = {
|
462
|
-
"id" => "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
463
|
-
"description" => "VANGUARD CDN AGGREGATE BOND INDEX ETF",
|
464
|
-
"allows_fractional_units" => True,
|
465
|
-
}
|
466
|
-
universal_symbol = {
|
467
|
-
"id" => "2bcd7cc3-e922-4976-bce1-9858296801c3",
|
468
|
-
"symbol" => "VAB.TO",
|
469
|
-
"raw_symbol" => "VAB",
|
470
|
-
"description" => "VANGUARD CDN AGGREGATE BOND INDEX ETF",
|
471
|
-
}
|
472
|
-
action = "BUY"
|
473
|
-
units = 6
|
474
|
-
price = 24.81
|
475
|
-
sequence = 1
|
476
|
-
|
477
|
-
begin
|
478
|
-
# Modify units of a trade before it is placed
|
479
|
-
data, status_code, headers, response = SnapTrade::Trading.modify_calculated_trade_by_id_with_http_info(
|
480
|
-
portfolio_group_id: portfolio_group_id,
|
481
|
-
calculated_trade_id: calculated_trade_id,
|
482
|
-
trade_id: trade_id,
|
483
|
-
id: id,
|
484
|
-
account: account,
|
485
|
-
symbol: symbol,
|
486
|
-
universal_symbol: universal_symbol,
|
487
|
-
action: action,
|
488
|
-
units: units,
|
489
|
-
price: price,
|
490
|
-
sequence: sequence,
|
491
|
-
)
|
492
|
-
p status_code # => 2xx
|
493
|
-
p headers # => { ... }
|
494
|
-
p data # => Trade
|
495
|
-
rescue SnapTrade::ApiError => e
|
496
|
-
puts "Exception when calling SnapTrade::Trading.modify_calculated_trade_by_id: #{e}"
|
497
|
-
end
|
498
|
-
```
|
499
|
-
|
500
|
-
### Parameters
|
501
|
-
|
502
|
-
| Name | Type | Description | Notes |
|
503
|
-
| ---- | ---- | ----------- | ----- |
|
504
|
-
| **portfolio_group_id** | **String** | The ID of the PortfolioGroup to perform rebalancing calculations | |
|
505
|
-
| **calculated_trade_id** | **String** | The ID of calculated trade to get account impact | |
|
506
|
-
| **trade_id** | **String** | The ID of trade object | |
|
507
|
-
| **trade** | [**Trade**](Trade.md) | | [optional] |
|
508
|
-
|
509
|
-
### Return type
|
510
|
-
|
511
|
-
[**Trade**](Trade.md)
|
512
|
-
|
513
|
-
## place_calculated_trades
|
514
|
-
|
515
|
-
Place orders for the CalculatedTrades in series
|
516
|
-
|
517
|
-
### Example
|
518
|
-
|
519
|
-
```ruby
|
520
|
-
require 'snaptrade'
|
521
|
-
|
522
|
-
SnapTrade.client_id = "YOUR_CLIENT_ID"
|
523
|
-
SnapTrade.consumer_key = "YOUR_CONSUMER_KEY"
|
524
|
-
|
525
|
-
portfolio_group_id = "portfolioGroupId_example"
|
526
|
-
calculated_trade_id = "calculatedTradeId_example"
|
527
|
-
|
528
|
-
begin
|
529
|
-
# Place orders for the CalculatedTrades in series
|
530
|
-
result = SnapTrade::Trading.place_calculated_trades(
|
531
|
-
portfolio_group_id: portfolio_group_id,
|
532
|
-
calculated_trade_id: calculated_trade_id,
|
533
|
-
)
|
534
|
-
p result
|
535
|
-
rescue SnapTrade::ApiError => e
|
536
|
-
puts "Exception when calling SnapTrade::Trading.place_calculated_trades: #{e}"
|
537
|
-
end
|
538
|
-
```
|
539
|
-
|
540
|
-
#### Using the place_calculated_trades_with_http_info variant
|
541
|
-
|
542
|
-
This returns an Array which contains the response data, status code and headers.
|
543
|
-
|
544
|
-
```ruby
|
545
|
-
portfolio_group_id = "portfolioGroupId_example"
|
546
|
-
calculated_trade_id = "calculatedTradeId_example"
|
547
|
-
|
548
|
-
begin
|
549
|
-
# Place orders for the CalculatedTrades in series
|
550
|
-
data, status_code, headers, response = SnapTrade::Trading.place_calculated_trades_with_http_info(
|
551
|
-
portfolio_group_id: portfolio_group_id,
|
552
|
-
calculated_trade_id: calculated_trade_id,
|
553
|
-
)
|
554
|
-
p status_code # => 2xx
|
555
|
-
p headers # => { ... }
|
556
|
-
p data # => Array<TradeExecutionStatus>
|
557
|
-
rescue SnapTrade::ApiError => e
|
558
|
-
puts "Exception when calling SnapTrade::Trading.place_calculated_trades: #{e}"
|
559
|
-
end
|
560
|
-
```
|
561
|
-
|
562
|
-
### Parameters
|
563
|
-
|
564
|
-
| Name | Type | Description | Notes |
|
565
|
-
| ---- | ---- | ----------- | ----- |
|
566
|
-
| **portfolio_group_id** | **String** | The ID of the PortfolioGroup to perform rebalancing calculations | |
|
567
|
-
| **calculated_trade_id** | **String** | The ID of calculated trade to get account impact | |
|
568
|
-
|
569
|
-
### Return type
|
570
|
-
|
571
|
-
[**Array<TradeExecutionStatus>**](TradeExecutionStatus.md)
|
572
|
-
|
573
252
|
## place_force_order
|
574
253
|
|
575
254
|
Place a trade with NO validation.
|
@@ -237,7 +237,7 @@ module SnapTrade
|
|
237
237
|
# @param user_secret [String]
|
238
238
|
# @param account_id [String] The ID of the account to get detail of.
|
239
239
|
# @param [Hash] opts the optional parameters
|
240
|
-
# @return [
|
240
|
+
# @return [Account]
|
241
241
|
def get_user_account_details_impl(user_id, user_secret, account_id, opts = {})
|
242
242
|
data, _status_code, _headers = get_user_account_details_with_http_info(user_id, user_secret, account_id, opts)
|
243
243
|
data
|
@@ -248,7 +248,7 @@ module SnapTrade
|
|
248
248
|
# @param user_secret [String]
|
249
249
|
# @param account_id [String] The ID of the account to get detail of.
|
250
250
|
# @param [Hash] opts the optional parameters
|
251
|
-
# @return [Array<(
|
251
|
+
# @return [Array<(Account, Integer, Hash)>] Account data, response status code and response headers
|
252
252
|
def get_user_account_details_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
253
253
|
if @api_client.config.debugging
|
254
254
|
@api_client.config.logger.debug 'Calling API: AccountInformationApi.get_user_account_details ...'
|
@@ -285,7 +285,7 @@ module SnapTrade
|
|
285
285
|
post_body = opts[:debug_body]
|
286
286
|
|
287
287
|
# return_type
|
288
|
-
return_type = opts[:debug_return_type] || '
|
288
|
+
return_type = opts[:debug_return_type] || 'Account'
|
289
289
|
|
290
290
|
# auth_names
|
291
291
|
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
@@ -381,7 +381,7 @@ module SnapTrade
|
|
381
381
|
# @param user_secret [String]
|
382
382
|
# @param account_id [String] The ID of the account get positions.
|
383
383
|
# @param [Hash] opts the optional parameters
|
384
|
-
# @return [OptionsHoldings]
|
384
|
+
# @return [Array<OptionsHoldings>]
|
385
385
|
def list_option_holdings_impl(user_id, user_secret, account_id, opts = {})
|
386
386
|
data, _status_code, _headers = list_option_holdings_with_http_info(user_id, user_secret, account_id, opts)
|
387
387
|
data
|
@@ -392,7 +392,7 @@ module SnapTrade
|
|
392
392
|
# @param user_secret [String]
|
393
393
|
# @param account_id [String] The ID of the account get positions.
|
394
394
|
# @param [Hash] opts the optional parameters
|
395
|
-
# @return [Array<(OptionsHoldings
|
395
|
+
# @return [Array<(Array<OptionsHoldings>, Integer, Hash)>] Array<OptionsHoldings> data, response status code and response headers
|
396
396
|
def list_option_holdings_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
397
397
|
if @api_client.config.debugging
|
398
398
|
@api_client.config.logger.debug 'Calling API: OptionsApi.list_option_holdings ...'
|
@@ -429,7 +429,7 @@ module SnapTrade
|
|
429
429
|
post_body = opts[:debug_body]
|
430
430
|
|
431
431
|
# return_type
|
432
|
-
return_type = opts[:debug_return_type] || 'OptionsHoldings'
|
432
|
+
return_type = opts[:debug_return_type] || 'Array<OptionsHoldings>'
|
433
433
|
|
434
434
|
# auth_names
|
435
435
|
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|