snaptrade 2.0.115 → 2.0.117
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 +4 -4
- data/README.md +8 -5
- data/lib/snaptrade/api/trading_api.rb +38 -25
- data/lib/snaptrade/models/cancel_order_response.rb +235 -0
- data/lib/snaptrade/models/mleg_price_effect_strict.rb +38 -0
- data/lib/snaptrade/models/mleg_trade_form.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +2 -0
- data/spec/api/trading_api_spec.rb +3 -3
- data/spec/models/cancel_order_response_spec.rb +35 -0
- data/spec/models/mleg_price_effect_strict_spec.rb +23 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef8201400909485368df1fdff26fabb434749cfa6475781b2c84a6cb378184d5
|
4
|
+
data.tar.gz: e7b8fd71649e94331387ba7fd07ddebd598925fb75f3632a2c6082786673fc58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ffc04aaf4004e7ab947e6bd01d8ff42a90203e4e59a711c3cf155410da61b6a72f7d5e05b4a4c009fd406822d2038229d46b1b1073431a49266c0bd9180cb05
|
7
|
+
data.tar.gz: 14194d51f2342ec95993408cf0f067047d554f46db5fdc65ea78be9d001ce8487ea1f2270f410e6a1391c8c00a06a008e7bec3afe1737086eebc2957929f9ac9
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
snaptrade (2.0.
|
4
|
+
snaptrade (2.0.117)
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
7
7
|
|
@@ -29,7 +29,7 @@ GEM
|
|
29
29
|
method_source (1.1.0)
|
30
30
|
multipart-post (2.4.1)
|
31
31
|
parallel (1.27.0)
|
32
|
-
parser (3.3.
|
32
|
+
parser (3.3.9.0)
|
33
33
|
ast (~> 2.4.1)
|
34
34
|
racc
|
35
35
|
prism (1.4.0)
|
@@ -43,7 +43,7 @@ GEM
|
|
43
43
|
rainbow (3.1.1)
|
44
44
|
rake (13.0.6)
|
45
45
|
regexp_parser (2.10.0)
|
46
|
-
reline (0.6.
|
46
|
+
reline (0.6.2)
|
47
47
|
io-console (~> 0.5)
|
48
48
|
rexml (3.4.1)
|
49
49
|
rspec (3.13.1)
|
@@ -68,7 +68,7 @@ GEM
|
|
68
68
|
rubocop-ast (>= 1.2.0, < 2.0)
|
69
69
|
ruby-progressbar (~> 1.7)
|
70
70
|
unicode-display_width (>= 1.4.0, < 3.0)
|
71
|
-
rubocop-ast (1.
|
71
|
+
rubocop-ast (1.46.0)
|
72
72
|
parser (>= 3.3.7.2)
|
73
73
|
prism (~> 1.4)
|
74
74
|
ruby-progressbar (1.13.0)
|
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.117)
|
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.117'
|
86
86
|
```
|
87
87
|
|
88
88
|
## Getting Started<a id="getting-started"></a>
|
@@ -1603,13 +1603,16 @@ p result
|
|
1603
1603
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
1604
1604
|
##### account_id: `String`<a id="account_id-string"></a>
|
1605
1605
|
##### brokerage_order_id: `String`<a id="brokerage_order_id-string"></a>
|
1606
|
+
Order ID returned by brokerage. This is the unique identifier for the order in
|
1607
|
+
the brokerage system.
|
1608
|
+
|
1606
1609
|
#### 🔄 Return<a id="🔄-return"></a>
|
1607
1610
|
|
1608
|
-
[
|
1611
|
+
[CancelOrderResponse](./lib/snaptrade/models/cancel_order_response.rb)
|
1609
1612
|
|
1610
1613
|
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
1611
1614
|
|
1612
|
-
`/accounts/{accountId}/trading/
|
1615
|
+
`/accounts/{accountId}/trading/cancel` `POST`
|
1613
1616
|
|
1614
1617
|
[🔙 **Back to Table of Contents**](#table-of-contents)
|
1615
1618
|
|
@@ -2051,7 +2054,7 @@ The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
|
|
2051
2054
|
##### stop_price: `Float`<a id="stop_price-float"></a>
|
2052
2055
|
The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
|
2053
2056
|
|
2054
|
-
##### price_effect: [`
|
2057
|
+
##### price_effect: [`MlegPriceEffectStrict`](./lib/snaptrade/models/mleg_price_effect_strict.rb)<a id="price_effect-mlegpriceeffectstrictlibsnaptrademodelsmleg_price_effect_strictrb"></a>
|
2055
2058
|
#### 🔄 Return<a id="🔄-return"></a>
|
2056
2059
|
|
2057
2060
|
[MlegOrderResponse](./lib/snaptrade/models/mleg_order_response.rb)
|
@@ -17,55 +17,63 @@ module SnapTrade
|
|
17
17
|
@api_client = api_client
|
18
18
|
end
|
19
19
|
|
20
|
-
# Cancel
|
20
|
+
# Cancel order
|
21
21
|
#
|
22
22
|
# Cancels an order in the specified account.
|
23
23
|
#
|
24
24
|
# @param user_id [String]
|
25
25
|
# @param user_secret [String]
|
26
26
|
# @param account_id [String]
|
27
|
-
# @param brokerage_order_id [String]
|
27
|
+
# @param brokerage_order_id [String] Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
28
|
+
# @param body [TradingCancelUserAccountOrderRequest]
|
28
29
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
29
|
-
def cancel_order(user_id:, user_secret:, account_id:, brokerage_order_id
|
30
|
-
|
30
|
+
def cancel_order(user_id:, user_secret:, account_id:, brokerage_order_id: SENTINEL, extra: {})
|
31
|
+
_body = {}
|
32
|
+
_body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
|
33
|
+
trading_cancel_user_account_order_request = _body
|
34
|
+
data, _status_code, _headers = cancel_order_with_http_info_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, extra)
|
31
35
|
data
|
32
36
|
end
|
33
37
|
|
34
|
-
# Cancel
|
38
|
+
# Cancel order
|
35
39
|
#
|
36
40
|
# Cancels an order in the specified account.
|
37
41
|
#
|
38
42
|
# @param user_id [String]
|
39
43
|
# @param user_secret [String]
|
40
44
|
# @param account_id [String]
|
41
|
-
# @param brokerage_order_id [String]
|
45
|
+
# @param brokerage_order_id [String] Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
46
|
+
# @param body [TradingCancelUserAccountOrderRequest]
|
42
47
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
43
|
-
def cancel_order_with_http_info(user_id:, user_secret:, account_id:, brokerage_order_id
|
44
|
-
|
48
|
+
def cancel_order_with_http_info(user_id:, user_secret:, account_id:, brokerage_order_id: SENTINEL, extra: {})
|
49
|
+
_body = {}
|
50
|
+
_body[:brokerage_order_id] = brokerage_order_id if brokerage_order_id != SENTINEL
|
51
|
+
trading_cancel_user_account_order_request = _body
|
52
|
+
cancel_order_with_http_info_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, extra)
|
45
53
|
end
|
46
54
|
|
47
|
-
# Cancel
|
55
|
+
# Cancel order
|
48
56
|
# Cancels an order in the specified account.
|
49
57
|
# @param user_id [String]
|
50
58
|
# @param user_secret [String]
|
51
59
|
# @param account_id [String]
|
52
|
-
# @param
|
60
|
+
# @param trading_cancel_user_account_order_request [TradingCancelUserAccountOrderRequest]
|
53
61
|
# @param [Hash] opts the optional parameters
|
54
|
-
# @return [
|
55
|
-
private def cancel_order_impl(user_id, user_secret, account_id,
|
56
|
-
data, _status_code, _headers = cancel_order_with_http_info(user_id, user_secret, account_id,
|
62
|
+
# @return [CancelOrderResponse]
|
63
|
+
private def cancel_order_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts = {})
|
64
|
+
data, _status_code, _headers = cancel_order_with_http_info(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts)
|
57
65
|
data
|
58
66
|
end
|
59
67
|
|
60
|
-
# Cancel
|
68
|
+
# Cancel order
|
61
69
|
# Cancels an order in the specified account.
|
62
70
|
# @param user_id [String]
|
63
71
|
# @param user_secret [String]
|
64
72
|
# @param account_id [String]
|
65
|
-
# @param
|
73
|
+
# @param trading_cancel_user_account_order_request [TradingCancelUserAccountOrderRequest]
|
66
74
|
# @param [Hash] opts the optional parameters
|
67
|
-
# @return [Array<(
|
68
|
-
private def cancel_order_with_http_info_impl(user_id, user_secret, account_id,
|
75
|
+
# @return [Array<(CancelOrderResponse, Integer, Hash)>] CancelOrderResponse data, response status code and response headers
|
76
|
+
private def cancel_order_with_http_info_impl(user_id, user_secret, account_id, trading_cancel_user_account_order_request, opts = {})
|
69
77
|
if @api_client.config.debugging
|
70
78
|
@api_client.config.logger.debug 'Calling API: TradingApi.cancel_order ...'
|
71
79
|
end
|
@@ -81,12 +89,12 @@ module SnapTrade
|
|
81
89
|
if @api_client.config.client_side_validation && account_id.nil?
|
82
90
|
fail ArgumentError, "Missing the required parameter 'account_id' when calling TradingApi.cancel_order"
|
83
91
|
end
|
84
|
-
# verify the required parameter '
|
85
|
-
if @api_client.config.client_side_validation &&
|
86
|
-
fail ArgumentError, "Missing the required parameter '
|
92
|
+
# verify the required parameter 'trading_cancel_user_account_order_request' is set
|
93
|
+
if @api_client.config.client_side_validation && trading_cancel_user_account_order_request.nil?
|
94
|
+
fail ArgumentError, "Missing the required parameter 'trading_cancel_user_account_order_request' when calling TradingApi.cancel_order"
|
87
95
|
end
|
88
96
|
# resource path
|
89
|
-
local_var_path = '/accounts/{accountId}/trading/
|
97
|
+
local_var_path = '/accounts/{accountId}/trading/cancel'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
90
98
|
|
91
99
|
# query parameters
|
92
100
|
query_params = opts[:query_params] || {}
|
@@ -97,15 +105,20 @@ module SnapTrade
|
|
97
105
|
header_params = opts[:header_params] || {}
|
98
106
|
# HTTP header 'Accept' (if needed)
|
99
107
|
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
108
|
+
# HTTP header 'Content-Type'
|
109
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
110
|
+
if !content_type.nil?
|
111
|
+
header_params['Content-Type'] = content_type
|
112
|
+
end
|
100
113
|
|
101
114
|
# form parameters
|
102
115
|
form_params = opts[:form_params] || {}
|
103
116
|
|
104
117
|
# http body (model)
|
105
|
-
post_body = opts[:debug_body]
|
118
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(trading_cancel_user_account_order_request)
|
106
119
|
|
107
120
|
# return_type
|
108
|
-
return_type = opts[:debug_return_type] || '
|
121
|
+
return_type = opts[:debug_return_type] || 'CancelOrderResponse'
|
109
122
|
|
110
123
|
# auth_names
|
111
124
|
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
@@ -964,7 +977,7 @@ module SnapTrade
|
|
964
977
|
# @param account_id [String]
|
965
978
|
# @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
|
966
979
|
# @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
|
967
|
-
# @param price_effect [
|
980
|
+
# @param price_effect [MlegPriceEffectStrict]
|
968
981
|
# @param body [MlegTradeForm]
|
969
982
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
970
983
|
def place_mleg_order(order_type:, time_in_force:, legs:, user_id:, user_secret:, account_id:, limit_price: SENTINEL, stop_price: SENTINEL, price_effect: SENTINEL, extra: {})
|
@@ -992,7 +1005,7 @@ module SnapTrade
|
|
992
1005
|
# @param account_id [String]
|
993
1006
|
# @param limit_price [Float] The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
|
994
1007
|
# @param stop_price [Float] The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
|
995
|
-
# @param price_effect [
|
1008
|
+
# @param price_effect [MlegPriceEffectStrict]
|
996
1009
|
# @param body [MlegTradeForm]
|
997
1010
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
998
1011
|
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, price_effect: SENTINEL, extra: {})
|
@@ -0,0 +1,235 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
require 'time'
|
12
|
+
|
13
|
+
module SnapTrade
|
14
|
+
class CancelOrderResponse
|
15
|
+
# Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
16
|
+
attr_accessor :brokerage_order_id
|
17
|
+
|
18
|
+
# The raw response from the brokerage.
|
19
|
+
attr_accessor :raw_response
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'brokerage_order_id' => :'brokerage_order_id',
|
25
|
+
:'raw_response' => :'raw_response'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns all the JSON keys this model knows about
|
30
|
+
def self.acceptable_attributes
|
31
|
+
attribute_map.values
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.openapi_types
|
36
|
+
{
|
37
|
+
:'brokerage_order_id' => :'String',
|
38
|
+
:'raw_response' => :'Hash<String, Object>'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# List of attributes with nullable: true
|
43
|
+
def self.openapi_nullable
|
44
|
+
Set.new([
|
45
|
+
:'raw_response'
|
46
|
+
])
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes the object
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
+
def initialize(attributes = {})
|
52
|
+
if (!attributes.is_a?(Hash))
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::CancelOrderResponse` initialize method"
|
54
|
+
end
|
55
|
+
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::CancelOrderResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
|
+
end
|
61
|
+
h[k.to_sym] = v
|
62
|
+
}
|
63
|
+
|
64
|
+
if attributes.key?(:'brokerage_order_id')
|
65
|
+
self.brokerage_order_id = attributes[:'brokerage_order_id']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:'raw_response')
|
69
|
+
if (value = attributes[:'raw_response']).is_a?(Hash)
|
70
|
+
self.raw_response = value
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
76
|
+
# @return Array for valid properties with the reasons
|
77
|
+
def list_invalid_properties
|
78
|
+
invalid_properties = Array.new
|
79
|
+
if @brokerage_order_id.nil?
|
80
|
+
invalid_properties.push('invalid value for "brokerage_order_id", brokerage_order_id cannot be nil.')
|
81
|
+
end
|
82
|
+
|
83
|
+
invalid_properties
|
84
|
+
end
|
85
|
+
|
86
|
+
# Check to see if the all the properties in the model are valid
|
87
|
+
# @return true if the model is valid
|
88
|
+
def valid?
|
89
|
+
return false if @brokerage_order_id.nil?
|
90
|
+
true
|
91
|
+
end
|
92
|
+
|
93
|
+
# Checks equality by comparing each attribute.
|
94
|
+
# @param [Object] Object to be compared
|
95
|
+
def ==(o)
|
96
|
+
return true if self.equal?(o)
|
97
|
+
self.class == o.class &&
|
98
|
+
brokerage_order_id == o.brokerage_order_id &&
|
99
|
+
raw_response == o.raw_response
|
100
|
+
end
|
101
|
+
|
102
|
+
# @see the `==` method
|
103
|
+
# @param [Object] Object to be compared
|
104
|
+
def eql?(o)
|
105
|
+
self == o
|
106
|
+
end
|
107
|
+
|
108
|
+
# Calculates hash code according to all attributes.
|
109
|
+
# @return [Integer] Hash code
|
110
|
+
def hash
|
111
|
+
[brokerage_order_id, raw_response].hash
|
112
|
+
end
|
113
|
+
|
114
|
+
# Builds the object from hash
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
116
|
+
# @return [Object] Returns the model itself
|
117
|
+
def self.build_from_hash(attributes)
|
118
|
+
new.build_from_hash(attributes)
|
119
|
+
end
|
120
|
+
|
121
|
+
# Builds the object from hash
|
122
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
123
|
+
# @return [Object] Returns the model itself
|
124
|
+
def build_from_hash(attributes)
|
125
|
+
return nil unless attributes.is_a?(Hash)
|
126
|
+
attributes = attributes.transform_keys(&:to_sym)
|
127
|
+
self.class.openapi_types.each_pair do |key, type|
|
128
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
129
|
+
self.send("#{key}=", nil)
|
130
|
+
elsif type =~ /\AArray<(.*)>/i
|
131
|
+
# check to ensure the input is an array given that the attribute
|
132
|
+
# is documented as an array but the input is not
|
133
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
134
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
135
|
+
end
|
136
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
137
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
self
|
142
|
+
end
|
143
|
+
|
144
|
+
# Deserializes the data based on type
|
145
|
+
# @param string type Data type
|
146
|
+
# @param string value Value to be deserialized
|
147
|
+
# @return [Object] Deserialized data
|
148
|
+
def _deserialize(type, value)
|
149
|
+
case type.to_sym
|
150
|
+
when :Time
|
151
|
+
Time.parse(value)
|
152
|
+
when :Date
|
153
|
+
Date.parse(value)
|
154
|
+
when :String
|
155
|
+
value.to_s
|
156
|
+
when :Integer
|
157
|
+
value.to_i
|
158
|
+
when :Float
|
159
|
+
value.to_f
|
160
|
+
when :Boolean
|
161
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
162
|
+
true
|
163
|
+
else
|
164
|
+
false
|
165
|
+
end
|
166
|
+
when :Object
|
167
|
+
# generic object (usually a Hash), return directly
|
168
|
+
value
|
169
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
170
|
+
inner_type = Regexp.last_match[:inner_type]
|
171
|
+
value.map { |v| _deserialize(inner_type, v) }
|
172
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
173
|
+
k_type = Regexp.last_match[:k_type]
|
174
|
+
v_type = Regexp.last_match[:v_type]
|
175
|
+
{}.tap do |hash|
|
176
|
+
value.each do |k, v|
|
177
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
else # model
|
181
|
+
# models (e.g. Pet) or oneOf
|
182
|
+
klass = SnapTrade.const_get(type)
|
183
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
# Returns the string representation of the object
|
188
|
+
# @return [String] String presentation of the object
|
189
|
+
def to_s
|
190
|
+
to_hash.to_s
|
191
|
+
end
|
192
|
+
|
193
|
+
# to_body is an alias to to_hash (backward compatibility)
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
195
|
+
def to_body
|
196
|
+
to_hash
|
197
|
+
end
|
198
|
+
|
199
|
+
# Returns the object in the form of hash
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
201
|
+
def to_hash
|
202
|
+
hash = {}
|
203
|
+
self.class.attribute_map.each_pair do |attr, param|
|
204
|
+
value = self.send(attr)
|
205
|
+
if value.nil?
|
206
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
207
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
208
|
+
end
|
209
|
+
|
210
|
+
hash[param] = _to_hash(value)
|
211
|
+
end
|
212
|
+
hash
|
213
|
+
end
|
214
|
+
|
215
|
+
# Outputs non-array value in the form of hash
|
216
|
+
# For object, use to_hash. Otherwise, just return the value
|
217
|
+
# @param [Object] value Any valid value
|
218
|
+
# @return [Hash] Returns the value in the form of hash
|
219
|
+
def _to_hash(value)
|
220
|
+
if value.is_a?(Array)
|
221
|
+
value.compact.map { |v| _to_hash(v) }
|
222
|
+
elsif value.is_a?(Hash)
|
223
|
+
{}.tap do |hash|
|
224
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
225
|
+
end
|
226
|
+
elsif value.respond_to? :to_hash
|
227
|
+
value.to_hash
|
228
|
+
else
|
229
|
+
value
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
require 'time'
|
12
|
+
|
13
|
+
module SnapTrade
|
14
|
+
class MlegPriceEffectStrict
|
15
|
+
CREDIT = "CREDIT".freeze
|
16
|
+
DEBIT = "DEBIT".freeze
|
17
|
+
EVEN = "EVEN".freeze
|
18
|
+
|
19
|
+
def self.all_vars
|
20
|
+
@all_vars ||= [CREDIT, DEBIT, EVEN].freeze
|
21
|
+
end
|
22
|
+
|
23
|
+
# Builds the enum from string
|
24
|
+
# @param [String] The enum value in the form of the string
|
25
|
+
# @return [String] The enum value
|
26
|
+
def self.build_from_hash(value)
|
27
|
+
new.build_from_hash(value)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Builds the enum from string
|
31
|
+
# @param [String] The enum value in the form of the string
|
32
|
+
# @return [String] The enum value
|
33
|
+
def build_from_hash(value)
|
34
|
+
return value if MlegPriceEffectStrict.all_vars.include?(value)
|
35
|
+
raise "Invalid ENUM value #{value} for class #MlegPriceEffectStrict"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -48,6 +48,7 @@ require 'snaptrade/models/brokerage_authorization_refresh_confirmation'
|
|
48
48
|
require 'snaptrade/models/brokerage_authorization_type_read_only'
|
49
49
|
require 'snaptrade/models/brokerage_authorization_type_read_only_brokerage'
|
50
50
|
require 'snaptrade/models/brokerage_type'
|
51
|
+
require 'snaptrade/models/cancel_order_response'
|
51
52
|
require 'snaptrade/models/child_brokerage_order_ids'
|
52
53
|
require 'snaptrade/models/connection_portal_version'
|
53
54
|
require 'snaptrade/models/connection_type'
|
@@ -79,6 +80,7 @@ require 'snaptrade/models/mleg_instrument_type'
|
|
79
80
|
require 'snaptrade/models/mleg_leg'
|
80
81
|
require 'snaptrade/models/mleg_order_response'
|
81
82
|
require 'snaptrade/models/mleg_order_type_strict'
|
83
|
+
require 'snaptrade/models/mleg_price_effect_strict'
|
82
84
|
require 'snaptrade/models/mleg_trade_form'
|
83
85
|
require 'snaptrade/models/mleg_trading_instrument'
|
84
86
|
require 'snaptrade/models/model400_failed_request_response'
|
@@ -28,14 +28,14 @@ describe 'TradingApi' do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# unit tests for cancel_order
|
31
|
-
# Cancel
|
31
|
+
# Cancel order
|
32
32
|
# Cancels an order in the specified account.
|
33
33
|
# @param user_id
|
34
34
|
# @param user_secret
|
35
35
|
# @param account_id
|
36
|
-
# @param
|
36
|
+
# @param trading_cancel_user_account_order_request
|
37
37
|
# @param [Hash] opts the optional parameters
|
38
|
-
# @return [
|
38
|
+
# @return [CancelOrderResponse]
|
39
39
|
describe 'cancel_order test' do
|
40
40
|
it 'should work' do
|
41
41
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
@@ -0,0 +1,35 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'spec_helper'
|
11
|
+
require 'json'
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
# Unit tests for SnapTrade::CancelOrderResponse
|
15
|
+
describe SnapTrade::CancelOrderResponse do
|
16
|
+
let(:instance) { SnapTrade::CancelOrderResponse.new }
|
17
|
+
|
18
|
+
describe 'test an instance of CancelOrderResponse' do
|
19
|
+
it 'should create an instance of CancelOrderResponse' do
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::CancelOrderResponse)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe 'test attribute "brokerage_order_id"' do
|
24
|
+
it 'should work' do
|
25
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test attribute "raw_response"' do
|
30
|
+
it 'should work' do
|
31
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'spec_helper'
|
11
|
+
require 'json'
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
# Unit tests for SnapTrade::MlegPriceEffectStrict
|
15
|
+
describe SnapTrade::MlegPriceEffectStrict do
|
16
|
+
let(:instance) { SnapTrade::MlegPriceEffectStrict.new }
|
17
|
+
|
18
|
+
describe 'test an instance of MlegPriceEffectStrict' do
|
19
|
+
it 'should create an instance of MlegPriceEffectStrict' do
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::MlegPriceEffectStrict)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snaptrade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.117
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-07-
|
11
|
+
date: 2025-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/snaptrade/models/brokerage_authorization_type_read_only.rb
|
128
128
|
- lib/snaptrade/models/brokerage_authorization_type_read_only_brokerage.rb
|
129
129
|
- lib/snaptrade/models/brokerage_type.rb
|
130
|
+
- lib/snaptrade/models/cancel_order_response.rb
|
130
131
|
- lib/snaptrade/models/child_brokerage_order_ids.rb
|
131
132
|
- lib/snaptrade/models/connection_portal_version.rb
|
132
133
|
- lib/snaptrade/models/connection_type.rb
|
@@ -158,6 +159,7 @@ files:
|
|
158
159
|
- lib/snaptrade/models/mleg_leg.rb
|
159
160
|
- lib/snaptrade/models/mleg_order_response.rb
|
160
161
|
- lib/snaptrade/models/mleg_order_type_strict.rb
|
162
|
+
- lib/snaptrade/models/mleg_price_effect_strict.rb
|
161
163
|
- lib/snaptrade/models/mleg_trade_form.rb
|
162
164
|
- lib/snaptrade/models/mleg_trading_instrument.rb
|
163
165
|
- lib/snaptrade/models/model400_failed_request_response.rb
|
@@ -287,6 +289,7 @@ files:
|
|
287
289
|
- spec/models/brokerage_authorization_type_read_only_spec.rb
|
288
290
|
- spec/models/brokerage_spec.rb
|
289
291
|
- spec/models/brokerage_type_spec.rb
|
292
|
+
- spec/models/cancel_order_response_spec.rb
|
290
293
|
- spec/models/child_brokerage_order_ids_spec.rb
|
291
294
|
- spec/models/connection_portal_version_spec.rb
|
292
295
|
- spec/models/connection_type_spec.rb
|
@@ -318,6 +321,7 @@ files:
|
|
318
321
|
- spec/models/mleg_leg_spec.rb
|
319
322
|
- spec/models/mleg_order_response_spec.rb
|
320
323
|
- spec/models/mleg_order_type_strict_spec.rb
|
324
|
+
- spec/models/mleg_price_effect_strict_spec.rb
|
321
325
|
- spec/models/mleg_trade_form_spec.rb
|
322
326
|
- spec/models/mleg_trading_instrument_spec.rb
|
323
327
|
- spec/models/model400_failed_request_response_spec.rb
|
@@ -447,6 +451,7 @@ test_files:
|
|
447
451
|
- spec/models/trading_search_cryptocurrency_pair_instruments200_response_spec.rb
|
448
452
|
- spec/models/account_order_record_quote_universal_symbol_spec.rb
|
449
453
|
- spec/models/session_event_spec.rb
|
454
|
+
- spec/models/cancel_order_response_spec.rb
|
450
455
|
- spec/models/manual_trade_impact_spec.rb
|
451
456
|
- spec/models/manual_trade_form_notional_value_spec.rb
|
452
457
|
- spec/models/symbol_query_spec.rb
|
@@ -516,6 +521,7 @@ test_files:
|
|
516
521
|
- spec/models/universal_activity_spec.rb
|
517
522
|
- spec/models/account_sync_status_spec.rb
|
518
523
|
- spec/models/mleg_trade_form_spec.rb
|
524
|
+
- spec/models/mleg_price_effect_strict_spec.rb
|
519
525
|
- spec/models/options_position_spec.rb
|
520
526
|
- spec/models/manual_trade_spec.rb
|
521
527
|
- spec/models/time_in_force_strict_spec.rb
|