snaptrade 2.0.198 → 2.0.199
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 +241 -4
- data/lib/snaptrade/api/account_information_api.rb +4 -4
- data/lib/snaptrade/api/experimental_endpoints_api.rb +697 -0
- data/lib/snaptrade/api/options_api.rb +4 -4
- data/lib/snaptrade/models/trade_detection_add_subscription_request.rb +222 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +4 -0
- data/spec/api/account_information_api_spec.rb +1 -1
- data/spec/api/experimental_endpoints_api_spec.rb +113 -0
- data/spec/api/options_api_spec.rb +1 -1
- data/spec/models/trade_detection_add_subscription_request_spec.rb +29 -0
- metadata +194 -188
|
@@ -21,7 +21,7 @@ module SnapTrade
|
|
|
21
21
|
#
|
|
22
22
|
# Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions).
|
|
23
23
|
#
|
|
24
|
-
# Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures.
|
|
24
|
+
# This endpoint is deprecatd. Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures.
|
|
25
25
|
#
|
|
26
26
|
# Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access:
|
|
27
27
|
# - If you do, this endpoint returns real-time data.
|
|
@@ -40,7 +40,7 @@ module SnapTrade
|
|
|
40
40
|
#
|
|
41
41
|
# Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions).
|
|
42
42
|
#
|
|
43
|
-
# Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures.
|
|
43
|
+
# This endpoint is deprecatd. Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures.
|
|
44
44
|
#
|
|
45
45
|
# Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access:
|
|
46
46
|
# - If you do, this endpoint returns real-time data.
|
|
@@ -55,7 +55,7 @@ module SnapTrade
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
# List account option positions
|
|
58
|
-
# Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
58
|
+
# Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). This endpoint is deprecatd. Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
59
59
|
# @param user_id [String]
|
|
60
60
|
# @param user_secret [String]
|
|
61
61
|
# @param account_id [String]
|
|
@@ -67,7 +67,7 @@ module SnapTrade
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
# List account option positions
|
|
70
|
-
# Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
70
|
+
# Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). This endpoint is deprecatd. Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
71
71
|
# @param user_id [String]
|
|
72
72
|
# @param user_secret [String]
|
|
73
73
|
# @param account_id [String]
|
|
@@ -0,0 +1,222 @@
|
|
|
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 TradeDetectionAddSubscriptionRequest
|
|
15
|
+
# Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
|
16
|
+
attr_accessor :account_id
|
|
17
|
+
|
|
18
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
19
|
+
def self.attribute_map
|
|
20
|
+
{
|
|
21
|
+
:'account_id' => :'account_id'
|
|
22
|
+
}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Returns all the JSON keys this model knows about
|
|
26
|
+
def self.acceptable_attributes
|
|
27
|
+
attribute_map.values
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Attribute type mapping.
|
|
31
|
+
def self.openapi_types
|
|
32
|
+
{
|
|
33
|
+
:'account_id' => :'String'
|
|
34
|
+
}
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# List of attributes with nullable: true
|
|
38
|
+
def self.openapi_nullable
|
|
39
|
+
Set.new([
|
|
40
|
+
])
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Initializes the object
|
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
45
|
+
def initialize(attributes = {})
|
|
46
|
+
if (!attributes.is_a?(Hash))
|
|
47
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::TradeDetectionAddSubscriptionRequest` initialize method"
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
51
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
52
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
53
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::TradeDetectionAddSubscriptionRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
54
|
+
end
|
|
55
|
+
h[k.to_sym] = v
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if attributes.key?(:'account_id')
|
|
59
|
+
self.account_id = attributes[:'account_id']
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
64
|
+
# @return Array for valid properties with the reasons
|
|
65
|
+
def list_invalid_properties
|
|
66
|
+
invalid_properties = Array.new
|
|
67
|
+
if @account_id.nil?
|
|
68
|
+
invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
invalid_properties
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Check to see if the all the properties in the model are valid
|
|
75
|
+
# @return true if the model is valid
|
|
76
|
+
def valid?
|
|
77
|
+
return false if @account_id.nil?
|
|
78
|
+
true
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Checks equality by comparing each attribute.
|
|
82
|
+
# @param [Object] Object to be compared
|
|
83
|
+
def ==(o)
|
|
84
|
+
return true if self.equal?(o)
|
|
85
|
+
self.class == o.class &&
|
|
86
|
+
account_id == o.account_id
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# @see the `==` method
|
|
90
|
+
# @param [Object] Object to be compared
|
|
91
|
+
def eql?(o)
|
|
92
|
+
self == o
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Calculates hash code according to all attributes.
|
|
96
|
+
# @return [Integer] Hash code
|
|
97
|
+
def hash
|
|
98
|
+
[account_id].hash
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Builds the object from hash
|
|
102
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
103
|
+
# @return [Object] Returns the model itself
|
|
104
|
+
def self.build_from_hash(attributes)
|
|
105
|
+
new.build_from_hash(attributes)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Builds the object from hash
|
|
109
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
110
|
+
# @return [Object] Returns the model itself
|
|
111
|
+
def build_from_hash(attributes)
|
|
112
|
+
return nil unless attributes.is_a?(Hash)
|
|
113
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
114
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
115
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
116
|
+
self.send("#{key}=", nil)
|
|
117
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
118
|
+
# check to ensure the input is an array given that the attribute
|
|
119
|
+
# is documented as an array but the input is not
|
|
120
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
121
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
122
|
+
end
|
|
123
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
124
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
self
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Deserializes the data based on type
|
|
132
|
+
# @param string type Data type
|
|
133
|
+
# @param string value Value to be deserialized
|
|
134
|
+
# @return [Object] Deserialized data
|
|
135
|
+
def _deserialize(type, value)
|
|
136
|
+
case type.to_sym
|
|
137
|
+
when :Time
|
|
138
|
+
Time.parse(value)
|
|
139
|
+
when :Date
|
|
140
|
+
Date.parse(value)
|
|
141
|
+
when :String
|
|
142
|
+
value.to_s
|
|
143
|
+
when :Integer
|
|
144
|
+
value.to_i
|
|
145
|
+
when :Float
|
|
146
|
+
value.to_f
|
|
147
|
+
when :Boolean
|
|
148
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
149
|
+
true
|
|
150
|
+
else
|
|
151
|
+
false
|
|
152
|
+
end
|
|
153
|
+
when :Object
|
|
154
|
+
# generic object (usually a Hash), return directly
|
|
155
|
+
value
|
|
156
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
157
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
158
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
159
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
160
|
+
k_type = Regexp.last_match[:k_type]
|
|
161
|
+
v_type = Regexp.last_match[:v_type]
|
|
162
|
+
{}.tap do |hash|
|
|
163
|
+
value.each do |k, v|
|
|
164
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
else # model
|
|
168
|
+
# models (e.g. Pet) or oneOf
|
|
169
|
+
klass = SnapTrade.const_get(type)
|
|
170
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Returns the string representation of the object
|
|
175
|
+
# @return [String] String presentation of the object
|
|
176
|
+
def to_s
|
|
177
|
+
to_hash.to_s
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
181
|
+
# @return [Hash] Returns the object in the form of hash
|
|
182
|
+
def to_body
|
|
183
|
+
to_hash
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# Returns the object in the form of hash
|
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
|
188
|
+
def to_hash
|
|
189
|
+
hash = {}
|
|
190
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
191
|
+
value = self.send(attr)
|
|
192
|
+
if value.nil?
|
|
193
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
194
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
hash[param] = _to_hash(value)
|
|
198
|
+
end
|
|
199
|
+
hash
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Outputs non-array value in the form of hash
|
|
203
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
204
|
+
# @param [Object] value Any valid value
|
|
205
|
+
# @return [Hash] Returns the value in the form of hash
|
|
206
|
+
def _to_hash(value)
|
|
207
|
+
if value.is_a?(Array)
|
|
208
|
+
value.compact.map { |v| _to_hash(v) }
|
|
209
|
+
elsif value.is_a?(Hash)
|
|
210
|
+
{}.tap do |hash|
|
|
211
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
212
|
+
end
|
|
213
|
+
elsif value.respond_to? :to_hash
|
|
214
|
+
value.to_hash
|
|
215
|
+
else
|
|
216
|
+
value
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
end
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
|
@@ -205,6 +205,7 @@ require 'snaptrade/models/take_profit'
|
|
|
205
205
|
require 'snaptrade/models/tax_lot'
|
|
206
206
|
require 'snaptrade/models/time_in_force_strict'
|
|
207
207
|
require 'snaptrade/models/timeframe'
|
|
208
|
+
require 'snaptrade/models/trade_detection_add_subscription_request'
|
|
208
209
|
require 'snaptrade/models/trade_detection_cancel_subscription_response'
|
|
209
210
|
require 'snaptrade/models/trade_detection_subscription'
|
|
210
211
|
require 'snaptrade/models/trading_instrument'
|
|
@@ -229,6 +230,7 @@ require 'snaptrade/api/account_information_api'
|
|
|
229
230
|
require 'snaptrade/api/api_status_api'
|
|
230
231
|
require 'snaptrade/api/authentication_api'
|
|
231
232
|
require 'snaptrade/api/connections_api'
|
|
233
|
+
require 'snaptrade/api/experimental_endpoints_api'
|
|
232
234
|
require 'snaptrade/api/options_api'
|
|
233
235
|
require 'snaptrade/api/reference_data_api'
|
|
234
236
|
require 'snaptrade/api/trading_api'
|
|
@@ -302,6 +304,7 @@ module SnapTrade
|
|
|
302
304
|
attr_reader :api_status
|
|
303
305
|
attr_reader :authentication
|
|
304
306
|
attr_reader :connections
|
|
307
|
+
attr_reader :experimental_endpoints
|
|
305
308
|
attr_reader :options
|
|
306
309
|
attr_reader :reference_data
|
|
307
310
|
attr_reader :trading
|
|
@@ -313,6 +316,7 @@ module SnapTrade
|
|
|
313
316
|
@api_status = SnapTrade::APIStatusApi.new(@api_client)
|
|
314
317
|
@authentication = SnapTrade::AuthenticationApi.new(@api_client)
|
|
315
318
|
@connections = SnapTrade::ConnectionsApi.new(@api_client)
|
|
319
|
+
@experimental_endpoints = SnapTrade::ExperimentalEndpointsApi.new(@api_client)
|
|
316
320
|
@options = SnapTrade::OptionsApi.new(@api_client)
|
|
317
321
|
@reference_data = SnapTrade::ReferenceDataApi.new(@api_client)
|
|
318
322
|
@trading = SnapTrade::TradingApi.new(@api_client)
|
|
@@ -149,7 +149,7 @@ describe 'AccountInformationApi' do
|
|
|
149
149
|
|
|
150
150
|
# unit tests for get_user_account_positions
|
|
151
151
|
# List account positions
|
|
152
|
-
# Returns a list of stock/ETF/crypto/mutual fund positions in the specified account. For option positions, please use the [options endpoint](/reference/Options/Options_listOptionHoldings). Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
152
|
+
# Returns a list of stock/ETF/crypto/mutual fund positions in the specified account. For option positions, please use the [options endpoint](/reference/Options/Options_listOptionHoldings). This endpoint is deprecated. Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
153
153
|
# @param user_id
|
|
154
154
|
# @param user_secret
|
|
155
155
|
# @param account_id
|
|
@@ -0,0 +1,113 @@
|
|
|
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
|
+
|
|
13
|
+
# Unit tests for SnapTrade::ExperimentalEndpointsApi
|
|
14
|
+
describe 'ExperimentalEndpointsApi' do
|
|
15
|
+
before do
|
|
16
|
+
# run before each test
|
|
17
|
+
@api_instance = SnapTrade::ExperimentalEndpointsApi.new
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
after do
|
|
21
|
+
# run after each test
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe 'test an instance of ExperimentalEndpointsApi' do
|
|
25
|
+
it 'should create an instance of ExperimentalEndpointsApi' do
|
|
26
|
+
expect(@api_instance).to be_instance_of(SnapTrade::ExperimentalEndpointsApi)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# unit tests for add_subscription
|
|
31
|
+
# Add a Trade Detection subscription
|
|
32
|
+
# Adds or restores a Trade Detection subscription for a connected brokerage account. This endpoint requires `userId` and `userSecret` in addition to the partner signature.
|
|
33
|
+
# @param user_id
|
|
34
|
+
# @param user_secret
|
|
35
|
+
# @param trade_detection_add_subscription_request
|
|
36
|
+
# @param [Hash] opts the optional parameters
|
|
37
|
+
# @return [TradeDetectionSubscription]
|
|
38
|
+
describe 'add_subscription test' do
|
|
39
|
+
it 'should work' do
|
|
40
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# unit tests for cancel_subscription
|
|
45
|
+
# Cancel a Trade Detection subscription
|
|
46
|
+
# Cancels a Trade Detection subscription for a connected brokerage account. This endpoint requires partner signature authentication only and does not require `userId` or `userSecret`.
|
|
47
|
+
# @param trade_detection_add_subscription_request
|
|
48
|
+
# @param [Hash] opts the optional parameters
|
|
49
|
+
# @return [TradeDetectionCancelSubscriptionResponse]
|
|
50
|
+
describe 'cancel_subscription test' do
|
|
51
|
+
it 'should work' do
|
|
52
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# unit tests for get_user_account_order_detail_v2
|
|
57
|
+
# Get account order detail (V2)
|
|
58
|
+
# Returns the detail of a single order using the brokerage order ID provided as a path parameter. The V2 order response format includes all legs of the order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
|
|
59
|
+
# @param account_id
|
|
60
|
+
# @param brokerage_order_id
|
|
61
|
+
# @param user_id
|
|
62
|
+
# @param user_secret
|
|
63
|
+
# @param [Hash] opts the optional parameters
|
|
64
|
+
# @return [AccountOrderRecordV2]
|
|
65
|
+
describe 'get_user_account_order_detail_v2 test' do
|
|
66
|
+
it 'should work' do
|
|
67
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# unit tests for get_user_account_orders_v2
|
|
72
|
+
# List account orders v2
|
|
73
|
+
# Returns a list of recent orders in the specified account. The V2 order response format will include all legs of each order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
|
|
74
|
+
# @param user_id
|
|
75
|
+
# @param user_secret
|
|
76
|
+
# @param account_id
|
|
77
|
+
# @param [Hash] opts the optional parameters
|
|
78
|
+
# @option opts [String] :state defaults to \"all\"
|
|
79
|
+
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. Values greater than 90 will be capped at 90.
|
|
80
|
+
# @return [AccountOrdersV2Response]
|
|
81
|
+
describe 'get_user_account_orders_v2 test' do
|
|
82
|
+
it 'should work' do
|
|
83
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# unit tests for get_user_account_recent_orders_v2
|
|
88
|
+
# List account recent orders (V2, last 24 hours only)
|
|
89
|
+
# A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
|
|
90
|
+
# @param user_id
|
|
91
|
+
# @param user_secret
|
|
92
|
+
# @param account_id
|
|
93
|
+
# @param [Hash] opts the optional parameters
|
|
94
|
+
# @option opts [Boolean] :only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
|
|
95
|
+
# @return [AccountOrdersV2Response]
|
|
96
|
+
describe 'get_user_account_recent_orders_v2 test' do
|
|
97
|
+
it 'should work' do
|
|
98
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# unit tests for list_subscriptions
|
|
103
|
+
# List active Trade Detection subscriptions
|
|
104
|
+
# Returns active Trade Detection subscriptions for your Client ID. Cancelled subscriptions are not returned.
|
|
105
|
+
# @param [Hash] opts the optional parameters
|
|
106
|
+
# @return [Array<TradeDetectionSubscription>]
|
|
107
|
+
describe 'list_subscriptions test' do
|
|
108
|
+
it 'should work' do
|
|
109
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
end
|
|
@@ -29,7 +29,7 @@ describe 'OptionsApi' do
|
|
|
29
29
|
|
|
30
30
|
# unit tests for list_option_holdings
|
|
31
31
|
# List account option positions
|
|
32
|
-
# Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
32
|
+
# Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). This endpoint is deprecatd. Consider using the newer [unified positions endpoint](/reference/Account%20Information/AccountInformation_getAllAccountPositions). This will allow you to get both equity and option positions in a single call, as well as additional asset classes such as futures. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, Daily data is cached and refreshed once a day. Exact refresh timing may vary by brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
|
|
33
33
|
# @param user_id
|
|
34
34
|
# @param user_secret
|
|
35
35
|
# @param account_id
|
|
@@ -0,0 +1,29 @@
|
|
|
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::TradeDetectionAddSubscriptionRequest
|
|
15
|
+
describe SnapTrade::TradeDetectionAddSubscriptionRequest do
|
|
16
|
+
let(:instance) { SnapTrade::TradeDetectionAddSubscriptionRequest.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of TradeDetectionAddSubscriptionRequest' do
|
|
19
|
+
it 'should create an instance of TradeDetectionAddSubscriptionRequest' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::TradeDetectionAddSubscriptionRequest)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
describe 'test attribute "account_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
|
+
end
|