snaptrade 1.7.0 → 1.9.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 +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
@@ -136,188 +136,6 @@ module SnapTrade
|
|
136
136
|
end
|
137
137
|
|
138
138
|
|
139
|
-
# Return details of a specific trade before it's placed
|
140
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
141
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
142
|
-
# @param trade_id [String] The ID of trade object
|
143
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
144
|
-
def get_calculated_trade_impact_by_id(portfolio_group_id:, calculated_trade_id:, trade_id:, extra: {})
|
145
|
-
|
146
|
-
data, _status_code, _headers = get_calculated_trade_impact_by_id_with_http_info_impl(portfolio_group_id, calculated_trade_id, trade_id, extra)
|
147
|
-
data
|
148
|
-
end
|
149
|
-
|
150
|
-
# Return details of a specific trade before it's placed
|
151
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
152
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
153
|
-
# @param trade_id [String] The ID of trade object
|
154
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
155
|
-
def get_calculated_trade_impact_by_id_with_http_info(portfolio_group_id:, calculated_trade_id:, trade_id:, extra: {})
|
156
|
-
|
157
|
-
get_calculated_trade_impact_by_id_with_http_info_impl(portfolio_group_id, calculated_trade_id, trade_id, extra)
|
158
|
-
end
|
159
|
-
|
160
|
-
# Return details of a specific trade before it's placed
|
161
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
162
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
163
|
-
# @param trade_id [String] The ID of trade object
|
164
|
-
# @param [Hash] opts the optional parameters
|
165
|
-
# @return [Trade]
|
166
|
-
def get_calculated_trade_impact_by_id_impl(portfolio_group_id, calculated_trade_id, trade_id, opts = {})
|
167
|
-
data, _status_code, _headers = get_calculated_trade_impact_by_id_with_http_info(portfolio_group_id, calculated_trade_id, trade_id, opts)
|
168
|
-
data
|
169
|
-
end
|
170
|
-
|
171
|
-
# Return details of a specific trade before it's placed
|
172
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
173
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
174
|
-
# @param trade_id [String] The ID of trade object
|
175
|
-
# @param [Hash] opts the optional parameters
|
176
|
-
# @return [Array<(Trade, Integer, Hash)>] Trade data, response status code and response headers
|
177
|
-
def get_calculated_trade_impact_by_id_with_http_info_impl(portfolio_group_id, calculated_trade_id, trade_id, opts = {})
|
178
|
-
if @api_client.config.debugging
|
179
|
-
@api_client.config.logger.debug 'Calling API: TradingApi.get_calculated_trade_impact_by_id ...'
|
180
|
-
end
|
181
|
-
# verify the required parameter 'portfolio_group_id' is set
|
182
|
-
if @api_client.config.client_side_validation && portfolio_group_id.nil?
|
183
|
-
fail ArgumentError, "Missing the required parameter 'portfolio_group_id' when calling TradingApi.get_calculated_trade_impact_by_id"
|
184
|
-
end
|
185
|
-
# verify the required parameter 'calculated_trade_id' is set
|
186
|
-
if @api_client.config.client_side_validation && calculated_trade_id.nil?
|
187
|
-
fail ArgumentError, "Missing the required parameter 'calculated_trade_id' when calling TradingApi.get_calculated_trade_impact_by_id"
|
188
|
-
end
|
189
|
-
# verify the required parameter 'trade_id' is set
|
190
|
-
if @api_client.config.client_side_validation && trade_id.nil?
|
191
|
-
fail ArgumentError, "Missing the required parameter 'trade_id' when calling TradingApi.get_calculated_trade_impact_by_id"
|
192
|
-
end
|
193
|
-
# resource path
|
194
|
-
local_var_path = '/portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/modify/{tradeId}'.sub('{' + 'portfolioGroupId' + '}', CGI.escape(portfolio_group_id.to_s)).sub('{' + 'calculatedTradeId' + '}', CGI.escape(calculated_trade_id.to_s)).sub('{' + 'tradeId' + '}', CGI.escape(trade_id.to_s))
|
195
|
-
|
196
|
-
# query parameters
|
197
|
-
query_params = opts[:query_params] || {}
|
198
|
-
|
199
|
-
# header parameters
|
200
|
-
header_params = opts[:header_params] || {}
|
201
|
-
# HTTP header 'Accept' (if needed)
|
202
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
203
|
-
|
204
|
-
# form parameters
|
205
|
-
form_params = opts[:form_params] || {}
|
206
|
-
|
207
|
-
# http body (model)
|
208
|
-
post_body = opts[:debug_body]
|
209
|
-
|
210
|
-
# return_type
|
211
|
-
return_type = opts[:debug_return_type] || 'Trade'
|
212
|
-
|
213
|
-
# auth_names
|
214
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
215
|
-
|
216
|
-
new_options = opts.merge(
|
217
|
-
:operation => :"TradingApi.get_calculated_trade_impact_by_id",
|
218
|
-
:header_params => header_params,
|
219
|
-
:query_params => query_params,
|
220
|
-
:form_params => form_params,
|
221
|
-
:body => post_body,
|
222
|
-
:auth_names => auth_names,
|
223
|
-
:return_type => return_type
|
224
|
-
)
|
225
|
-
|
226
|
-
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
227
|
-
if @api_client.config.debugging
|
228
|
-
@api_client.config.logger.debug "API called: TradingApi#get_calculated_trade_impact_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
229
|
-
end
|
230
|
-
return data, status_code, headers, response
|
231
|
-
end
|
232
|
-
|
233
|
-
|
234
|
-
# Return the impact of placing a series of trades on the portfolio
|
235
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
236
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
237
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
238
|
-
def get_calculated_trades_impact(portfolio_group_id:, calculated_trade_id:, extra: {})
|
239
|
-
|
240
|
-
data, _status_code, _headers = get_calculated_trades_impact_with_http_info_impl(portfolio_group_id, calculated_trade_id, extra)
|
241
|
-
data
|
242
|
-
end
|
243
|
-
|
244
|
-
# Return the impact of placing a series of trades on the portfolio
|
245
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
246
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
247
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
248
|
-
def get_calculated_trades_impact_with_http_info(portfolio_group_id:, calculated_trade_id:, extra: {})
|
249
|
-
|
250
|
-
get_calculated_trades_impact_with_http_info_impl(portfolio_group_id, calculated_trade_id, extra)
|
251
|
-
end
|
252
|
-
|
253
|
-
# Return the impact of placing a series of trades on the portfolio
|
254
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
255
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
256
|
-
# @param [Hash] opts the optional parameters
|
257
|
-
# @return [Array<TradeImpact>]
|
258
|
-
def get_calculated_trades_impact_impl(portfolio_group_id, calculated_trade_id, opts = {})
|
259
|
-
data, _status_code, _headers = get_calculated_trades_impact_with_http_info(portfolio_group_id, calculated_trade_id, opts)
|
260
|
-
data
|
261
|
-
end
|
262
|
-
|
263
|
-
# Return the impact of placing a series of trades on the portfolio
|
264
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
265
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
266
|
-
# @param [Hash] opts the optional parameters
|
267
|
-
# @return [Array<(Array<TradeImpact>, Integer, Hash)>] Array<TradeImpact> data, response status code and response headers
|
268
|
-
def get_calculated_trades_impact_with_http_info_impl(portfolio_group_id, calculated_trade_id, opts = {})
|
269
|
-
if @api_client.config.debugging
|
270
|
-
@api_client.config.logger.debug 'Calling API: TradingApi.get_calculated_trades_impact ...'
|
271
|
-
end
|
272
|
-
# verify the required parameter 'portfolio_group_id' is set
|
273
|
-
if @api_client.config.client_side_validation && portfolio_group_id.nil?
|
274
|
-
fail ArgumentError, "Missing the required parameter 'portfolio_group_id' when calling TradingApi.get_calculated_trades_impact"
|
275
|
-
end
|
276
|
-
# verify the required parameter 'calculated_trade_id' is set
|
277
|
-
if @api_client.config.client_side_validation && calculated_trade_id.nil?
|
278
|
-
fail ArgumentError, "Missing the required parameter 'calculated_trade_id' when calling TradingApi.get_calculated_trades_impact"
|
279
|
-
end
|
280
|
-
# resource path
|
281
|
-
local_var_path = '/portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/impact'.sub('{' + 'portfolioGroupId' + '}', CGI.escape(portfolio_group_id.to_s)).sub('{' + 'calculatedTradeId' + '}', CGI.escape(calculated_trade_id.to_s))
|
282
|
-
|
283
|
-
# query parameters
|
284
|
-
query_params = opts[:query_params] || {}
|
285
|
-
|
286
|
-
# header parameters
|
287
|
-
header_params = opts[:header_params] || {}
|
288
|
-
# HTTP header 'Accept' (if needed)
|
289
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
290
|
-
|
291
|
-
# form parameters
|
292
|
-
form_params = opts[:form_params] || {}
|
293
|
-
|
294
|
-
# http body (model)
|
295
|
-
post_body = opts[:debug_body]
|
296
|
-
|
297
|
-
# return_type
|
298
|
-
return_type = opts[:debug_return_type] || 'Array<TradeImpact>'
|
299
|
-
|
300
|
-
# auth_names
|
301
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
302
|
-
|
303
|
-
new_options = opts.merge(
|
304
|
-
:operation => :"TradingApi.get_calculated_trades_impact",
|
305
|
-
:header_params => header_params,
|
306
|
-
:query_params => query_params,
|
307
|
-
:form_params => form_params,
|
308
|
-
:body => post_body,
|
309
|
-
:auth_names => auth_names,
|
310
|
-
:return_type => return_type
|
311
|
-
)
|
312
|
-
|
313
|
-
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
314
|
-
if @api_client.config.debugging
|
315
|
-
@api_client.config.logger.debug "API called: TradingApi#get_calculated_trades_impact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
316
|
-
end
|
317
|
-
return data, status_code, headers, response
|
318
|
-
end
|
319
|
-
|
320
|
-
|
321
139
|
# Check impact of trades on account.
|
322
140
|
# @param user_id [String]
|
323
141
|
# @param user_secret [String]
|
@@ -569,233 +387,6 @@ module SnapTrade
|
|
569
387
|
end
|
570
388
|
|
571
389
|
|
572
|
-
# Modify units of a trade before it is placed
|
573
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
574
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
575
|
-
# @param trade_id [String] The ID of trade object
|
576
|
-
# @param id [String]
|
577
|
-
# @param account [Account]
|
578
|
-
# @param symbol [BrokerageSymbol]
|
579
|
-
# @param universal_symbol [UniversalSymbol]
|
580
|
-
# @param action [TradeAction]
|
581
|
-
# @param units [Integer]
|
582
|
-
# @param price [Float]
|
583
|
-
# @param sequence [Integer]
|
584
|
-
# @param body [Trade]
|
585
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
586
|
-
def modify_calculated_trade_by_id(portfolio_group_id:, calculated_trade_id:, trade_id:, id: SENTINEL, account: SENTINEL, symbol: SENTINEL, universal_symbol: SENTINEL, action: SENTINEL, units: SENTINEL, price: SENTINEL, sequence: SENTINEL, extra: {})
|
587
|
-
_body = {}
|
588
|
-
_body[:id] = id if id != SENTINEL
|
589
|
-
_body[:account] = account if account != SENTINEL
|
590
|
-
_body[:symbol] = symbol if symbol != SENTINEL
|
591
|
-
_body[:universal_symbol] = universal_symbol if universal_symbol != SENTINEL
|
592
|
-
_body[:action] = action if action != SENTINEL
|
593
|
-
_body[:units] = units if units != SENTINEL
|
594
|
-
_body[:price] = price if price != SENTINEL
|
595
|
-
_body[:sequence] = sequence if sequence != SENTINEL
|
596
|
-
extra[:trade] = _body if !_body.empty?
|
597
|
-
|
598
|
-
data, _status_code, _headers = modify_calculated_trade_by_id_with_http_info_impl(portfolio_group_id, calculated_trade_id, trade_id, extra)
|
599
|
-
data
|
600
|
-
end
|
601
|
-
|
602
|
-
# Modify units of a trade before it is placed
|
603
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
604
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
605
|
-
# @param trade_id [String] The ID of trade object
|
606
|
-
# @param id [String]
|
607
|
-
# @param account [Account]
|
608
|
-
# @param symbol [BrokerageSymbol]
|
609
|
-
# @param universal_symbol [UniversalSymbol]
|
610
|
-
# @param action [TradeAction]
|
611
|
-
# @param units [Integer]
|
612
|
-
# @param price [Float]
|
613
|
-
# @param sequence [Integer]
|
614
|
-
# @param body [Trade]
|
615
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
616
|
-
def modify_calculated_trade_by_id_with_http_info(portfolio_group_id:, calculated_trade_id:, trade_id:, id: SENTINEL, account: SENTINEL, symbol: SENTINEL, universal_symbol: SENTINEL, action: SENTINEL, units: SENTINEL, price: SENTINEL, sequence: SENTINEL, extra: {})
|
617
|
-
_body = {}
|
618
|
-
_body[:id] = id if id != SENTINEL
|
619
|
-
_body[:account] = account if account != SENTINEL
|
620
|
-
_body[:symbol] = symbol if symbol != SENTINEL
|
621
|
-
_body[:universal_symbol] = universal_symbol if universal_symbol != SENTINEL
|
622
|
-
_body[:action] = action if action != SENTINEL
|
623
|
-
_body[:units] = units if units != SENTINEL
|
624
|
-
_body[:price] = price if price != SENTINEL
|
625
|
-
_body[:sequence] = sequence if sequence != SENTINEL
|
626
|
-
extra[:trade] = _body if !_body.empty?
|
627
|
-
|
628
|
-
modify_calculated_trade_by_id_with_http_info_impl(portfolio_group_id, calculated_trade_id, trade_id, extra)
|
629
|
-
end
|
630
|
-
|
631
|
-
# Modify units of a trade before it is placed
|
632
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
633
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
634
|
-
# @param trade_id [String] The ID of trade object
|
635
|
-
# @param [Hash] opts the optional parameters
|
636
|
-
# @option opts [Trade] :trade
|
637
|
-
# @return [Trade]
|
638
|
-
def modify_calculated_trade_by_id_impl(portfolio_group_id, calculated_trade_id, trade_id, opts = {})
|
639
|
-
data, _status_code, _headers = modify_calculated_trade_by_id_with_http_info(portfolio_group_id, calculated_trade_id, trade_id, opts)
|
640
|
-
data
|
641
|
-
end
|
642
|
-
|
643
|
-
# Modify units of a trade before it is placed
|
644
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
645
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
646
|
-
# @param trade_id [String] The ID of trade object
|
647
|
-
# @param [Hash] opts the optional parameters
|
648
|
-
# @option opts [Trade] :trade
|
649
|
-
# @return [Array<(Trade, Integer, Hash)>] Trade data, response status code and response headers
|
650
|
-
def modify_calculated_trade_by_id_with_http_info_impl(portfolio_group_id, calculated_trade_id, trade_id, opts = {})
|
651
|
-
if @api_client.config.debugging
|
652
|
-
@api_client.config.logger.debug 'Calling API: TradingApi.modify_calculated_trade_by_id ...'
|
653
|
-
end
|
654
|
-
# verify the required parameter 'portfolio_group_id' is set
|
655
|
-
if @api_client.config.client_side_validation && portfolio_group_id.nil?
|
656
|
-
fail ArgumentError, "Missing the required parameter 'portfolio_group_id' when calling TradingApi.modify_calculated_trade_by_id"
|
657
|
-
end
|
658
|
-
# verify the required parameter 'calculated_trade_id' is set
|
659
|
-
if @api_client.config.client_side_validation && calculated_trade_id.nil?
|
660
|
-
fail ArgumentError, "Missing the required parameter 'calculated_trade_id' when calling TradingApi.modify_calculated_trade_by_id"
|
661
|
-
end
|
662
|
-
# verify the required parameter 'trade_id' is set
|
663
|
-
if @api_client.config.client_side_validation && trade_id.nil?
|
664
|
-
fail ArgumentError, "Missing the required parameter 'trade_id' when calling TradingApi.modify_calculated_trade_by_id"
|
665
|
-
end
|
666
|
-
# resource path
|
667
|
-
local_var_path = '/portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/modify/{tradeId}'.sub('{' + 'portfolioGroupId' + '}', CGI.escape(portfolio_group_id.to_s)).sub('{' + 'calculatedTradeId' + '}', CGI.escape(calculated_trade_id.to_s)).sub('{' + 'tradeId' + '}', CGI.escape(trade_id.to_s))
|
668
|
-
|
669
|
-
# query parameters
|
670
|
-
query_params = opts[:query_params] || {}
|
671
|
-
|
672
|
-
# header parameters
|
673
|
-
header_params = opts[:header_params] || {}
|
674
|
-
# HTTP header 'Accept' (if needed)
|
675
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
676
|
-
# HTTP header 'Content-Type'
|
677
|
-
content_type = @api_client.select_header_content_type(['application/json'])
|
678
|
-
if !content_type.nil?
|
679
|
-
header_params['Content-Type'] = content_type
|
680
|
-
end
|
681
|
-
|
682
|
-
# form parameters
|
683
|
-
form_params = opts[:form_params] || {}
|
684
|
-
|
685
|
-
# http body (model)
|
686
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'trade'])
|
687
|
-
|
688
|
-
# return_type
|
689
|
-
return_type = opts[:debug_return_type] || 'Trade'
|
690
|
-
|
691
|
-
# auth_names
|
692
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
693
|
-
|
694
|
-
new_options = opts.merge(
|
695
|
-
:operation => :"TradingApi.modify_calculated_trade_by_id",
|
696
|
-
:header_params => header_params,
|
697
|
-
:query_params => query_params,
|
698
|
-
:form_params => form_params,
|
699
|
-
:body => post_body,
|
700
|
-
:auth_names => auth_names,
|
701
|
-
:return_type => return_type
|
702
|
-
)
|
703
|
-
|
704
|
-
data, status_code, headers, response = @api_client.call_api(:PATCH, local_var_path, new_options)
|
705
|
-
if @api_client.config.debugging
|
706
|
-
@api_client.config.logger.debug "API called: TradingApi#modify_calculated_trade_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
707
|
-
end
|
708
|
-
return data, status_code, headers, response
|
709
|
-
end
|
710
|
-
|
711
|
-
|
712
|
-
# Place orders for the CalculatedTrades in series
|
713
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
714
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
715
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
716
|
-
def place_calculated_trades(portfolio_group_id:, calculated_trade_id:, extra: {})
|
717
|
-
|
718
|
-
data, _status_code, _headers = place_calculated_trades_with_http_info_impl(portfolio_group_id, calculated_trade_id, extra)
|
719
|
-
data
|
720
|
-
end
|
721
|
-
|
722
|
-
# Place orders for the CalculatedTrades in series
|
723
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
724
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
725
|
-
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
726
|
-
def place_calculated_trades_with_http_info(portfolio_group_id:, calculated_trade_id:, extra: {})
|
727
|
-
|
728
|
-
place_calculated_trades_with_http_info_impl(portfolio_group_id, calculated_trade_id, extra)
|
729
|
-
end
|
730
|
-
|
731
|
-
# Place orders for the CalculatedTrades in series
|
732
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
733
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
734
|
-
# @param [Hash] opts the optional parameters
|
735
|
-
# @return [Array<TradeExecutionStatus>]
|
736
|
-
def place_calculated_trades_impl(portfolio_group_id, calculated_trade_id, opts = {})
|
737
|
-
data, _status_code, _headers = place_calculated_trades_with_http_info(portfolio_group_id, calculated_trade_id, opts)
|
738
|
-
data
|
739
|
-
end
|
740
|
-
|
741
|
-
# Place orders for the CalculatedTrades in series
|
742
|
-
# @param portfolio_group_id [String] The ID of the PortfolioGroup to perform rebalancing calculations
|
743
|
-
# @param calculated_trade_id [String] The ID of calculated trade to get account impact
|
744
|
-
# @param [Hash] opts the optional parameters
|
745
|
-
# @return [Array<(Array<TradeExecutionStatus>, Integer, Hash)>] Array<TradeExecutionStatus> data, response status code and response headers
|
746
|
-
def place_calculated_trades_with_http_info_impl(portfolio_group_id, calculated_trade_id, opts = {})
|
747
|
-
if @api_client.config.debugging
|
748
|
-
@api_client.config.logger.debug 'Calling API: TradingApi.place_calculated_trades ...'
|
749
|
-
end
|
750
|
-
# verify the required parameter 'portfolio_group_id' is set
|
751
|
-
if @api_client.config.client_side_validation && portfolio_group_id.nil?
|
752
|
-
fail ArgumentError, "Missing the required parameter 'portfolio_group_id' when calling TradingApi.place_calculated_trades"
|
753
|
-
end
|
754
|
-
# verify the required parameter 'calculated_trade_id' is set
|
755
|
-
if @api_client.config.client_side_validation && calculated_trade_id.nil?
|
756
|
-
fail ArgumentError, "Missing the required parameter 'calculated_trade_id' when calling TradingApi.place_calculated_trades"
|
757
|
-
end
|
758
|
-
# resource path
|
759
|
-
local_var_path = '/portfolioGroups/{portfolioGroupId}/calculatedtrades/{calculatedTradeId}/placeOrders'.sub('{' + 'portfolioGroupId' + '}', CGI.escape(portfolio_group_id.to_s)).sub('{' + 'calculatedTradeId' + '}', CGI.escape(calculated_trade_id.to_s))
|
760
|
-
|
761
|
-
# query parameters
|
762
|
-
query_params = opts[:query_params] || {}
|
763
|
-
|
764
|
-
# header parameters
|
765
|
-
header_params = opts[:header_params] || {}
|
766
|
-
# HTTP header 'Accept' (if needed)
|
767
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
768
|
-
|
769
|
-
# form parameters
|
770
|
-
form_params = opts[:form_params] || {}
|
771
|
-
|
772
|
-
# http body (model)
|
773
|
-
post_body = opts[:debug_body]
|
774
|
-
|
775
|
-
# return_type
|
776
|
-
return_type = opts[:debug_return_type] || 'Array<TradeExecutionStatus>'
|
777
|
-
|
778
|
-
# auth_names
|
779
|
-
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
780
|
-
|
781
|
-
new_options = opts.merge(
|
782
|
-
:operation => :"TradingApi.place_calculated_trades",
|
783
|
-
:header_params => header_params,
|
784
|
-
:query_params => query_params,
|
785
|
-
:form_params => form_params,
|
786
|
-
:body => post_body,
|
787
|
-
:auth_names => auth_names,
|
788
|
-
:return_type => return_type
|
789
|
-
)
|
790
|
-
|
791
|
-
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
792
|
-
if @api_client.config.debugging
|
793
|
-
@api_client.config.logger.debug "API called: TradingApi#place_calculated_trades\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
794
|
-
end
|
795
|
-
return data, status_code, headers, response
|
796
|
-
end
|
797
|
-
|
798
|
-
|
799
390
|
# Place a trade with NO validation.
|
800
391
|
# @param user_id [String]
|
801
392
|
# @param user_secret [String]
|
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)
|
@@ -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
|
@@ -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 [OptionsHoldings]
|
79
|
+
# @return [Array<OptionsHoldings>]
|
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
|
@@ -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
|
@@ -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.9.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-07-27 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
|