snaptrade 2.0.165 → 2.0.167
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 +2 -2
- data/README.md +71 -2
- data/lib/snaptrade/api/connections_api.rb +103 -0
- data/lib/snaptrade/api/experimental_endpoints_api.rb +103 -0
- data/lib/snaptrade/models/account_value_history_item.rb +228 -0
- data/lib/snaptrade/models/account_value_history_response.rb +230 -0
- data/lib/snaptrade/models/brokerage.rb +11 -1
- data/lib/snaptrade/models/delete_connection_confirmation.rb +228 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +3 -0
- data/spec/api/connections_api_spec.rb +14 -0
- data/spec/api/experimental_endpoints_api_spec.rb +14 -0
- data/spec/models/account_value_history_item_spec.rb +35 -0
- data/spec/models/account_value_history_response_spec.rb +35 -0
- data/spec/models/brokerage_spec.rb +6 -0
- data/spec/models/delete_connection_confirmation_spec.rb +35 -0
- metadata +11 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2da974f02fc7d2c3c05f005d006a93a6477e129a7210fc1f623f6c7c90488a77
|
|
4
|
+
data.tar.gz: 4adc63029cfb498069b83681be15c996b2a208563e22381876f90f19d5abd58c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 38f6a7f22d174a851180750ebeb67642dd170bde081424e9da9c437f3b79fc501dae57776c54f0512a5c12fa252db2054c8dda5de3315566ec05d3b82b37edd0
|
|
7
|
+
data.tar.gz: 4f97b1691aebeb8a880219d0fe98920e49415480041d2639581546af5aafb77ac899ffd146d59ebceca3229bd88966b95e9a4a5a93b708030dc1a9a50fb350a8
|
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.167)
|
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
|
6
6
|
faraday-multipart (~> 1.0, >= 1.0.4)
|
|
7
7
|
|
|
@@ -55,7 +55,7 @@ GEM
|
|
|
55
55
|
rspec-expectations (3.13.5)
|
|
56
56
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
57
57
|
rspec-support (~> 3.13.0)
|
|
58
|
-
rspec-mocks (3.13.
|
|
58
|
+
rspec-mocks (3.13.8)
|
|
59
59
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
60
60
|
rspec-support (~> 3.13.0)
|
|
61
61
|
rspec-support (3.13.7)
|
data/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Connect brokerage accounts to your app for live positions and trading
|
|
8
8
|
|
|
9
|
-
[](https://rubygems.org/gems/snaptrade/versions/2.0.167)
|
|
10
10
|
[](https://snaptrade.com/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
@@ -37,6 +37,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
37
37
|
* [`snaptrade.authentication.login_snap_trade_user`](#snaptradeauthenticationlogin_snap_trade_user)
|
|
38
38
|
* [`snaptrade.authentication.register_snap_trade_user`](#snaptradeauthenticationregister_snap_trade_user)
|
|
39
39
|
* [`snaptrade.authentication.reset_snap_trade_user_secret`](#snaptradeauthenticationreset_snap_trade_user_secret)
|
|
40
|
+
* [`snaptrade.connections.delete_connection`](#snaptradeconnectionsdelete_connection)
|
|
40
41
|
* [`snaptrade.connections.detail_brokerage_authorization`](#snaptradeconnectionsdetail_brokerage_authorization)
|
|
41
42
|
* [`snaptrade.connections.disable_brokerage_authorization`](#snaptradeconnectionsdisable_brokerage_authorization)
|
|
42
43
|
* [`snaptrade.connections.list_brokerage_authorizations`](#snaptradeconnectionslist_brokerage_authorizations)
|
|
@@ -44,6 +45,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
44
45
|
* [`snaptrade.connections.remove_brokerage_authorization`](#snaptradeconnectionsremove_brokerage_authorization)
|
|
45
46
|
* [`snaptrade.connections.return_rates`](#snaptradeconnectionsreturn_rates)
|
|
46
47
|
* [`snaptrade.connections.session_events`](#snaptradeconnectionssession_events)
|
|
48
|
+
* [`snaptrade.experimental_endpoints.get_account_balance_history`](#snaptradeexperimental_endpointsget_account_balance_history)
|
|
47
49
|
* [`snaptrade.experimental_endpoints.get_user_account_order_detail_v2`](#snaptradeexperimental_endpointsget_user_account_order_detail_v2)
|
|
48
50
|
* [`snaptrade.experimental_endpoints.get_user_account_orders_v2`](#snaptradeexperimental_endpointsget_user_account_orders_v2)
|
|
49
51
|
* [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
|
|
@@ -86,7 +88,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
86
88
|
Add to Gemfile:
|
|
87
89
|
|
|
88
90
|
```ruby
|
|
89
|
-
gem 'snaptrade', '~> 2.0.
|
|
91
|
+
gem 'snaptrade', '~> 2.0.167'
|
|
90
92
|
```
|
|
91
93
|
|
|
92
94
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -889,6 +891,39 @@ endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
|
|
|
889
891
|
---
|
|
890
892
|
|
|
891
893
|
|
|
894
|
+
### `snaptrade.connections.delete_connection`<a id="snaptradeconnectionsdelete_connection"></a>
|
|
895
|
+
|
|
896
|
+
Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is asynchronous, a 200 response indicates that a task has been queued to delete the connection. Listen for the [`CONNECTION_DELETED` webhook](https://docs.snaptrade.com/docs/webhooks#webhooks-connection_deleted) webhook to know when the deletion has been completed and the data has been removed.
|
|
897
|
+
|
|
898
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
899
|
+
|
|
900
|
+
```ruby
|
|
901
|
+
result = snaptrade.connections.delete_connection(
|
|
902
|
+
connection_id: "87b24961-b51e-4db8-9226-f198f6518a89",
|
|
903
|
+
user_id: "snaptrade-user-123",
|
|
904
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
905
|
+
)
|
|
906
|
+
p result
|
|
907
|
+
```
|
|
908
|
+
|
|
909
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
910
|
+
|
|
911
|
+
##### connection_id: `String`<a id="connection_id-string"></a>
|
|
912
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
913
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
914
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
915
|
+
|
|
916
|
+
[DeleteConnectionConfirmation](./lib/snaptrade/models/delete_connection_confirmation.rb)
|
|
917
|
+
|
|
918
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
919
|
+
|
|
920
|
+
`/connection/{connectionId}` `DELETE`
|
|
921
|
+
|
|
922
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
923
|
+
|
|
924
|
+
---
|
|
925
|
+
|
|
926
|
+
|
|
892
927
|
### `snaptrade.connections.detail_brokerage_authorization`<a id="snaptradeconnectionsdetail_brokerage_authorization"></a>
|
|
893
928
|
|
|
894
929
|
Returns a single connection for the specified ID.
|
|
@@ -1133,6 +1168,40 @@ specific users
|
|
|
1133
1168
|
---
|
|
1134
1169
|
|
|
1135
1170
|
|
|
1171
|
+
### `snaptrade.experimental_endpoints.get_account_balance_history`<a id="snaptradeexperimental_endpointsget_account_balance_history"></a>
|
|
1172
|
+
|
|
1173
|
+
An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and only available for certain brokerages with a maximum lookback of 1 year.
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1177
|
+
|
|
1178
|
+
```ruby
|
|
1179
|
+
result = snaptrade.experimental_endpoints.get_account_balance_history(
|
|
1180
|
+
user_id: "snaptrade-user-123",
|
|
1181
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1182
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
|
1183
|
+
)
|
|
1184
|
+
p result
|
|
1185
|
+
```
|
|
1186
|
+
|
|
1187
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1188
|
+
|
|
1189
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
1190
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
1191
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
|
1192
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
1193
|
+
|
|
1194
|
+
[AccountValueHistoryResponse](./lib/snaptrade/models/account_value_history_response.rb)
|
|
1195
|
+
|
|
1196
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1197
|
+
|
|
1198
|
+
`/accounts/{accountId}/balanceHistory` `GET`
|
|
1199
|
+
|
|
1200
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1201
|
+
|
|
1202
|
+
---
|
|
1203
|
+
|
|
1204
|
+
|
|
1136
1205
|
### `snaptrade.experimental_endpoints.get_user_account_order_detail_v2`<a id="snaptradeexperimental_endpointsget_user_account_order_detail_v2"></a>
|
|
1137
1206
|
|
|
1138
1207
|
Returns the detail of a single order using the brokerage order ID provided as a path parameter.
|
|
@@ -17,6 +17,109 @@ module SnapTrade
|
|
|
17
17
|
@api_client = api_client
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
# Delete connection
|
|
21
|
+
#
|
|
22
|
+
# Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is asynchronous, a 200 response indicates that a task has been queued to delete the connection. Listen for the [`CONNECTION_DELETED` webhook](https://docs.snaptrade.com/docs/webhooks#webhooks-connection_deleted) webhook to know when the deletion has been completed and the data has been removed.
|
|
23
|
+
#
|
|
24
|
+
# @param connection_id [String]
|
|
25
|
+
# @param user_id [String]
|
|
26
|
+
# @param user_secret [String]
|
|
27
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
28
|
+
def delete_connection(connection_id:, user_id:, user_secret:, extra: {})
|
|
29
|
+
data, _status_code, _headers = delete_connection_with_http_info_impl(connection_id, user_id, user_secret, extra)
|
|
30
|
+
data
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Delete connection
|
|
34
|
+
#
|
|
35
|
+
# Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is asynchronous, a 200 response indicates that a task has been queued to delete the connection. Listen for the [`CONNECTION_DELETED` webhook](https://docs.snaptrade.com/docs/webhooks#webhooks-connection_deleted) webhook to know when the deletion has been completed and the data has been removed.
|
|
36
|
+
#
|
|
37
|
+
# @param connection_id [String]
|
|
38
|
+
# @param user_id [String]
|
|
39
|
+
# @param user_secret [String]
|
|
40
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
41
|
+
def delete_connection_with_http_info(connection_id:, user_id:, user_secret:, extra: {})
|
|
42
|
+
delete_connection_with_http_info_impl(connection_id, user_id, user_secret, extra)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Delete connection
|
|
46
|
+
# Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is asynchronous, a 200 response indicates that a task has been queued to delete the connection. Listen for the [`CONNECTION_DELETED` webhook](https://docs.snaptrade.com/docs/webhooks#webhooks-connection_deleted) webhook to know when the deletion has been completed and the data has been removed.
|
|
47
|
+
# @param connection_id [String]
|
|
48
|
+
# @param user_id [String]
|
|
49
|
+
# @param user_secret [String]
|
|
50
|
+
# @param [Hash] opts the optional parameters
|
|
51
|
+
# @return [DeleteConnectionConfirmation]
|
|
52
|
+
private def delete_connection_impl(connection_id, user_id, user_secret, opts = {})
|
|
53
|
+
data, _status_code, _headers = delete_connection_with_http_info(connection_id, user_id, user_secret, opts)
|
|
54
|
+
data
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Delete connection
|
|
58
|
+
# Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is asynchronous, a 200 response indicates that a task has been queued to delete the connection. Listen for the [`CONNECTION_DELETED` webhook](https://docs.snaptrade.com/docs/webhooks#webhooks-connection_deleted) webhook to know when the deletion has been completed and the data has been removed.
|
|
59
|
+
# @param connection_id [String]
|
|
60
|
+
# @param user_id [String]
|
|
61
|
+
# @param user_secret [String]
|
|
62
|
+
# @param [Hash] opts the optional parameters
|
|
63
|
+
# @return [Array<(DeleteConnectionConfirmation, Integer, Hash)>] DeleteConnectionConfirmation data, response status code and response headers
|
|
64
|
+
private def delete_connection_with_http_info_impl(connection_id, user_id, user_secret, opts = {})
|
|
65
|
+
if @api_client.config.debugging
|
|
66
|
+
@api_client.config.logger.debug 'Calling API: ConnectionsApi.delete_connection ...'
|
|
67
|
+
end
|
|
68
|
+
# verify the required parameter 'connection_id' is set
|
|
69
|
+
if @api_client.config.client_side_validation && connection_id.nil?
|
|
70
|
+
fail ArgumentError, "Missing the required parameter 'connection_id' when calling ConnectionsApi.delete_connection"
|
|
71
|
+
end
|
|
72
|
+
# verify the required parameter 'user_id' is set
|
|
73
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
|
74
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling ConnectionsApi.delete_connection"
|
|
75
|
+
end
|
|
76
|
+
# verify the required parameter 'user_secret' is set
|
|
77
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
|
78
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling ConnectionsApi.delete_connection"
|
|
79
|
+
end
|
|
80
|
+
# resource path
|
|
81
|
+
local_var_path = '/connection/{connectionId}'.sub('{' + 'connectionId' + '}', CGI.escape(connection_id.to_s))
|
|
82
|
+
|
|
83
|
+
# query parameters
|
|
84
|
+
query_params = opts[:query_params] || {}
|
|
85
|
+
query_params[:'userId'] = user_id
|
|
86
|
+
query_params[:'userSecret'] = user_secret
|
|
87
|
+
|
|
88
|
+
# header parameters
|
|
89
|
+
header_params = opts[:header_params] || {}
|
|
90
|
+
# HTTP header 'Accept' (if needed)
|
|
91
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
92
|
+
|
|
93
|
+
# form parameters
|
|
94
|
+
form_params = opts[:form_params] || {}
|
|
95
|
+
|
|
96
|
+
# http body (model)
|
|
97
|
+
post_body = opts[:debug_body]
|
|
98
|
+
|
|
99
|
+
# return_type
|
|
100
|
+
return_type = opts[:debug_return_type] || 'DeleteConnectionConfirmation'
|
|
101
|
+
|
|
102
|
+
# auth_names
|
|
103
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
104
|
+
|
|
105
|
+
new_options = opts.merge(
|
|
106
|
+
:operation => :"ConnectionsApi.delete_connection",
|
|
107
|
+
:header_params => header_params,
|
|
108
|
+
:query_params => query_params,
|
|
109
|
+
:form_params => form_params,
|
|
110
|
+
:body => post_body,
|
|
111
|
+
:auth_names => auth_names,
|
|
112
|
+
:return_type => return_type
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
data, status_code, headers, response = @api_client.call_api(:DELETE, local_var_path, new_options)
|
|
116
|
+
if @api_client.config.debugging
|
|
117
|
+
@api_client.config.logger.debug "API called: ConnectionsApi#delete_connection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
118
|
+
end
|
|
119
|
+
return data, status_code, headers, response
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
|
|
20
123
|
# Get connection detail
|
|
21
124
|
#
|
|
22
125
|
# Returns a single connection for the specified ID.
|
|
@@ -17,6 +17,109 @@ module SnapTrade
|
|
|
17
17
|
@api_client = api_client
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
+
# List historical account total value
|
|
21
|
+
#
|
|
22
|
+
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and only available for certain brokerages with a maximum lookback of 1 year.
|
|
23
|
+
#
|
|
24
|
+
# @param user_id [String]
|
|
25
|
+
# @param user_secret [String]
|
|
26
|
+
# @param account_id [String]
|
|
27
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
28
|
+
def get_account_balance_history(user_id:, user_secret:, account_id:, extra: {})
|
|
29
|
+
data, _status_code, _headers = get_account_balance_history_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
30
|
+
data
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# List historical account total value
|
|
34
|
+
#
|
|
35
|
+
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and only available for certain brokerages with a maximum lookback of 1 year.
|
|
36
|
+
#
|
|
37
|
+
# @param user_id [String]
|
|
38
|
+
# @param user_secret [String]
|
|
39
|
+
# @param account_id [String]
|
|
40
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
41
|
+
def get_account_balance_history_with_http_info(user_id:, user_secret:, account_id:, extra: {})
|
|
42
|
+
get_account_balance_history_with_http_info_impl(user_id, user_secret, account_id, extra)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# List historical account total value
|
|
46
|
+
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and only available for certain brokerages with a maximum lookback of 1 year.
|
|
47
|
+
# @param user_id [String]
|
|
48
|
+
# @param user_secret [String]
|
|
49
|
+
# @param account_id [String]
|
|
50
|
+
# @param [Hash] opts the optional parameters
|
|
51
|
+
# @return [AccountValueHistoryResponse]
|
|
52
|
+
private def get_account_balance_history_impl(user_id, user_secret, account_id, opts = {})
|
|
53
|
+
data, _status_code, _headers = get_account_balance_history_with_http_info(user_id, user_secret, account_id, opts)
|
|
54
|
+
data
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# List historical account total value
|
|
58
|
+
# An experimental endpoint that returns estimated historical total account value for the specified account. Total account value is the sum of the market value of all positions and cash in the account at a given time. This endpoint is experimental, disabled by default, and only available for certain brokerages with a maximum lookback of 1 year.
|
|
59
|
+
# @param user_id [String]
|
|
60
|
+
# @param user_secret [String]
|
|
61
|
+
# @param account_id [String]
|
|
62
|
+
# @param [Hash] opts the optional parameters
|
|
63
|
+
# @return [Array<(AccountValueHistoryResponse, Integer, Hash)>] AccountValueHistoryResponse data, response status code and response headers
|
|
64
|
+
private def get_account_balance_history_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
|
65
|
+
if @api_client.config.debugging
|
|
66
|
+
@api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.get_account_balance_history ...'
|
|
67
|
+
end
|
|
68
|
+
# verify the required parameter 'user_id' is set
|
|
69
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
|
70
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.get_account_balance_history"
|
|
71
|
+
end
|
|
72
|
+
# verify the required parameter 'user_secret' is set
|
|
73
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
|
74
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.get_account_balance_history"
|
|
75
|
+
end
|
|
76
|
+
# verify the required parameter 'account_id' is set
|
|
77
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
|
78
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling ExperimentalEndpointsApi.get_account_balance_history"
|
|
79
|
+
end
|
|
80
|
+
# resource path
|
|
81
|
+
local_var_path = '/accounts/{accountId}/balanceHistory'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
|
82
|
+
|
|
83
|
+
# query parameters
|
|
84
|
+
query_params = opts[:query_params] || {}
|
|
85
|
+
query_params[:'userId'] = user_id
|
|
86
|
+
query_params[:'userSecret'] = user_secret
|
|
87
|
+
|
|
88
|
+
# header parameters
|
|
89
|
+
header_params = opts[:header_params] || {}
|
|
90
|
+
# HTTP header 'Accept' (if needed)
|
|
91
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
92
|
+
|
|
93
|
+
# form parameters
|
|
94
|
+
form_params = opts[:form_params] || {}
|
|
95
|
+
|
|
96
|
+
# http body (model)
|
|
97
|
+
post_body = opts[:debug_body]
|
|
98
|
+
|
|
99
|
+
# return_type
|
|
100
|
+
return_type = opts[:debug_return_type] || 'AccountValueHistoryResponse'
|
|
101
|
+
|
|
102
|
+
# auth_names
|
|
103
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
104
|
+
|
|
105
|
+
new_options = opts.merge(
|
|
106
|
+
:operation => :"ExperimentalEndpointsApi.get_account_balance_history",
|
|
107
|
+
:header_params => header_params,
|
|
108
|
+
:query_params => query_params,
|
|
109
|
+
:form_params => form_params,
|
|
110
|
+
:body => post_body,
|
|
111
|
+
:auth_names => auth_names,
|
|
112
|
+
:return_type => return_type
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
|
116
|
+
if @api_client.config.debugging
|
|
117
|
+
@api_client.config.logger.debug "API called: ExperimentalEndpointsApi#get_account_balance_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
118
|
+
end
|
|
119
|
+
return data, status_code, headers, response
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
|
|
20
123
|
# Get account order detail (V2)
|
|
21
124
|
#
|
|
22
125
|
# Returns the detail of a single order using the brokerage order ID provided as a path parameter.
|
|
@@ -0,0 +1,228 @@
|
|
|
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
|
+
# The estimeated account value at a specific point in time.
|
|
15
|
+
class AccountValueHistoryItem
|
|
16
|
+
# The date of the estimated account value
|
|
17
|
+
attr_accessor :date
|
|
18
|
+
|
|
19
|
+
# Estimate of the total market value of this account (includes cash, equity, fixed income, etc) at the given date.
|
|
20
|
+
attr_accessor :total_value
|
|
21
|
+
|
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
23
|
+
def self.attribute_map
|
|
24
|
+
{
|
|
25
|
+
:'date' => :'date',
|
|
26
|
+
:'total_value' => :'total_value'
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Returns all the JSON keys this model knows about
|
|
31
|
+
def self.acceptable_attributes
|
|
32
|
+
attribute_map.values
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Attribute type mapping.
|
|
36
|
+
def self.openapi_types
|
|
37
|
+
{
|
|
38
|
+
:'date' => :'Date',
|
|
39
|
+
:'total_value' => :'String'
|
|
40
|
+
}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# List of attributes with nullable: true
|
|
44
|
+
def self.openapi_nullable
|
|
45
|
+
Set.new([
|
|
46
|
+
])
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Initializes the object
|
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
51
|
+
def initialize(attributes = {})
|
|
52
|
+
if (!attributes.is_a?(Hash))
|
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountValueHistoryItem` initialize method"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountValueHistoryItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
60
|
+
end
|
|
61
|
+
h[k.to_sym] = v
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if attributes.key?(:'date')
|
|
65
|
+
self.date = attributes[:'date']
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
if attributes.key?(:'total_value')
|
|
69
|
+
self.total_value = attributes[:'total_value']
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
74
|
+
# @return Array for valid properties with the reasons
|
|
75
|
+
def list_invalid_properties
|
|
76
|
+
invalid_properties = Array.new
|
|
77
|
+
invalid_properties
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Check to see if the all the properties in the model are valid
|
|
81
|
+
# @return true if the model is valid
|
|
82
|
+
def valid?
|
|
83
|
+
true
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Checks equality by comparing each attribute.
|
|
87
|
+
# @param [Object] Object to be compared
|
|
88
|
+
def ==(o)
|
|
89
|
+
return true if self.equal?(o)
|
|
90
|
+
self.class == o.class &&
|
|
91
|
+
date == o.date &&
|
|
92
|
+
total_value == o.total_value
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# @see the `==` method
|
|
96
|
+
# @param [Object] Object to be compared
|
|
97
|
+
def eql?(o)
|
|
98
|
+
self == o
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Calculates hash code according to all attributes.
|
|
102
|
+
# @return [Integer] Hash code
|
|
103
|
+
def hash
|
|
104
|
+
[date, total_value].hash
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Builds the object from hash
|
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
109
|
+
# @return [Object] Returns the model itself
|
|
110
|
+
def self.build_from_hash(attributes)
|
|
111
|
+
new.build_from_hash(attributes)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Builds the object from hash
|
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
116
|
+
# @return [Object] Returns the model itself
|
|
117
|
+
def build_from_hash(attributes)
|
|
118
|
+
return nil unless attributes.is_a?(Hash)
|
|
119
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
120
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
121
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
122
|
+
self.send("#{key}=", nil)
|
|
123
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
124
|
+
# check to ensure the input is an array given that the attribute
|
|
125
|
+
# is documented as an array but the input is not
|
|
126
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
127
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
128
|
+
end
|
|
129
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
130
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
self
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Deserializes the data based on type
|
|
138
|
+
# @param string type Data type
|
|
139
|
+
# @param string value Value to be deserialized
|
|
140
|
+
# @return [Object] Deserialized data
|
|
141
|
+
def _deserialize(type, value)
|
|
142
|
+
case type.to_sym
|
|
143
|
+
when :Time
|
|
144
|
+
Time.parse(value)
|
|
145
|
+
when :Date
|
|
146
|
+
Date.parse(value)
|
|
147
|
+
when :String
|
|
148
|
+
value.to_s
|
|
149
|
+
when :Integer
|
|
150
|
+
value.to_i
|
|
151
|
+
when :Float
|
|
152
|
+
value.to_f
|
|
153
|
+
when :Boolean
|
|
154
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
155
|
+
true
|
|
156
|
+
else
|
|
157
|
+
false
|
|
158
|
+
end
|
|
159
|
+
when :Object
|
|
160
|
+
# generic object (usually a Hash), return directly
|
|
161
|
+
value
|
|
162
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
163
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
164
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
165
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
166
|
+
k_type = Regexp.last_match[:k_type]
|
|
167
|
+
v_type = Regexp.last_match[:v_type]
|
|
168
|
+
{}.tap do |hash|
|
|
169
|
+
value.each do |k, v|
|
|
170
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
else # model
|
|
174
|
+
# models (e.g. Pet) or oneOf
|
|
175
|
+
klass = SnapTrade.const_get(type)
|
|
176
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Returns the string representation of the object
|
|
181
|
+
# @return [String] String presentation of the object
|
|
182
|
+
def to_s
|
|
183
|
+
to_hash.to_s
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
|
188
|
+
def to_body
|
|
189
|
+
to_hash
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# Returns the object in the form of hash
|
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
|
194
|
+
def to_hash
|
|
195
|
+
hash = {}
|
|
196
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
197
|
+
value = self.send(attr)
|
|
198
|
+
if value.nil?
|
|
199
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
200
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
hash[param] = _to_hash(value)
|
|
204
|
+
end
|
|
205
|
+
hash
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Outputs non-array value in the form of hash
|
|
209
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
210
|
+
# @param [Object] value Any valid value
|
|
211
|
+
# @return [Hash] Returns the value in the form of hash
|
|
212
|
+
def _to_hash(value)
|
|
213
|
+
if value.is_a?(Array)
|
|
214
|
+
value.compact.map { |v| _to_hash(v) }
|
|
215
|
+
elsif value.is_a?(Hash)
|
|
216
|
+
{}.tap do |hash|
|
|
217
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
218
|
+
end
|
|
219
|
+
elsif value.respond_to? :to_hash
|
|
220
|
+
value.to_hash
|
|
221
|
+
else
|
|
222
|
+
value
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
end
|