snaptrade 2.0.53 → 2.0.54
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +40 -2
- data/lib/snaptrade/api/account_information_api.rb +109 -0
- data/lib/snaptrade/models/recent_orders_response.rb +220 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +1 -0
- data/spec/api/account_information_api_spec.rb +14 -0
- data/spec/models/recent_orders_response_spec.rb +29 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca862e7f31774878b25a1794d30404db042f086f861a8150d8f1f3c9d160055f
|
4
|
+
data.tar.gz: 2c0e33da24270de6c632975021f4d3c004f0f52db694978bbf887ec5768f66ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31098c4ead975e948dc46890f0a4602bc0bfa5a9ec42f0ff3dfa4cde73d8d9a08ac19897eca32eb3c1e898e64d8c59dade073d476bab61c27e04f00c8988214b
|
7
|
+
data.tar.gz: f432ae2bb182c1331d2e0ed36e4105050a3294e0d43f69b6f91e6f3bd34cc6f8c3c62857f449b5680bbbe0dc7931103a8bffaa7d19bd10e0313aecdae2edb99f
|
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.54)
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
7
7
|
|
@@ -42,7 +42,7 @@ GEM
|
|
42
42
|
rainbow (3.1.1)
|
43
43
|
rake (13.0.6)
|
44
44
|
regexp_parser (2.9.2)
|
45
|
-
reline (0.5.
|
45
|
+
reline (0.5.11)
|
46
46
|
io-console (~> 0.5)
|
47
47
|
rexml (3.3.9)
|
48
48
|
rspec (3.13.0)
|
@@ -67,7 +67,7 @@ GEM
|
|
67
67
|
rubocop-ast (>= 1.2.0, < 2.0)
|
68
68
|
ruby-progressbar (~> 1.7)
|
69
69
|
unicode-display_width (>= 1.4.0, < 3.0)
|
70
|
-
rubocop-ast (1.
|
70
|
+
rubocop-ast (1.36.1)
|
71
71
|
parser (>= 3.3.1.0)
|
72
72
|
ruby-progressbar (1.13.0)
|
73
73
|
ruby2_keywords (0.0.5)
|
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
|
-
[![npm](https://img.shields.io/badge/gem-v2.0.
|
9
|
+
[![npm](https://img.shields.io/badge/gem-v2.0.54-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.54)
|
10
10
|
[![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -24,6 +24,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
24
24
|
* [`snaptrade.account_information.get_user_account_details`](#snaptradeaccount_informationget_user_account_details)
|
25
25
|
* [`snaptrade.account_information.get_user_account_orders`](#snaptradeaccount_informationget_user_account_orders)
|
26
26
|
* [`snaptrade.account_information.get_user_account_positions`](#snaptradeaccount_informationget_user_account_positions)
|
27
|
+
* [`snaptrade.account_information.get_user_account_recent_orders`](#snaptradeaccount_informationget_user_account_recent_orders)
|
27
28
|
* [`snaptrade.account_information.get_user_holdings`](#snaptradeaccount_informationget_user_holdings)
|
28
29
|
* [`snaptrade.account_information.list_user_accounts`](#snaptradeaccount_informationlist_user_accounts)
|
29
30
|
* [`snaptrade.account_information.update_user_account`](#snaptradeaccount_informationupdate_user_account)
|
@@ -70,7 +71,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
70
71
|
Add to Gemfile:
|
71
72
|
|
72
73
|
```ruby
|
73
|
-
gem 'snaptrade', '~> 2.0.
|
74
|
+
gem 'snaptrade', '~> 2.0.54'
|
74
75
|
```
|
75
76
|
|
76
77
|
## Getting Started<a id="getting-started"></a>
|
@@ -303,6 +304,43 @@ p result
|
|
303
304
|
---
|
304
305
|
|
305
306
|
|
307
|
+
### `snaptrade.account_information.get_user_account_recent_orders`<a id="snaptradeaccount_informationget_user_account_recent_orders"></a>
|
308
|
+
|
309
|
+
Returns a list of orders executed in the last 24 hours in the specified account.
|
310
|
+
This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution
|
311
|
+
Differs from /orders in that it only returns orders that have been *executed* in the last 24 hours as opposed to pending or cancelled orders up to 30 days old
|
312
|
+
*Please contact support for access as this endpoint is not enabled by default.*
|
313
|
+
|
314
|
+
|
315
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
316
|
+
|
317
|
+
```ruby
|
318
|
+
result = snaptrade.account_information.get_user_account_recent_orders(
|
319
|
+
user_id: "snaptrade-user-123",
|
320
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
321
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
322
|
+
)
|
323
|
+
p result
|
324
|
+
```
|
325
|
+
|
326
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
327
|
+
|
328
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
329
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
330
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
331
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
332
|
+
|
333
|
+
[RecentOrdersResponse](./lib/snaptrade/models/recent_orders_response.rb)
|
334
|
+
|
335
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
336
|
+
|
337
|
+
`/accounts/{accountId}/recentOrders` `GET`
|
338
|
+
|
339
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
340
|
+
|
341
|
+
---
|
342
|
+
|
343
|
+
|
306
344
|
### `snaptrade.account_information.get_user_holdings`<a id="snaptradeaccount_informationget_user_holdings"></a>
|
307
345
|
|
308
346
|
Returns a list of balances, positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__
|
@@ -575,6 +575,115 @@ module SnapTrade
|
|
575
575
|
end
|
576
576
|
|
577
577
|
|
578
|
+
# List account recent executed orders
|
579
|
+
#
|
580
|
+
# Returns a list of orders executed in the last 24 hours in the specified account.
|
581
|
+
# This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution
|
582
|
+
# Differs from /orders in that it only returns orders that have been *executed* in the last 24 hours as opposed to pending or cancelled orders up to 30 days old
|
583
|
+
# *Please contact support for access as this endpoint is not enabled by default.*
|
584
|
+
#
|
585
|
+
# @param user_id [String]
|
586
|
+
# @param user_secret [String]
|
587
|
+
# @param account_id [String]
|
588
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
589
|
+
def get_user_account_recent_orders(user_id:, user_secret:, account_id:, extra: {})
|
590
|
+
data, _status_code, _headers = get_user_account_recent_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
|
591
|
+
data
|
592
|
+
end
|
593
|
+
|
594
|
+
# List account recent executed orders
|
595
|
+
#
|
596
|
+
# Returns a list of orders executed in the last 24 hours in the specified account.
|
597
|
+
# This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution
|
598
|
+
# Differs from /orders in that it only returns orders that have been *executed* in the last 24 hours as opposed to pending or cancelled orders up to 30 days old
|
599
|
+
# *Please contact support for access as this endpoint is not enabled by default.*
|
600
|
+
#
|
601
|
+
# @param user_id [String]
|
602
|
+
# @param user_secret [String]
|
603
|
+
# @param account_id [String]
|
604
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
605
|
+
def get_user_account_recent_orders_with_http_info(user_id:, user_secret:, account_id:, extra: {})
|
606
|
+
get_user_account_recent_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
|
607
|
+
end
|
608
|
+
|
609
|
+
# List account recent executed orders
|
610
|
+
# Returns a list of orders executed in the last 24 hours in the specified account. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution Differs from /orders in that it only returns orders that have been *executed* in the last 24 hours as opposed to pending or cancelled orders up to 30 days old *Please contact support for access as this endpoint is not enabled by default.*
|
611
|
+
# @param user_id [String]
|
612
|
+
# @param user_secret [String]
|
613
|
+
# @param account_id [String]
|
614
|
+
# @param [Hash] opts the optional parameters
|
615
|
+
# @return [RecentOrdersResponse]
|
616
|
+
private def get_user_account_recent_orders_impl(user_id, user_secret, account_id, opts = {})
|
617
|
+
data, _status_code, _headers = get_user_account_recent_orders_with_http_info(user_id, user_secret, account_id, opts)
|
618
|
+
data
|
619
|
+
end
|
620
|
+
|
621
|
+
# List account recent executed orders
|
622
|
+
# Returns a list of orders executed in the last 24 hours in the specified account. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution Differs from /orders in that it only returns orders that have been *executed* in the last 24 hours as opposed to pending or cancelled orders up to 30 days old *Please contact support for access as this endpoint is not enabled by default.*
|
623
|
+
# @param user_id [String]
|
624
|
+
# @param user_secret [String]
|
625
|
+
# @param account_id [String]
|
626
|
+
# @param [Hash] opts the optional parameters
|
627
|
+
# @return [Array<(RecentOrdersResponse, Integer, Hash)>] RecentOrdersResponse data, response status code and response headers
|
628
|
+
private def get_user_account_recent_orders_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
629
|
+
if @api_client.config.debugging
|
630
|
+
@api_client.config.logger.debug 'Calling API: AccountInformationApi.get_user_account_recent_orders ...'
|
631
|
+
end
|
632
|
+
# verify the required parameter 'user_id' is set
|
633
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
634
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling AccountInformationApi.get_user_account_recent_orders"
|
635
|
+
end
|
636
|
+
# verify the required parameter 'user_secret' is set
|
637
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
638
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling AccountInformationApi.get_user_account_recent_orders"
|
639
|
+
end
|
640
|
+
# verify the required parameter 'account_id' is set
|
641
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
642
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountInformationApi.get_user_account_recent_orders"
|
643
|
+
end
|
644
|
+
# resource path
|
645
|
+
local_var_path = '/accounts/{accountId}/recentOrders'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
646
|
+
|
647
|
+
# query parameters
|
648
|
+
query_params = opts[:query_params] || {}
|
649
|
+
query_params[:'userId'] = user_id
|
650
|
+
query_params[:'userSecret'] = user_secret
|
651
|
+
|
652
|
+
# header parameters
|
653
|
+
header_params = opts[:header_params] || {}
|
654
|
+
# HTTP header 'Accept' (if needed)
|
655
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
656
|
+
|
657
|
+
# form parameters
|
658
|
+
form_params = opts[:form_params] || {}
|
659
|
+
|
660
|
+
# http body (model)
|
661
|
+
post_body = opts[:debug_body]
|
662
|
+
|
663
|
+
# return_type
|
664
|
+
return_type = opts[:debug_return_type] || 'RecentOrdersResponse'
|
665
|
+
|
666
|
+
# auth_names
|
667
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
668
|
+
|
669
|
+
new_options = opts.merge(
|
670
|
+
:operation => :"AccountInformationApi.get_user_account_recent_orders",
|
671
|
+
:header_params => header_params,
|
672
|
+
:query_params => query_params,
|
673
|
+
:form_params => form_params,
|
674
|
+
:body => post_body,
|
675
|
+
:auth_names => auth_names,
|
676
|
+
:return_type => return_type
|
677
|
+
)
|
678
|
+
|
679
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
680
|
+
if @api_client.config.debugging
|
681
|
+
@api_client.config.logger.debug "API called: AccountInformationApi#get_user_account_recent_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
682
|
+
end
|
683
|
+
return data, status_code, headers, response
|
684
|
+
end
|
685
|
+
|
686
|
+
|
578
687
|
# List account holdings
|
579
688
|
#
|
580
689
|
# Returns a list of balances, positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__
|
@@ -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
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
require 'time'
|
12
|
+
|
13
|
+
module SnapTrade
|
14
|
+
# List of orders executed within the last 24 hours
|
15
|
+
class RecentOrdersResponse
|
16
|
+
# List of orders executed in the last 24 hours
|
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<AccountOrderRecord>'
|
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::RecentOrdersResponse` 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::RecentOrdersResponse`. 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
|
+
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
|
+
orders == o.orders
|
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
|
+
[orders].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
@@ -94,6 +94,7 @@ require 'snaptrade/models/past_value'
|
|
94
94
|
require 'snaptrade/models/performance_custom'
|
95
95
|
require 'snaptrade/models/position'
|
96
96
|
require 'snaptrade/models/position_symbol'
|
97
|
+
require 'snaptrade/models/recent_orders_response'
|
97
98
|
require 'snaptrade/models/security_type'
|
98
99
|
require 'snaptrade/models/session_event'
|
99
100
|
require 'snaptrade/models/session_event_type'
|
@@ -99,6 +99,20 @@ describe 'AccountInformationApi' do
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
+
# unit tests for get_user_account_recent_orders
|
103
|
+
# List account recent executed orders
|
104
|
+
# Returns a list of orders executed in the last 24 hours in the specified account. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution Differs from /orders in that it only returns orders that have been *executed* in the last 24 hours as opposed to pending or cancelled orders up to 30 days old *Please contact support for access as this endpoint is not enabled by default.*
|
105
|
+
# @param user_id
|
106
|
+
# @param user_secret
|
107
|
+
# @param account_id
|
108
|
+
# @param [Hash] opts the optional parameters
|
109
|
+
# @return [RecentOrdersResponse]
|
110
|
+
describe 'get_user_account_recent_orders test' do
|
111
|
+
it 'should work' do
|
112
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
102
116
|
# unit tests for get_user_holdings
|
103
117
|
# List account holdings
|
104
118
|
# Returns a list of balances, positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__ The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**.
|
@@ -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::RecentOrdersResponse
|
15
|
+
describe SnapTrade::RecentOrdersResponse do
|
16
|
+
let(:instance) { SnapTrade::RecentOrdersResponse.new }
|
17
|
+
|
18
|
+
describe 'test an instance of RecentOrdersResponse' do
|
19
|
+
it 'should create an instance of RecentOrdersResponse' do
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::RecentOrdersResponse)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe 'test attribute "orders"' 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
|
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.54
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- lib/snaptrade/models/performance_custom.rb
|
174
174
|
- lib/snaptrade/models/position.rb
|
175
175
|
- lib/snaptrade/models/position_symbol.rb
|
176
|
+
- lib/snaptrade/models/recent_orders_response.rb
|
176
177
|
- lib/snaptrade/models/security_type.rb
|
177
178
|
- lib/snaptrade/models/session_event.rb
|
178
179
|
- lib/snaptrade/models/session_event_type.rb
|
@@ -299,6 +300,7 @@ files:
|
|
299
300
|
- spec/models/performance_custom_spec.rb
|
300
301
|
- spec/models/position_spec.rb
|
301
302
|
- spec/models/position_symbol_spec.rb
|
303
|
+
- spec/models/recent_orders_response_spec.rb
|
302
304
|
- spec/models/security_type_spec.rb
|
303
305
|
- spec/models/session_event_spec.rb
|
304
306
|
- spec/models/session_event_type_spec.rb
|
@@ -380,6 +382,7 @@ test_files:
|
|
380
382
|
- spec/models/option_leg_spec.rb
|
381
383
|
- spec/models/account_spec.rb
|
382
384
|
- spec/models/exchange_rate_pairs_spec.rb
|
385
|
+
- spec/models/recent_orders_response_spec.rb
|
383
386
|
- spec/models/model403_feature_not_enabled_response_spec.rb
|
384
387
|
- spec/models/time_in_force_strict_spec.rb
|
385
388
|
- spec/models/options_get_option_strategy_request_spec.rb
|