snaptrade 2.0.98 → 2.0.99
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 +2 -2
- data/lib/snaptrade/api/trading_api.rb +15 -15
- data/lib/snaptrade/models/{trading_place_mleg_order_request.rb → mleg_trade_form.rb} +4 -3
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +1 -1
- data/spec/api/trading_api_spec.rb +1 -1
- data/spec/models/{trading_place_mleg_order_request_spec.rb → mleg_trade_form_spec.rb} +6 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c48bd0756faff5c29b1642adbf405f37f66338645c30b1ddfd598271ea449284
|
4
|
+
data.tar.gz: 1c33444711aa6be4af2627f32d9678921d11392baa7f5af6c2978bf562d6e362
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5495bc4bf0b6b179e96de1440fef9fe142c1d54bfab486de895abbd4a95d8cf4c1e444e801733f6cf35e9f8df035db8ac61dea3e57f32f65cd5ce30b147074bb
|
7
|
+
data.tar.gz: 0a6ae06dc8e9aeb0bc787d73ff1d1332b3713aab687e3b1ee9e3e21193efaa262a1c6d0ac665501ad6ec2ab1fa038d140b6125a2f685f8dd22e6d72206c6c969
|
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.99)
|
10
10
|
[](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -82,7 +82,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
82
82
|
Add to Gemfile:
|
83
83
|
|
84
84
|
```ruby
|
85
|
-
gem 'snaptrade', '~> 2.0.
|
85
|
+
gem 'snaptrade', '~> 2.0.99'
|
86
86
|
```
|
87
87
|
|
88
88
|
## Getting Started<a id="getting-started"></a>
|
@@ -964,7 +964,7 @@ module SnapTrade
|
|
964
964
|
# @param account_id [String]
|
965
965
|
# @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
|
966
966
|
# @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
|
967
|
-
# @param body [
|
967
|
+
# @param body [MlegTradeForm]
|
968
968
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
969
969
|
def place_mleg_order(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, extra: {})
|
970
970
|
_body = {}
|
@@ -973,8 +973,8 @@ module SnapTrade
|
|
973
973
|
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
974
974
|
_body[:stop_price] = stop_price if stop_price != SENTINEL
|
975
975
|
_body[:legs] = legs if legs != SENTINEL
|
976
|
-
|
977
|
-
data, _status_code, _headers = place_mleg_order_with_http_info_impl(user_id, user_secret, account_id,
|
976
|
+
mleg_trade_form = _body
|
977
|
+
data, _status_code, _headers = place_mleg_order_with_http_info_impl(user_id, user_secret, account_id, mleg_trade_form, extra)
|
978
978
|
data
|
979
979
|
end
|
980
980
|
|
@@ -990,7 +990,7 @@ module SnapTrade
|
|
990
990
|
# @param account_id [String]
|
991
991
|
# @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
|
992
992
|
# @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
|
993
|
-
# @param body [
|
993
|
+
# @param body [MlegTradeForm]
|
994
994
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
995
995
|
def place_mleg_order_with_http_info(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, extra: {})
|
996
996
|
_body = {}
|
@@ -999,8 +999,8 @@ module SnapTrade
|
|
999
999
|
_body[:limit_price] = limit_price if limit_price != SENTINEL
|
1000
1000
|
_body[:stop_price] = stop_price if stop_price != SENTINEL
|
1001
1001
|
_body[:legs] = legs if legs != SENTINEL
|
1002
|
-
|
1003
|
-
place_mleg_order_with_http_info_impl(user_id, user_secret, account_id,
|
1002
|
+
mleg_trade_form = _body
|
1003
|
+
place_mleg_order_with_http_info_impl(user_id, user_secret, account_id, mleg_trade_form, extra)
|
1004
1004
|
end
|
1005
1005
|
|
1006
1006
|
# Place multi-leg option order
|
@@ -1008,11 +1008,11 @@ module SnapTrade
|
|
1008
1008
|
# @param user_id [String]
|
1009
1009
|
# @param user_secret [String]
|
1010
1010
|
# @param account_id [String]
|
1011
|
-
# @param
|
1011
|
+
# @param mleg_trade_form [MlegTradeForm]
|
1012
1012
|
# @param [Hash] opts the optional parameters
|
1013
1013
|
# @return [MlegOrderResponse]
|
1014
|
-
private def place_mleg_order_impl(user_id, user_secret, account_id,
|
1015
|
-
data, _status_code, _headers = place_mleg_order_with_http_info(user_id, user_secret, account_id,
|
1014
|
+
private def place_mleg_order_impl(user_id, user_secret, account_id, mleg_trade_form, opts = {})
|
1015
|
+
data, _status_code, _headers = place_mleg_order_with_http_info(user_id, user_secret, account_id, mleg_trade_form, opts)
|
1016
1016
|
data
|
1017
1017
|
end
|
1018
1018
|
|
@@ -1021,10 +1021,10 @@ module SnapTrade
|
|
1021
1021
|
# @param user_id [String]
|
1022
1022
|
# @param user_secret [String]
|
1023
1023
|
# @param account_id [String]
|
1024
|
-
# @param
|
1024
|
+
# @param mleg_trade_form [MlegTradeForm]
|
1025
1025
|
# @param [Hash] opts the optional parameters
|
1026
1026
|
# @return [Array<(MlegOrderResponse, Integer, Hash)>] MlegOrderResponse data, response status code and response headers
|
1027
|
-
private def place_mleg_order_with_http_info_impl(user_id, user_secret, account_id,
|
1027
|
+
private def place_mleg_order_with_http_info_impl(user_id, user_secret, account_id, mleg_trade_form, opts = {})
|
1028
1028
|
if @api_client.config.debugging
|
1029
1029
|
@api_client.config.logger.debug 'Calling API: TradingApi.place_mleg_order ...'
|
1030
1030
|
end
|
@@ -1040,9 +1040,9 @@ module SnapTrade
|
|
1040
1040
|
if @api_client.config.client_side_validation && account_id.nil?
|
1041
1041
|
fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.place_mleg_order"
|
1042
1042
|
end
|
1043
|
-
# verify the required parameter '
|
1044
|
-
if @api_client.config.client_side_validation &&
|
1045
|
-
fail ArgumentError, "Missing the required parameter '
|
1043
|
+
# verify the required parameter 'mleg_trade_form' is set
|
1044
|
+
if @api_client.config.client_side_validation && mleg_trade_form.nil?
|
1045
|
+
fail ArgumentError, "Missing the required parameter 'mleg_trade_form' when calling TradingApi.place_mleg_order"
|
1046
1046
|
end
|
1047
1047
|
# resource path
|
1048
1048
|
local_var_path = '/accounts/{accountId}/trading/options'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
@@ -1066,7 +1066,7 @@ module SnapTrade
|
|
1066
1066
|
form_params = opts[:form_params] || {}
|
1067
1067
|
|
1068
1068
|
# http body (model)
|
1069
|
-
post_body = opts[:debug_body] || @api_client.object_to_http_body(
|
1069
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(mleg_trade_form)
|
1070
1070
|
|
1071
1071
|
# return_type
|
1072
1072
|
return_type = opts[:debug_return_type] || 'MlegOrderResponse'
|
@@ -11,7 +11,8 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
|
14
|
+
# Inputs for placing a multi-leg order with the brokerage.
|
15
|
+
class MlegTradeForm
|
15
16
|
# The type of order to place.
|
16
17
|
attr_accessor :order_type
|
17
18
|
|
@@ -65,13 +66,13 @@ module SnapTrade
|
|
65
66
|
# @param [Hash] attributes Model attributes in the form of hash
|
66
67
|
def initialize(attributes = {})
|
67
68
|
if (!attributes.is_a?(Hash))
|
68
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::
|
69
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::MlegTradeForm` initialize method"
|
69
70
|
end
|
70
71
|
|
71
72
|
# check to see if the attribute exists and convert string to symbol for hash key
|
72
73
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
73
74
|
if (!self.class.attribute_map.key?(k.to_sym))
|
74
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::
|
75
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::MlegTradeForm`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
75
76
|
end
|
76
77
|
h[k.to_sym] = v
|
77
78
|
}
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -79,6 +79,7 @@ require 'snaptrade/models/mleg_instrument_type'
|
|
79
79
|
require 'snaptrade/models/mleg_leg'
|
80
80
|
require 'snaptrade/models/mleg_order_response'
|
81
81
|
require 'snaptrade/models/mleg_order_type_strict'
|
82
|
+
require 'snaptrade/models/mleg_trade_form'
|
82
83
|
require 'snaptrade/models/mleg_trading_instrument'
|
83
84
|
require 'snaptrade/models/model400_failed_request_response'
|
84
85
|
require 'snaptrade/models/model401_failed_request_response'
|
@@ -149,7 +150,6 @@ require 'snaptrade/models/timeframe'
|
|
149
150
|
require 'snaptrade/models/trading_cancel_user_account_order_request'
|
150
151
|
require 'snaptrade/models/trading_instrument'
|
151
152
|
require 'snaptrade/models/trading_instrument_type'
|
152
|
-
require 'snaptrade/models/trading_place_mleg_order_request'
|
153
153
|
require 'snaptrade/models/trading_place_simple_order_request'
|
154
154
|
require 'snaptrade/models/trading_search_cryptocurrency_pair_instruments200_response'
|
155
155
|
require 'snaptrade/models/transactions_status'
|
@@ -137,7 +137,7 @@ describe 'TradingApi' do
|
|
137
137
|
# @param user_id
|
138
138
|
# @param user_secret
|
139
139
|
# @param account_id
|
140
|
-
# @param
|
140
|
+
# @param mleg_trade_form
|
141
141
|
# @param [Hash] opts the optional parameters
|
142
142
|
# @return [MlegOrderResponse]
|
143
143
|
describe 'place_mleg_order test' do
|
@@ -11,13 +11,13 @@ require 'spec_helper'
|
|
11
11
|
require 'json'
|
12
12
|
require 'date'
|
13
13
|
|
14
|
-
# Unit tests for SnapTrade::
|
15
|
-
describe SnapTrade::
|
16
|
-
let(:instance) { SnapTrade::
|
14
|
+
# Unit tests for SnapTrade::MlegTradeForm
|
15
|
+
describe SnapTrade::MlegTradeForm do
|
16
|
+
let(:instance) { SnapTrade::MlegTradeForm.new }
|
17
17
|
|
18
|
-
describe 'test an instance of
|
19
|
-
it 'should create an instance of
|
20
|
-
expect(instance).to be_instance_of(SnapTrade::
|
18
|
+
describe 'test an instance of MlegTradeForm' do
|
19
|
+
it 'should create an instance of MlegTradeForm' do
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::MlegTradeForm)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
describe 'test attribute "order_type"' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.99
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
@@ -158,6 +158,7 @@ files:
|
|
158
158
|
- lib/snaptrade/models/mleg_leg.rb
|
159
159
|
- lib/snaptrade/models/mleg_order_response.rb
|
160
160
|
- lib/snaptrade/models/mleg_order_type_strict.rb
|
161
|
+
- lib/snaptrade/models/mleg_trade_form.rb
|
161
162
|
- lib/snaptrade/models/mleg_trading_instrument.rb
|
162
163
|
- lib/snaptrade/models/model400_failed_request_response.rb
|
163
164
|
- lib/snaptrade/models/model401_failed_request_response.rb
|
@@ -228,7 +229,6 @@ files:
|
|
228
229
|
- lib/snaptrade/models/trading_cancel_user_account_order_request.rb
|
229
230
|
- lib/snaptrade/models/trading_instrument.rb
|
230
231
|
- lib/snaptrade/models/trading_instrument_type.rb
|
231
|
-
- lib/snaptrade/models/trading_place_mleg_order_request.rb
|
232
232
|
- lib/snaptrade/models/trading_place_simple_order_request.rb
|
233
233
|
- lib/snaptrade/models/trading_search_cryptocurrency_pair_instruments200_response.rb
|
234
234
|
- lib/snaptrade/models/transactions_status.rb
|
@@ -317,6 +317,7 @@ files:
|
|
317
317
|
- spec/models/mleg_leg_spec.rb
|
318
318
|
- spec/models/mleg_order_response_spec.rb
|
319
319
|
- spec/models/mleg_order_type_strict_spec.rb
|
320
|
+
- spec/models/mleg_trade_form_spec.rb
|
320
321
|
- spec/models/mleg_trading_instrument_spec.rb
|
321
322
|
- spec/models/model400_failed_request_response_spec.rb
|
322
323
|
- spec/models/model401_failed_request_response_spec.rb
|
@@ -387,7 +388,6 @@ files:
|
|
387
388
|
- spec/models/trading_cancel_user_account_order_request_spec.rb
|
388
389
|
- spec/models/trading_instrument_spec.rb
|
389
390
|
- spec/models/trading_instrument_type_spec.rb
|
390
|
-
- spec/models/trading_place_mleg_order_request_spec.rb
|
391
391
|
- spec/models/trading_place_simple_order_request_spec.rb
|
392
392
|
- spec/models/trading_search_cryptocurrency_pair_instruments200_response_spec.rb
|
393
393
|
- spec/models/transactions_status_spec.rb
|
@@ -458,6 +458,7 @@ test_files:
|
|
458
458
|
- spec/models/brokerage_type_spec.rb
|
459
459
|
- spec/models/account_order_record_quote_currency_spec.rb
|
460
460
|
- spec/models/child_brokerage_order_ids_spec.rb
|
461
|
+
- spec/models/mleg_trade_form_spec.rb
|
461
462
|
- spec/models/sub_period_return_rate_spec.rb
|
462
463
|
- spec/models/option_strategy_legs_inner_spec.rb
|
463
464
|
- spec/models/account_spec.rb
|
@@ -566,7 +567,6 @@ test_files:
|
|
566
567
|
- spec/models/account_order_record_status_spec.rb
|
567
568
|
- spec/models/manual_trade_symbol_spec.rb
|
568
569
|
- spec/models/symbol_figi_instrument_spec.rb
|
569
|
-
- spec/models/trading_place_mleg_order_request_spec.rb
|
570
570
|
- spec/models/account_holdings_account_spec.rb
|
571
571
|
- spec/models/option_brokerage_symbol_spec.rb
|
572
572
|
- spec/models/mleg_trading_instrument_spec.rb
|