snaptrade 2.0.143 → 2.0.145

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.
@@ -0,0 +1,325 @@
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
+ # Describes a single order in the standardized V2 format.
15
+ class AccountOrderRecordV2
16
+ # Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
17
+ attr_accessor :brokerage_order_id
18
+
19
+ # Indicates the status of an order. SnapTrade does a best effort to map brokerage statuses to statuses in this enum. Possible values include: - NONE - PENDING - ACCEPTED - FAILED - REJECTED - CANCELED - PARTIAL_CANCELED - CANCEL_PENDING - EXECUTED - PARTIAL - REPLACE_PENDING - REPLACED - EXPIRED - QUEUED - TRIGGERED - ACTIVATED
20
+ attr_accessor :status
21
+
22
+ # The type of order placed. - `MARKET` - `LIMIT` - `STOP` - `STOP_LIMIT`
23
+ attr_accessor :order_type
24
+
25
+ # The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. We try our best to map brokerage time in force values to the following. When mapping fails, we will return the brokerage's time in force value. - `DAY` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date. - `MOO` - Market On Open. The order is to be executed at the day's opening price. - `EHP` - Extended Hours P.M. The order is to be placed during extended hour trading, after markets close.
26
+ attr_accessor :time_in_force
27
+
28
+ # The time the order was placed. This is the time the order was submitted to the brokerage.
29
+ attr_accessor :time_placed
30
+
31
+ # The time the order was executed in the brokerage system. This value is not always available from the brokerage.
32
+ attr_accessor :time_executed
33
+
34
+ # Quote currency code for the order.
35
+ attr_accessor :quote_currency
36
+
37
+ # The price at which the order was executed.
38
+ attr_accessor :execution_price
39
+
40
+ # The limit price is maximum price one is willing to pay for a buy order or the minimum price one is willing to accept for a sell order. Should only apply to `Limit` and `StopLimit` orders.
41
+ attr_accessor :limit_price
42
+
43
+ # The stop price is the price at which a stop order is triggered. Should only apply to `Stop` and `StopLimit` orders.
44
+ attr_accessor :stop_price
45
+
46
+ # List of legs that make up the order.
47
+ attr_accessor :legs
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
50
+ def self.attribute_map
51
+ {
52
+ :'brokerage_order_id' => :'brokerage_order_id',
53
+ :'status' => :'status',
54
+ :'order_type' => :'order_type',
55
+ :'time_in_force' => :'time_in_force',
56
+ :'time_placed' => :'time_placed',
57
+ :'time_executed' => :'time_executed',
58
+ :'quote_currency' => :'quote_currency',
59
+ :'execution_price' => :'execution_price',
60
+ :'limit_price' => :'limit_price',
61
+ :'stop_price' => :'stop_price',
62
+ :'legs' => :'legs'
63
+ }
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'brokerage_order_id' => :'String',
75
+ :'status' => :'AccountOrderRecordStatus',
76
+ :'order_type' => :'String',
77
+ :'time_in_force' => :'String',
78
+ :'time_placed' => :'Time',
79
+ :'time_executed' => :'Time',
80
+ :'quote_currency' => :'String',
81
+ :'execution_price' => :'Float',
82
+ :'limit_price' => :'Float',
83
+ :'stop_price' => :'Float',
84
+ :'legs' => :'Array<AccountOrderRecordLeg>'
85
+ }
86
+ end
87
+
88
+ # List of attributes with nullable: true
89
+ def self.openapi_nullable
90
+ Set.new([
91
+ :'order_type',
92
+ :'time_executed',
93
+ :'execution_price',
94
+ :'limit_price',
95
+ :'stop_price',
96
+ ])
97
+ end
98
+
99
+ # Initializes the object
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ def initialize(attributes = {})
102
+ if (!attributes.is_a?(Hash))
103
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountOrderRecordV2` initialize method"
104
+ end
105
+
106
+ # check to see if the attribute exists and convert string to symbol for hash key
107
+ attributes = attributes.each_with_object({}) { |(k, v), h|
108
+ if (!self.class.attribute_map.key?(k.to_sym))
109
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountOrderRecordV2`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
110
+ end
111
+ h[k.to_sym] = v
112
+ }
113
+
114
+ if attributes.key?(:'brokerage_order_id')
115
+ self.brokerage_order_id = attributes[:'brokerage_order_id']
116
+ end
117
+
118
+ if attributes.key?(:'status')
119
+ self.status = attributes[:'status']
120
+ end
121
+
122
+ if attributes.key?(:'order_type')
123
+ self.order_type = attributes[:'order_type']
124
+ end
125
+
126
+ if attributes.key?(:'time_in_force')
127
+ self.time_in_force = attributes[:'time_in_force']
128
+ end
129
+
130
+ if attributes.key?(:'time_placed')
131
+ self.time_placed = attributes[:'time_placed']
132
+ end
133
+
134
+ if attributes.key?(:'time_executed')
135
+ self.time_executed = attributes[:'time_executed']
136
+ end
137
+
138
+ if attributes.key?(:'quote_currency')
139
+ self.quote_currency = attributes[:'quote_currency']
140
+ end
141
+
142
+ if attributes.key?(:'execution_price')
143
+ self.execution_price = attributes[:'execution_price']
144
+ end
145
+
146
+ if attributes.key?(:'limit_price')
147
+ self.limit_price = attributes[:'limit_price']
148
+ end
149
+
150
+ if attributes.key?(:'stop_price')
151
+ self.stop_price = attributes[:'stop_price']
152
+ end
153
+
154
+ if attributes.key?(:'legs')
155
+ if (value = attributes[:'legs']).is_a?(Array)
156
+ self.legs = value
157
+ end
158
+ end
159
+ end
160
+
161
+ # Show invalid properties with the reasons. Usually used together with valid?
162
+ # @return Array for valid properties with the reasons
163
+ def list_invalid_properties
164
+ invalid_properties = Array.new
165
+ invalid_properties
166
+ end
167
+
168
+ # Check to see if the all the properties in the model are valid
169
+ # @return true if the model is valid
170
+ def valid?
171
+ true
172
+ end
173
+
174
+ # Checks equality by comparing each attribute.
175
+ # @param [Object] Object to be compared
176
+ def ==(o)
177
+ return true if self.equal?(o)
178
+ self.class == o.class &&
179
+ brokerage_order_id == o.brokerage_order_id &&
180
+ status == o.status &&
181
+ order_type == o.order_type &&
182
+ time_in_force == o.time_in_force &&
183
+ time_placed == o.time_placed &&
184
+ time_executed == o.time_executed &&
185
+ quote_currency == o.quote_currency &&
186
+ execution_price == o.execution_price &&
187
+ limit_price == o.limit_price &&
188
+ stop_price == o.stop_price &&
189
+ legs == o.legs
190
+ end
191
+
192
+ # @see the `==` method
193
+ # @param [Object] Object to be compared
194
+ def eql?(o)
195
+ self == o
196
+ end
197
+
198
+ # Calculates hash code according to all attributes.
199
+ # @return [Integer] Hash code
200
+ def hash
201
+ [brokerage_order_id, status, order_type, time_in_force, time_placed, time_executed, quote_currency, execution_price, limit_price, stop_price, legs].hash
202
+ end
203
+
204
+ # Builds the object from hash
205
+ # @param [Hash] attributes Model attributes in the form of hash
206
+ # @return [Object] Returns the model itself
207
+ def self.build_from_hash(attributes)
208
+ new.build_from_hash(attributes)
209
+ end
210
+
211
+ # Builds the object from hash
212
+ # @param [Hash] attributes Model attributes in the form of hash
213
+ # @return [Object] Returns the model itself
214
+ def build_from_hash(attributes)
215
+ return nil unless attributes.is_a?(Hash)
216
+ attributes = attributes.transform_keys(&:to_sym)
217
+ self.class.openapi_types.each_pair do |key, type|
218
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
219
+ self.send("#{key}=", nil)
220
+ elsif type =~ /\AArray<(.*)>/i
221
+ # check to ensure the input is an array given that the attribute
222
+ # is documented as an array but the input is not
223
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
224
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
225
+ end
226
+ elsif !attributes[self.class.attribute_map[key]].nil?
227
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
228
+ end
229
+ end
230
+
231
+ self
232
+ end
233
+
234
+ # Deserializes the data based on type
235
+ # @param string type Data type
236
+ # @param string value Value to be deserialized
237
+ # @return [Object] Deserialized data
238
+ def _deserialize(type, value)
239
+ case type.to_sym
240
+ when :Time
241
+ Time.parse(value)
242
+ when :Date
243
+ Date.parse(value)
244
+ when :String
245
+ value.to_s
246
+ when :Integer
247
+ value.to_i
248
+ when :Float
249
+ value.to_f
250
+ when :Boolean
251
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
252
+ true
253
+ else
254
+ false
255
+ end
256
+ when :Object
257
+ # generic object (usually a Hash), return directly
258
+ value
259
+ when /\AArray<(?<inner_type>.+)>\z/
260
+ inner_type = Regexp.last_match[:inner_type]
261
+ value.map { |v| _deserialize(inner_type, v) }
262
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
263
+ k_type = Regexp.last_match[:k_type]
264
+ v_type = Regexp.last_match[:v_type]
265
+ {}.tap do |hash|
266
+ value.each do |k, v|
267
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
268
+ end
269
+ end
270
+ else # model
271
+ # models (e.g. Pet) or oneOf
272
+ klass = SnapTrade.const_get(type)
273
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
274
+ end
275
+ end
276
+
277
+ # Returns the string representation of the object
278
+ # @return [String] String presentation of the object
279
+ def to_s
280
+ to_hash.to_s
281
+ end
282
+
283
+ # to_body is an alias to to_hash (backward compatibility)
284
+ # @return [Hash] Returns the object in the form of hash
285
+ def to_body
286
+ to_hash
287
+ end
288
+
289
+ # Returns the object in the form of hash
290
+ # @return [Hash] Returns the object in the form of hash
291
+ def to_hash
292
+ hash = {}
293
+ self.class.attribute_map.each_pair do |attr, param|
294
+ value = self.send(attr)
295
+ if value.nil?
296
+ is_nullable = self.class.openapi_nullable.include?(attr)
297
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
298
+ end
299
+
300
+ hash[param] = _to_hash(value)
301
+ end
302
+ hash
303
+ end
304
+
305
+ # Outputs non-array value in the form of hash
306
+ # For object, use to_hash. Otherwise, just return the value
307
+ # @param [Object] value Any valid value
308
+ # @return [Hash] Returns the value in the form of hash
309
+ def _to_hash(value)
310
+ if value.is_a?(Array)
311
+ value.compact.map { |v| _to_hash(v) }
312
+ elsif value.is_a?(Hash)
313
+ {}.tap do |hash|
314
+ value.each { |k, v| hash[k] = _to_hash(v) }
315
+ end
316
+ elsif value.respond_to? :to_hash
317
+ value.to_hash
318
+ else
319
+ value
320
+ end
321
+ end
322
+
323
+ end
324
+
325
+ end
@@ -0,0 +1,225 @@
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
+ # Contains a standardized list of account orders in the V2 format.
15
+ class AccountOrdersV2Response
16
+ # List of orders returned by the endpoint.
17
+ attr_accessor :orders
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'orders' => :'orders'
23
+ }
24
+ end
25
+
26
+ # Returns all the JSON keys this model knows about
27
+ def self.acceptable_attributes
28
+ attribute_map.values
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'orders' => :'Array<AccountOrderRecordV2>'
35
+ }
36
+ end
37
+
38
+ # List of attributes with nullable: true
39
+ def self.openapi_nullable
40
+ Set.new([
41
+ ])
42
+ end
43
+
44
+ # Initializes the object
45
+ # @param [Hash] attributes Model attributes in the form of hash
46
+ def initialize(attributes = {})
47
+ if (!attributes.is_a?(Hash))
48
+ fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountOrdersV2Response` initialize method"
49
+ end
50
+
51
+ # check to see if the attribute exists and convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h|
53
+ if (!self.class.attribute_map.key?(k.to_sym))
54
+ fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountOrdersV2Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
55
+ end
56
+ h[k.to_sym] = v
57
+ }
58
+
59
+ if attributes.key?(:'orders')
60
+ if (value = attributes[:'orders']).is_a?(Array)
61
+ self.orders = value
62
+ end
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
+ if @orders.nil?
71
+ invalid_properties.push('invalid value for "orders", orders cannot be nil.')
72
+ end
73
+
74
+ invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ return false if @orders.nil?
81
+ true
82
+ end
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] Object to be compared
86
+ def ==(o)
87
+ return true if self.equal?(o)
88
+ self.class == o.class &&
89
+ orders == o.orders
90
+ end
91
+
92
+ # @see the `==` method
93
+ # @param [Object] Object to be compared
94
+ def eql?(o)
95
+ self == o
96
+ end
97
+
98
+ # Calculates hash code according to all attributes.
99
+ # @return [Integer] Hash code
100
+ def hash
101
+ [orders].hash
102
+ end
103
+
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def self.build_from_hash(attributes)
108
+ new.build_from_hash(attributes)
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def build_from_hash(attributes)
115
+ return nil unless attributes.is_a?(Hash)
116
+ attributes = attributes.transform_keys(&:to_sym)
117
+ self.class.openapi_types.each_pair do |key, type|
118
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
119
+ self.send("#{key}=", nil)
120
+ elsif type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ end
129
+ end
130
+
131
+ self
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :Time
141
+ Time.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :Boolean
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ # models (e.g. Pet) or oneOf
172
+ klass = SnapTrade.const_get(type)
173
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
174
+ end
175
+ end
176
+
177
+ # Returns the string representation of the object
178
+ # @return [String] String presentation of the object
179
+ def to_s
180
+ to_hash.to_s
181
+ end
182
+
183
+ # to_body is an alias to to_hash (backward compatibility)
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_body
186
+ to_hash
187
+ end
188
+
189
+ # Returns the object in the form of hash
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_hash
192
+ hash = {}
193
+ self.class.attribute_map.each_pair do |attr, param|
194
+ value = self.send(attr)
195
+ if value.nil?
196
+ is_nullable = self.class.openapi_nullable.include?(attr)
197
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
+ end
199
+
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ # Outputs non-array value in the form of hash
206
+ # For object, use to_hash. Otherwise, just return the value
207
+ # @param [Object] value Any valid value
208
+ # @return [Hash] Returns the value in the form of hash
209
+ def _to_hash(value)
210
+ if value.is_a?(Array)
211
+ value.compact.map { |v| _to_hash(v) }
212
+ elsif value.is_a?(Hash)
213
+ {}.tap do |hash|
214
+ value.each { |k, v| hash[k] = _to_hash(v) }
215
+ end
216
+ elsif value.respond_to? :to_hash
217
+ value.to_hash
218
+ else
219
+ value
220
+ end
221
+ end
222
+
223
+ end
224
+
225
+ end
@@ -31,7 +31,7 @@ module SnapTrade
31
31
 
32
32
  attr_accessor :currency
33
33
 
34
- # A string representing the type of transaction. SnapTrade does a best effort to categorize the brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. `option_symbol` contains the related option contract info. - `OPTIONASSIGNMENT` - Option assignment event. `option_symbol` contains the related option contract info. - `OPTIONEXERCISE` - Option exercise event. `option_symbol` contains the related option contract info.
34
+ # A string representing the type of transaction. SnapTrade does a best effort to categorize the brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX`` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split.
35
35
  attr_accessor :type
36
36
 
37
37
  # If an option `BUY` or `SELL` transaction, this further specifies the type of action. The possible values are: - BUY_TO_OPEN - BUY_TO_CLOSE - SELL_TO_OPEN - SELL_TO_CLOSE
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.143'
11
+ VERSION = '2.0.145'
12
12
  end
data/lib/snaptrade.rb CHANGED
@@ -24,11 +24,16 @@ require 'snaptrade/models/account_holdings_account'
24
24
  require 'snaptrade/models/account_information_get_user_account_order_detail_request'
25
25
  require 'snaptrade/models/account_order_record'
26
26
  require 'snaptrade/models/account_order_record_child_brokerage_order_ids'
27
+ require 'snaptrade/models/account_order_record_leg'
28
+ require 'snaptrade/models/account_order_record_leg_instrument'
27
29
  require 'snaptrade/models/account_order_record_option_symbol'
28
30
  require 'snaptrade/models/account_order_record_quote_currency'
29
31
  require 'snaptrade/models/account_order_record_quote_universal_symbol'
30
32
  require 'snaptrade/models/account_order_record_status'
33
+ require 'snaptrade/models/account_order_record_status_v2'
31
34
  require 'snaptrade/models/account_order_record_universal_symbol'
35
+ require 'snaptrade/models/account_order_record_v2'
36
+ require 'snaptrade/models/account_orders_v2_response'
32
37
  require 'snaptrade/models/account_simple'
33
38
  require 'snaptrade/models/account_status'
34
39
  require 'snaptrade/models/account_sync_status'
@@ -178,6 +183,7 @@ require 'snaptrade/api/account_information_api'
178
183
  require 'snaptrade/api/api_status_api'
179
184
  require 'snaptrade/api/authentication_api'
180
185
  require 'snaptrade/api/connections_api'
186
+ require 'snaptrade/api/experimental_endpoints_api'
181
187
  require 'snaptrade/api/options_api'
182
188
  require 'snaptrade/api/reference_data_api'
183
189
  require 'snaptrade/api/trading_api'
@@ -251,6 +257,7 @@ module SnapTrade
251
257
  attr_reader :api_status
252
258
  attr_reader :authentication
253
259
  attr_reader :connections
260
+ attr_reader :experimental_endpoints
254
261
  attr_reader :options
255
262
  attr_reader :reference_data
256
263
  attr_reader :trading
@@ -262,6 +269,7 @@ module SnapTrade
262
269
  @api_status = SnapTrade::APIStatusApi.new(@api_client)
263
270
  @authentication = SnapTrade::AuthenticationApi.new(@api_client)
264
271
  @connections = SnapTrade::ConnectionsApi.new(@api_client)
272
+ @experimental_endpoints = SnapTrade::ExperimentalEndpointsApi.new(@api_client)
265
273
  @options = SnapTrade::OptionsApi.new(@api_client)
266
274
  @reference_data = SnapTrade::ReferenceDataApi.new(@api_client)
267
275
  @trading = SnapTrade::TradingApi.new(@api_client)
@@ -38,7 +38,7 @@ describe 'AccountInformationApi' do
38
38
  # @option opts [Date] :end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on &#x60;trade_date&#x60;.
39
39
  # @option opts [Integer] :offset An integer that specifies the starting point of the paginated results. Default is 0.
40
40
  # @option opts [Integer] :limit An integer that specifies the maximum number of transactions to return. Default of 1000.
41
- # @option opts [String] :type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - &#x60;BUY&#x60; - Asset bought. - &#x60;SELL&#x60; - Asset sold. - &#x60;DIVIDEND&#x60; - Dividend payout. - &#x60;CONTRIBUTION&#x60; - Cash contribution. - &#x60;WITHDRAWAL&#x60; - Cash withdrawal. - &#x60;REI&#x60; - Dividend reinvestment. - &#x60;STOCK_DIVIDEND&#x60; - A type of dividend where a company distributes shares instead of cash - &#x60;INTEREST&#x60; - Interest deposited into the account. - &#x60;FEE&#x60; - Fee withdrawn from the account. - &#x60;OPTIONEXPIRATION&#x60; - Option expiration event. - &#x60;OPTIONASSIGNMENT&#x60; - Option assignment event. - &#x60;OPTIONEXERCISE&#x60; - Option exercise event. - &#x60;TRANSFER&#x60; - Transfer of assets from one account to another
41
+ # @option opts [String] :type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - &#x60;BUY&#x60; - Asset bought. - &#x60;SELL&#x60; - Asset sold. - &#x60;DIVIDEND&#x60; - Dividend payout. - &#x60;CONTRIBUTION&#x60; - Cash contribution. - &#x60;WITHDRAWAL&#x60; - Cash withdrawal. - &#x60;REI&#x60; - Dividend reinvestment. - &#x60;STOCK_DIVIDEND&#x60; - A type of dividend where a company distributes shares instead of cash - &#x60;INTEREST&#x60; - Interest deposited into the account. - &#x60;FEE&#x60; - Fee withdrawn from the account. - &#x60;TAX&#x60;&#x60; - A tax related fee. - &#x60;OPTIONEXPIRATION&#x60; - Option expiration event. - &#x60;OPTIONASSIGNMENT&#x60; - Option assignment event. - &#x60;OPTIONEXERCISE&#x60; - Option exercise event. - &#x60;TRANSFER&#x60; - Transfer of assets from one account to another. - &#x60;SPLIT&#x60; - A stock share split.
42
42
  # @return [PaginatedUniversalActivity]
43
43
  describe 'get_account_activities test' do
44
44
  it 'should work' do
@@ -0,0 +1,61 @@
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 get_user_account_orders_v2
31
+ # List account orders v2
32
+ # Returns a list of recent orders in the specified account. The V2 order response format will include all legs of each order in the &#x60;legs&#x60; list field. If the order is single legged, &#x60;legs&#x60; 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.
33
+ # @param user_id
34
+ # @param user_secret
35
+ # @param account_id
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [String] :state defaults value is set to \&quot;all\&quot;
38
+ # @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.
39
+ # @return [AccountOrdersV2Response]
40
+ describe 'get_user_account_orders_v2 test' do
41
+ it 'should work' do
42
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
43
+ end
44
+ end
45
+
46
+ # unit tests for get_user_account_recent_orders_v2
47
+ # List account recent orders (V2, last 24 hours only)
48
+ # 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)**
49
+ # @param user_id
50
+ # @param user_secret
51
+ # @param account_id
52
+ # @param [Hash] opts the optional parameters
53
+ # @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
54
+ # @return [AccountOrdersV2Response]
55
+ describe 'get_user_account_recent_orders_v2 test' do
56
+ it 'should work' do
57
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
58
+ end
59
+ end
60
+
61
+ end