snaptrade 2.0.3 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +27 -19
- data/README.md +2 -1
- data/docs/TradingApi.md +5 -0
- data/docs/ValidatedTradeBody.md +18 -0
- data/lib/snaptrade/api/trading_api.rb +20 -3
- data/lib/snaptrade/models/validated_trade_body.rb +220 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +1 -0
- data/spec/api/trading_api_spec.rb +1 -0
- data/spec/models/validated_trade_body_spec.rb +30 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba4c97143d9a30a5a3e879d49c4e5f4d74c5c99df7e0ae8c30253dc35ef7e470
|
4
|
+
data.tar.gz: aed56338d5c6e95d07c24028ddcc65ffe37ce3f6d1998c7b11b600eed6487f8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7174f4c1299e4388d4927725221014d866065b850ee68463df70b85ff89d2b083aa2f70e3537cafff574856958fc9b78a1ebae1931701b380c23a07275406a8
|
7
|
+
data.tar.gz: e12a6d85144b6392487076de00b1bbfbd3db0d55ec22973edcbed1694270725e211218719dab3a60bea7069d081aac1f246dfa5d56b33849f2395659b33c320b
|
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.4)
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
7
7
|
|
@@ -9,40 +9,47 @@ GEM
|
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
ast (2.4.2)
|
12
|
+
base64 (0.1.1)
|
12
13
|
byebug (11.1.3)
|
13
14
|
coderay (1.1.3)
|
14
15
|
debug (1.8.0)
|
15
16
|
irb (>= 1.5.0)
|
16
17
|
reline (>= 0.3.1)
|
17
18
|
diff-lcs (1.5.0)
|
18
|
-
faraday (2.
|
19
|
-
|
19
|
+
faraday (2.7.11)
|
20
|
+
base64
|
21
|
+
faraday-net_http (>= 2.0, < 3.1)
|
22
|
+
ruby2_keywords (>= 0.0.4)
|
20
23
|
faraday-multipart (1.0.4)
|
21
24
|
multipart-post (~> 2)
|
22
|
-
faraday-net_http (3.
|
23
|
-
net-http
|
25
|
+
faraday-net_http (3.0.2)
|
24
26
|
io-console (0.6.0)
|
25
|
-
irb (1.
|
26
|
-
|
27
|
+
irb (1.8.1)
|
28
|
+
rdoc
|
29
|
+
reline (>= 0.3.8)
|
27
30
|
method_source (1.0.0)
|
28
31
|
multipart-post (2.3.0)
|
29
|
-
net-http (0.4.1)
|
30
|
-
uri
|
31
32
|
parallel (1.23.0)
|
32
|
-
parser (3.2.2.
|
33
|
+
parser (3.2.2.3)
|
33
34
|
ast (~> 2.4.1)
|
35
|
+
racc
|
34
36
|
pry (0.14.2)
|
35
37
|
coderay (~> 1.1)
|
36
38
|
method_source (~> 1.0)
|
37
39
|
pry-byebug (3.10.1)
|
38
40
|
byebug (~> 11.0)
|
39
41
|
pry (>= 0.13, < 0.15)
|
42
|
+
psych (5.1.0)
|
43
|
+
stringio
|
44
|
+
racc (1.7.1)
|
40
45
|
rainbow (3.1.1)
|
41
46
|
rake (13.0.6)
|
42
|
-
|
43
|
-
|
47
|
+
rdoc (6.5.0)
|
48
|
+
psych (>= 4.0.0)
|
49
|
+
regexp_parser (2.8.1)
|
50
|
+
reline (0.3.8)
|
44
51
|
io-console (~> 0.5)
|
45
|
-
rexml (3.2.
|
52
|
+
rexml (3.2.6)
|
46
53
|
rspec (3.12.0)
|
47
54
|
rspec-core (~> 3.12.0)
|
48
55
|
rspec-expectations (~> 3.12.0)
|
@@ -52,10 +59,10 @@ GEM
|
|
52
59
|
rspec-expectations (3.12.3)
|
53
60
|
diff-lcs (>= 1.2.0, < 2.0)
|
54
61
|
rspec-support (~> 3.12.0)
|
55
|
-
rspec-mocks (3.12.
|
62
|
+
rspec-mocks (3.12.6)
|
56
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
57
64
|
rspec-support (~> 3.12.0)
|
58
|
-
rspec-support (3.12.
|
65
|
+
rspec-support (3.12.1)
|
59
66
|
rubocop (1.12.1)
|
60
67
|
parallel (~> 1.10)
|
61
68
|
parser (>= 3.0.0.0)
|
@@ -65,14 +72,15 @@ GEM
|
|
65
72
|
rubocop-ast (>= 1.2.0, < 2.0)
|
66
73
|
ruby-progressbar (~> 1.7)
|
67
74
|
unicode-display_width (>= 1.4.0, < 3.0)
|
68
|
-
rubocop-ast (1.
|
75
|
+
rubocop-ast (1.29.0)
|
69
76
|
parser (>= 3.2.1.0)
|
70
77
|
ruby-progressbar (1.13.0)
|
78
|
+
ruby2_keywords (0.0.5)
|
79
|
+
stringio (3.0.8)
|
71
80
|
unicode-display_width (2.4.2)
|
72
|
-
uri (0.13.0)
|
73
81
|
|
74
82
|
PLATFORMS
|
75
|
-
arm64-darwin-
|
83
|
+
arm64-darwin-22
|
76
84
|
|
77
85
|
DEPENDENCIES
|
78
86
|
debug (~> 1.8)
|
@@ -83,4 +91,4 @@ DEPENDENCIES
|
|
83
91
|
snaptrade!
|
84
92
|
|
85
93
|
BUNDLED WITH
|
86
|
-
2.
|
94
|
+
2.4.19
|
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', '~> 2.0.
|
12
|
+
gem 'snaptrade', '~> 2.0.5'
|
13
13
|
```
|
14
14
|
|
15
15
|
## Getting Started
|
@@ -220,4 +220,5 @@ Class | Method | HTTP request | Description
|
|
220
220
|
- [SnapTrade::UserErrorLog](docs/UserErrorLog.md)
|
221
221
|
- [SnapTrade::UserIDandSecret](docs/UserIDandSecret.md)
|
222
222
|
- [SnapTrade::UserSettings](docs/UserSettings.md)
|
223
|
+
- [SnapTrade::ValidatedTradeBody](docs/ValidatedTradeBody.md)
|
223
224
|
|
data/docs/TradingApi.md
CHANGED
@@ -434,6 +434,7 @@ SnapTrade.consumer_key = "YOUR_CONSUMER_KEY"
|
|
434
434
|
trade_id = "tradeId_example"
|
435
435
|
user_id = "John.doe@snaptrade.com"
|
436
436
|
user_secret = "USERSECRET123"
|
437
|
+
wait_to_confirm = True
|
437
438
|
|
438
439
|
begin
|
439
440
|
# Place order
|
@@ -441,6 +442,7 @@ begin
|
|
441
442
|
trade_id: trade_id,
|
442
443
|
user_id: user_id,
|
443
444
|
user_secret: user_secret,
|
445
|
+
wait_to_confirm: wait_to_confirm,
|
444
446
|
)
|
445
447
|
p result
|
446
448
|
rescue SnapTrade::ApiError => e
|
@@ -456,6 +458,7 @@ This returns an Array which contains the response data, status code and headers.
|
|
456
458
|
trade_id = "tradeId_example"
|
457
459
|
user_id = "John.doe@snaptrade.com"
|
458
460
|
user_secret = "USERSECRET123"
|
461
|
+
wait_to_confirm = True
|
459
462
|
|
460
463
|
begin
|
461
464
|
# Place order
|
@@ -463,6 +466,7 @@ begin
|
|
463
466
|
trade_id: trade_id,
|
464
467
|
user_id: user_id,
|
465
468
|
user_secret: user_secret,
|
469
|
+
wait_to_confirm: wait_to_confirm,
|
466
470
|
)
|
467
471
|
p status_code # => 2xx
|
468
472
|
p headers # => { ... }
|
@@ -479,6 +483,7 @@ end
|
|
479
483
|
| **trade_id** | **String** | The ID of trade object obtained from trade/impact endpoint | |
|
480
484
|
| **user_id** | **String** | | |
|
481
485
|
| **user_secret** | **String** | | |
|
486
|
+
| **validated_trade_body** | [**ValidatedTradeBody**](ValidatedTradeBody.md) | | [optional] |
|
482
487
|
|
483
488
|
### Return type
|
484
489
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# SnapTrade::ValidatedTradeBody
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **wait_to_confirm** | **Boolean** | Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status PENDING as we will not wait to check on the status before responding to the request | [optional] |
|
8
|
+
|
9
|
+
## Example
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'snaptrade'
|
13
|
+
|
14
|
+
instance = SnapTrade::ValidatedTradeBody.new(
|
15
|
+
wait_to_confirm: true
|
16
|
+
)
|
17
|
+
```
|
18
|
+
|
@@ -641,8 +641,13 @@ module SnapTrade
|
|
641
641
|
# @param trade_id [String] The ID of trade object obtained from trade/impact endpoint
|
642
642
|
# @param user_id [String]
|
643
643
|
# @param user_secret [String]
|
644
|
+
# @param wait_to_confirm [Boolean] Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status PENDING as we will not wait to check on the status before responding to the request
|
645
|
+
# @param body [ValidatedTradeBody]
|
644
646
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
645
|
-
def place_order(trade_id:, user_id:, user_secret:, extra: {})
|
647
|
+
def place_order(trade_id:, user_id:, user_secret:, wait_to_confirm: SENTINEL, extra: {})
|
648
|
+
_body = {}
|
649
|
+
_body[:wait_to_confirm] = wait_to_confirm if wait_to_confirm != SENTINEL
|
650
|
+
extra[:validated_trade_body] = _body if !_body.empty?
|
646
651
|
data, _status_code, _headers = place_order_with_http_info_impl(trade_id, user_id, user_secret, extra)
|
647
652
|
data
|
648
653
|
end
|
@@ -651,8 +656,13 @@ module SnapTrade
|
|
651
656
|
# @param trade_id [String] The ID of trade object obtained from trade/impact endpoint
|
652
657
|
# @param user_id [String]
|
653
658
|
# @param user_secret [String]
|
659
|
+
# @param wait_to_confirm [Boolean] Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status PENDING as we will not wait to check on the status before responding to the request
|
660
|
+
# @param body [ValidatedTradeBody]
|
654
661
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
655
|
-
def place_order_with_http_info(trade_id:, user_id:, user_secret:, extra: {})
|
662
|
+
def place_order_with_http_info(trade_id:, user_id:, user_secret:, wait_to_confirm: SENTINEL, extra: {})
|
663
|
+
_body = {}
|
664
|
+
_body[:wait_to_confirm] = wait_to_confirm if wait_to_confirm != SENTINEL
|
665
|
+
extra[:validated_trade_body] = _body if !_body.empty?
|
656
666
|
place_order_with_http_info_impl(trade_id, user_id, user_secret, extra)
|
657
667
|
end
|
658
668
|
|
@@ -661,6 +671,7 @@ module SnapTrade
|
|
661
671
|
# @param user_id [String]
|
662
672
|
# @param user_secret [String]
|
663
673
|
# @param [Hash] opts the optional parameters
|
674
|
+
# @option opts [ValidatedTradeBody] :validated_trade_body
|
664
675
|
# @return [AccountOrderRecord]
|
665
676
|
def place_order_impl(trade_id, user_id, user_secret, opts = {})
|
666
677
|
data, _status_code, _headers = place_order_with_http_info(trade_id, user_id, user_secret, opts)
|
@@ -672,6 +683,7 @@ module SnapTrade
|
|
672
683
|
# @param user_id [String]
|
673
684
|
# @param user_secret [String]
|
674
685
|
# @param [Hash] opts the optional parameters
|
686
|
+
# @option opts [ValidatedTradeBody] :validated_trade_body
|
675
687
|
# @return [Array<(AccountOrderRecord, Integer, Hash)>] AccountOrderRecord data, response status code and response headers
|
676
688
|
def place_order_with_http_info_impl(trade_id, user_id, user_secret, opts = {})
|
677
689
|
if @api_client.config.debugging
|
@@ -701,12 +713,17 @@ module SnapTrade
|
|
701
713
|
header_params = opts[:header_params] || {}
|
702
714
|
# HTTP header 'Accept' (if needed)
|
703
715
|
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
716
|
+
# HTTP header 'Content-Type'
|
717
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
718
|
+
if !content_type.nil?
|
719
|
+
header_params['Content-Type'] = content_type
|
720
|
+
end
|
704
721
|
|
705
722
|
# form parameters
|
706
723
|
form_params = opts[:form_params] || {}
|
707
724
|
|
708
725
|
# http body (model)
|
709
|
-
post_body = opts[:debug_body]
|
726
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'validated_trade_body'])
|
710
727
|
|
711
728
|
# return_type
|
712
729
|
return_type = opts[:debug_return_type] || 'AccountOrderRecord'
|
@@ -0,0 +1,220 @@
|
|
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
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'date'
|
12
|
+
require 'time'
|
13
|
+
|
14
|
+
module SnapTrade
|
15
|
+
# Validated Trade Form
|
16
|
+
class ValidatedTradeBody
|
17
|
+
# Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status PENDING as we will not wait to check on the status before responding to the request
|
18
|
+
attr_accessor :wait_to_confirm
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'wait_to_confirm' => :'wait_to_confirm'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.openapi_types
|
34
|
+
{
|
35
|
+
:'wait_to_confirm' => :'Boolean'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
:'wait_to_confirm'
|
43
|
+
])
|
44
|
+
end
|
45
|
+
|
46
|
+
# Initializes the object
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
def initialize(attributes = {})
|
49
|
+
if (!attributes.is_a?(Hash))
|
50
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::ValidatedTradeBody` initialize method"
|
51
|
+
end
|
52
|
+
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::ValidatedTradeBody`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
57
|
+
end
|
58
|
+
h[k.to_sym] = v
|
59
|
+
}
|
60
|
+
|
61
|
+
if attributes.key?(:'wait_to_confirm')
|
62
|
+
self.wait_to_confirm = attributes[:'wait_to_confirm']
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
67
|
+
# @return Array for valid properties with the reasons
|
68
|
+
def list_invalid_properties
|
69
|
+
invalid_properties = Array.new
|
70
|
+
invalid_properties
|
71
|
+
end
|
72
|
+
|
73
|
+
# Check to see if the all the properties in the model are valid
|
74
|
+
# @return true if the model is valid
|
75
|
+
def valid?
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Checks equality by comparing each attribute.
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def ==(o)
|
82
|
+
return true if self.equal?(o)
|
83
|
+
self.class == o.class &&
|
84
|
+
wait_to_confirm == o.wait_to_confirm
|
85
|
+
end
|
86
|
+
|
87
|
+
# @see the `==` method
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def eql?(o)
|
90
|
+
self == o
|
91
|
+
end
|
92
|
+
|
93
|
+
# Calculates hash code according to all attributes.
|
94
|
+
# @return [Integer] Hash code
|
95
|
+
def hash
|
96
|
+
[wait_to_confirm].hash
|
97
|
+
end
|
98
|
+
|
99
|
+
# Builds the object from hash
|
100
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
101
|
+
# @return [Object] Returns the model itself
|
102
|
+
def self.build_from_hash(attributes)
|
103
|
+
new.build_from_hash(attributes)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Builds the object from hash
|
107
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
108
|
+
# @return [Object] Returns the model itself
|
109
|
+
def build_from_hash(attributes)
|
110
|
+
return nil unless attributes.is_a?(Hash)
|
111
|
+
attributes = attributes.transform_keys(&:to_sym)
|
112
|
+
self.class.openapi_types.each_pair do |key, type|
|
113
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
114
|
+
self.send("#{key}=", nil)
|
115
|
+
elsif type =~ /\AArray<(.*)>/i
|
116
|
+
# check to ensure the input is an array given that the attribute
|
117
|
+
# is documented as an array but the input is not
|
118
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
119
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
120
|
+
end
|
121
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
122
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
self
|
127
|
+
end
|
128
|
+
|
129
|
+
# Deserializes the data based on type
|
130
|
+
# @param string type Data type
|
131
|
+
# @param string value Value to be deserialized
|
132
|
+
# @return [Object] Deserialized data
|
133
|
+
def _deserialize(type, value)
|
134
|
+
case type.to_sym
|
135
|
+
when :Time
|
136
|
+
Time.parse(value)
|
137
|
+
when :Date
|
138
|
+
Date.parse(value)
|
139
|
+
when :String
|
140
|
+
value.to_s
|
141
|
+
when :Integer
|
142
|
+
value.to_i
|
143
|
+
when :Float
|
144
|
+
value.to_f
|
145
|
+
when :Boolean
|
146
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
147
|
+
true
|
148
|
+
else
|
149
|
+
false
|
150
|
+
end
|
151
|
+
when :Object
|
152
|
+
# generic object (usually a Hash), return directly
|
153
|
+
value
|
154
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
155
|
+
inner_type = Regexp.last_match[:inner_type]
|
156
|
+
value.map { |v| _deserialize(inner_type, v) }
|
157
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
158
|
+
k_type = Regexp.last_match[:k_type]
|
159
|
+
v_type = Regexp.last_match[:v_type]
|
160
|
+
{}.tap do |hash|
|
161
|
+
value.each do |k, v|
|
162
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
else # model
|
166
|
+
# models (e.g. Pet) or oneOf
|
167
|
+
klass = SnapTrade.const_get(type)
|
168
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# Returns the string representation of the object
|
173
|
+
# @return [String] String presentation of the object
|
174
|
+
def to_s
|
175
|
+
to_hash.to_s
|
176
|
+
end
|
177
|
+
|
178
|
+
# to_body is an alias to to_hash (backward compatibility)
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_body
|
181
|
+
to_hash
|
182
|
+
end
|
183
|
+
|
184
|
+
# Returns the object in the form of hash
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_hash
|
187
|
+
hash = {}
|
188
|
+
self.class.attribute_map.each_pair do |attr, param|
|
189
|
+
value = self.send(attr)
|
190
|
+
if value.nil?
|
191
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
192
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
193
|
+
end
|
194
|
+
|
195
|
+
hash[param] = _to_hash(value)
|
196
|
+
end
|
197
|
+
hash
|
198
|
+
end
|
199
|
+
|
200
|
+
# Outputs non-array value in the form of hash
|
201
|
+
# For object, use to_hash. Otherwise, just return the value
|
202
|
+
# @param [Object] value Any valid value
|
203
|
+
# @return [Hash] Returns the value in the form of hash
|
204
|
+
def _to_hash(value)
|
205
|
+
if value.is_a?(Array)
|
206
|
+
value.compact.map { |v| _to_hash(v) }
|
207
|
+
elsif value.is_a?(Hash)
|
208
|
+
{}.tap do |hash|
|
209
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
210
|
+
end
|
211
|
+
elsif value.respond_to? :to_hash
|
212
|
+
value.to_hash
|
213
|
+
else
|
214
|
+
value
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -146,6 +146,7 @@ require 'snaptrade/models/universal_symbol'
|
|
146
146
|
require 'snaptrade/models/user_error_log'
|
147
147
|
require 'snaptrade/models/user_i_dand_secret'
|
148
148
|
require 'snaptrade/models/user_settings'
|
149
|
+
require 'snaptrade/models/validated_trade_body'
|
149
150
|
|
150
151
|
# APIs
|
151
152
|
require 'snaptrade/api/account_information_api'
|
@@ -102,6 +102,7 @@ describe 'TradingApi' do
|
|
102
102
|
# @param user_id
|
103
103
|
# @param user_secret
|
104
104
|
# @param [Hash] opts the optional parameters
|
105
|
+
# @option opts [ValidatedTradeBody] :validated_trade_body
|
105
106
|
# @return [AccountOrderRecord]
|
106
107
|
describe 'place_order test' do
|
107
108
|
it 'should work' do
|
@@ -0,0 +1,30 @@
|
|
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
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'spec_helper'
|
12
|
+
require 'json'
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
# Unit tests for SnapTrade::ValidatedTradeBody
|
16
|
+
describe SnapTrade::ValidatedTradeBody do
|
17
|
+
let(:instance) { SnapTrade::ValidatedTradeBody.new }
|
18
|
+
|
19
|
+
describe 'test an instance of ValidatedTradeBody' do
|
20
|
+
it 'should create an instance of ValidatedTradeBody' do
|
21
|
+
expect(instance).to be_instance_of(SnapTrade::ValidatedTradeBody)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
describe 'test attribute "wait_to_confirm"' do
|
25
|
+
it 'should work' do
|
26
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -219,6 +219,7 @@ files:
|
|
219
219
|
- docs/UserErrorLog.md
|
220
220
|
- docs/UserIDandSecret.md
|
221
221
|
- docs/UserSettings.md
|
222
|
+
- docs/ValidatedTradeBody.md
|
222
223
|
- header.png
|
223
224
|
- lib/snaptrade.rb
|
224
225
|
- lib/snaptrade/api/account_information_api.rb
|
@@ -363,6 +364,7 @@ files:
|
|
363
364
|
- lib/snaptrade/models/user_error_log.rb
|
364
365
|
- lib/snaptrade/models/user_i_dand_secret.rb
|
365
366
|
- lib/snaptrade/models/user_settings.rb
|
367
|
+
- lib/snaptrade/models/validated_trade_body.rb
|
366
368
|
- lib/snaptrade/version.rb
|
367
369
|
- snaptrade.gemspec
|
368
370
|
- spec/api/account_information_api_spec.rb
|
@@ -506,6 +508,7 @@ files:
|
|
506
508
|
- spec/models/user_error_log_spec.rb
|
507
509
|
- spec/models/user_i_dand_secret_spec.rb
|
508
510
|
- spec/models/user_settings_spec.rb
|
511
|
+
- spec/models/validated_trade_body_spec.rb
|
509
512
|
- spec/spec_helper.rb
|
510
513
|
homepage: https://snaptrade.com/
|
511
514
|
licenses:
|
@@ -528,7 +531,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
528
531
|
- !ruby/object:Gem::Version
|
529
532
|
version: '0'
|
530
533
|
requirements: []
|
531
|
-
rubygems_version: 3.
|
534
|
+
rubygems_version: 3.4.10
|
532
535
|
signing_key:
|
533
536
|
specification_version: 4
|
534
537
|
summary: SnapTrade Ruby Gem
|
@@ -572,6 +575,7 @@ test_files:
|
|
572
575
|
- spec/models/account_balance_total_spec.rb
|
573
576
|
- spec/models/strategy_order_place_spec.rb
|
574
577
|
- spec/models/model_asset_class_target_spec.rb
|
578
|
+
- spec/models/validated_trade_body_spec.rb
|
575
579
|
- spec/models/option_strategy_spec.rb
|
576
580
|
- spec/models/strategy_quotes_spec.rb
|
577
581
|
- spec/models/model_asset_class_details_spec.rb
|