snaptrade 1.17.4 → 1.17.6
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 +5 -2
- data/docs/Account.md +3 -1
- data/docs/AccountBalance.md +18 -0
- data/docs/AccountBalanceTotal.md +20 -0
- data/docs/AccountInformationApi.md +9 -4
- data/docs/Amount.md +20 -0
- data/lib/snaptrade/api/account_information_api.rb +17 -6
- data/lib/snaptrade/models/account.rb +13 -4
- data/lib/snaptrade/models/account_balance.rb +219 -0
- data/lib/snaptrade/models/account_balance_total.rb +234 -0
- data/lib/snaptrade/models/amount.rb +227 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +3 -0
- data/spec/api/account_information_api_spec.rb +2 -1
- data/spec/models/account_balance_spec.rb +30 -0
- data/spec/models/account_balance_total_spec.rb +36 -0
- data/spec/models/account_spec.rb +6 -0
- data/spec/models/amount_spec.rb +36 -0
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ccb4f353fc653e152f5eb6afeefe3656924848582cb959f02377cee0787e5a9
|
4
|
+
data.tar.gz: ccc5319257834058e7106231218b202c300167874e05dcc7ebd4e31bd7071685
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68ae35db6b8a6691621ea5cfe413660792d1d81094fc8d40bd5a2dca5e1417ed66c759e5de54f7dad19337926929a88e038070b0be2dbc5e707e157fd6a06747
|
7
|
+
data.tar.gz: 0d598c9e1a80b10f4d88e8c1e806794c0075835a88d8f01b8fbcaf12b32e018676ee2b4a30f1223050969f68d6a2279393e68a0ffa95c1af5417b0adae4ce588
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@ For more information, please visit [https://snaptrade.com/](https://snaptrade.co
|
|
9
9
|
Add to Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem 'snaptrade', '~> 1.17.
|
12
|
+
gem 'snaptrade', '~> 1.17.6'
|
13
13
|
```
|
14
14
|
|
15
15
|
## Getting Started
|
@@ -46,7 +46,7 @@ Class | Method | HTTP request | Description
|
|
46
46
|
*SnapTrade::AccountInformationApi* | [**get_all_user_holdings**](docs/AccountInformationApi.md#get_all_user_holdings) | **GET** /holdings | List all accounts for the user, plus balances, positions, and orders for each account.
|
47
47
|
*SnapTrade::AccountInformationApi* | [**get_user_account_balance**](docs/AccountInformationApi.md#get_user_account_balance) | **GET** /accounts/{accountId}/balances | List account balances
|
48
48
|
*SnapTrade::AccountInformationApi* | [**get_user_account_details**](docs/AccountInformationApi.md#get_user_account_details) | **GET** /accounts/{accountId} | Return details of a specific investment account
|
49
|
-
*SnapTrade::AccountInformationApi* | [**get_user_account_orders**](docs/AccountInformationApi.md#get_user_account_orders) | **GET** /accounts/{accountId}/orders |
|
49
|
+
*SnapTrade::AccountInformationApi* | [**get_user_account_orders**](docs/AccountInformationApi.md#get_user_account_orders) | **GET** /accounts/{accountId}/orders | List account orders
|
50
50
|
*SnapTrade::AccountInformationApi* | [**get_user_account_positions**](docs/AccountInformationApi.md#get_user_account_positions) | **GET** /accounts/{accountId}/positions | List account positions
|
51
51
|
*SnapTrade::AccountInformationApi* | [**get_user_holdings**](docs/AccountInformationApi.md#get_user_holdings) | **GET** /accounts/{accountId}/holdings | List balances, positions and orders for the specified account
|
52
52
|
*SnapTrade::AccountInformationApi* | [**list_user_accounts**](docs/AccountInformationApi.md#list_user_accounts) | **GET** /accounts | List accounts
|
@@ -91,6 +91,8 @@ Class | Method | HTTP request | Description
|
|
91
91
|
## Documentation for Models
|
92
92
|
|
93
93
|
- [SnapTrade::Account](docs/Account.md)
|
94
|
+
- [SnapTrade::AccountBalance](docs/AccountBalance.md)
|
95
|
+
- [SnapTrade::AccountBalanceTotal](docs/AccountBalanceTotal.md)
|
94
96
|
- [SnapTrade::AccountHoldings](docs/AccountHoldings.md)
|
95
97
|
- [SnapTrade::AccountHoldingsAccount](docs/AccountHoldingsAccount.md)
|
96
98
|
- [SnapTrade::AccountOrderRecord](docs/AccountOrderRecord.md)
|
@@ -98,6 +100,7 @@ Class | Method | HTTP request | Description
|
|
98
100
|
- [SnapTrade::AccountSimple](docs/AccountSimple.md)
|
99
101
|
- [SnapTrade::AccountSyncStatus](docs/AccountSyncStatus.md)
|
100
102
|
- [SnapTrade::Action](docs/Action.md)
|
103
|
+
- [SnapTrade::Amount](docs/Amount.md)
|
101
104
|
- [SnapTrade::AuthType](docs/AuthType.md)
|
102
105
|
- [SnapTrade::AuthenticationLoginSnapTradeUser200Response](docs/AuthenticationLoginSnapTradeUser200Response.md)
|
103
106
|
- [SnapTrade::Balance](docs/Balance.md)
|
data/docs/Account.md
CHANGED
@@ -14,6 +14,7 @@
|
|
14
14
|
| **meta** | **Hash<String, Object>** | | [optional] |
|
15
15
|
| **cash_restrictions** | [**Array<CashRestriction>**](CashRestriction.md) | | [optional] |
|
16
16
|
| **sync_status** | [**AccountSyncStatus**](AccountSyncStatus.md) | | [optional] |
|
17
|
+
| **balance** | [**AccountBalance**](AccountBalance.md) | | [optional] |
|
17
18
|
|
18
19
|
## Example
|
19
20
|
|
@@ -30,7 +31,8 @@ instance = SnapTrade::Account.new(
|
|
30
31
|
created_date: 2021-06-04T16:26:46.523Z,
|
31
32
|
meta: {"type":"Margin","status":"ACTIVE","institution_name":"Alpaca"},
|
32
33
|
cash_restrictions: null,
|
33
|
-
sync_status: null
|
34
|
+
sync_status: null,
|
35
|
+
balance: null
|
34
36
|
)
|
35
37
|
```
|
36
38
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# SnapTrade::AccountBalance
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **total** | [**AccountBalanceTotal**](AccountBalanceTotal.md) | | [optional] |
|
8
|
+
|
9
|
+
## Example
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
require 'snaptrade'
|
13
|
+
|
14
|
+
instance = SnapTrade::AccountBalance.new(
|
15
|
+
total: null
|
16
|
+
)
|
17
|
+
```
|
18
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# SnapTrade::AccountBalanceTotal
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **amount** | **Float** | | [optional] |
|
8
|
+
| **currency** | **String** | | [optional] |
|
9
|
+
|
10
|
+
## Example
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'snaptrade'
|
14
|
+
|
15
|
+
instance = SnapTrade::AccountBalanceTotal.new(
|
16
|
+
amount: 15363.23,
|
17
|
+
currency: USD
|
18
|
+
)
|
19
|
+
```
|
20
|
+
|
@@ -7,7 +7,7 @@ All URIs are relative to *https://api.snaptrade.com/api/v1*
|
|
7
7
|
| [**get_all_user_holdings**](AccountInformationApi.md#get_all_user_holdings) | **GET** /holdings | List all accounts for the user, plus balances, positions, and orders for each account. |
|
8
8
|
| [**get_user_account_balance**](AccountInformationApi.md#get_user_account_balance) | **GET** /accounts/{accountId}/balances | List account balances |
|
9
9
|
| [**get_user_account_details**](AccountInformationApi.md#get_user_account_details) | **GET** /accounts/{accountId} | Return details of a specific investment account |
|
10
|
-
| [**get_user_account_orders**](AccountInformationApi.md#get_user_account_orders) | **GET** /accounts/{accountId}/orders |
|
10
|
+
| [**get_user_account_orders**](AccountInformationApi.md#get_user_account_orders) | **GET** /accounts/{accountId}/orders | List account orders |
|
11
11
|
| [**get_user_account_positions**](AccountInformationApi.md#get_user_account_positions) | **GET** /accounts/{accountId}/positions | List account positions |
|
12
12
|
| [**get_user_holdings**](AccountInformationApi.md#get_user_holdings) | **GET** /accounts/{accountId}/holdings | List balances, positions and orders for the specified account |
|
13
13
|
| [**list_user_accounts**](AccountInformationApi.md#list_user_accounts) | **GET** /accounts | List accounts |
|
@@ -212,7 +212,7 @@ end
|
|
212
212
|
|
213
213
|
## get_user_account_orders
|
214
214
|
|
215
|
-
|
215
|
+
List account orders
|
216
216
|
|
217
217
|
Fetch all recent orders from a user's account.
|
218
218
|
|
@@ -228,14 +228,16 @@ user_id = "John.doe@snaptrade.com"
|
|
228
228
|
user_secret = "USERSECRET123"
|
229
229
|
account_id = "accountId_example"
|
230
230
|
state = "all"
|
231
|
+
days = 30
|
231
232
|
|
232
233
|
begin
|
233
|
-
#
|
234
|
+
# List account orders
|
234
235
|
result = SnapTrade::AccountInformation.get_user_account_orders(
|
235
236
|
user_id: user_id,
|
236
237
|
user_secret: user_secret,
|
237
238
|
account_id: account_id,
|
238
239
|
state: state,
|
240
|
+
days: days,
|
239
241
|
)
|
240
242
|
p result
|
241
243
|
rescue SnapTrade::ApiError => e
|
@@ -252,14 +254,16 @@ user_id = "John.doe@snaptrade.com"
|
|
252
254
|
user_secret = "USERSECRET123"
|
253
255
|
account_id = "accountId_example"
|
254
256
|
state = "all"
|
257
|
+
days = 30
|
255
258
|
|
256
259
|
begin
|
257
|
-
#
|
260
|
+
# List account orders
|
258
261
|
data, status_code, headers, response = SnapTrade::AccountInformation.get_user_account_orders_with_http_info(
|
259
262
|
user_id: user_id,
|
260
263
|
user_secret: user_secret,
|
261
264
|
account_id: account_id,
|
262
265
|
state: state,
|
266
|
+
days: days,
|
263
267
|
)
|
264
268
|
p status_code # => 2xx
|
265
269
|
p headers # => { ... }
|
@@ -277,6 +281,7 @@ end
|
|
277
281
|
| **user_secret** | **String** | | |
|
278
282
|
| **account_id** | **String** | The ID of the account to get orders. | |
|
279
283
|
| **state** | **String** | defaults value is set to \"all\" | [optional] |
|
284
|
+
| **days** | **Integer** | Number of days in the past to fetch the most recent orders. Defaults to the last 90 days if no value is passed in. | [optional] |
|
280
285
|
|
281
286
|
### Return type
|
282
287
|
|
data/docs/Amount.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# SnapTrade::Amount
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **amount** | **Float** | | [optional] |
|
8
|
+
| **currency** | **String** | | [optional] |
|
9
|
+
|
10
|
+
## Example
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'snaptrade'
|
14
|
+
|
15
|
+
instance = SnapTrade::Amount.new(
|
16
|
+
amount: 15363.23,
|
17
|
+
currency: USD
|
18
|
+
)
|
19
|
+
```
|
20
|
+
|
@@ -306,51 +306,57 @@ module SnapTrade
|
|
306
306
|
end
|
307
307
|
|
308
308
|
|
309
|
-
#
|
309
|
+
# List account orders
|
310
310
|
# Fetch all recent orders from a user's account.
|
311
311
|
# @param user_id [String]
|
312
312
|
# @param user_secret [String]
|
313
313
|
# @param account_id [String] The ID of the account to get orders.
|
314
314
|
# @param state [String] defaults value is set to \"all\"
|
315
|
+
# @param days [Integer] Number of days in the past to fetch the most recent orders. Defaults to the last 90 days if no value is passed in.
|
315
316
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
316
|
-
def get_user_account_orders(user_id:, user_secret:, account_id:, state: SENTINEL, extra: {})
|
317
|
+
def get_user_account_orders(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
|
317
318
|
extra[:state] = state if state != SENTINEL
|
319
|
+
extra[:days] = days if days != SENTINEL
|
318
320
|
data, _status_code, _headers = get_user_account_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
|
319
321
|
data
|
320
322
|
end
|
321
323
|
|
322
|
-
#
|
324
|
+
# List account orders
|
323
325
|
# Fetch all recent orders from a user's account.
|
324
326
|
# @param user_id [String]
|
325
327
|
# @param user_secret [String]
|
326
328
|
# @param account_id [String] The ID of the account to get orders.
|
327
329
|
# @param state [String] defaults value is set to \"all\"
|
330
|
+
# @param days [Integer] Number of days in the past to fetch the most recent orders. Defaults to the last 90 days if no value is passed in.
|
328
331
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
329
|
-
def get_user_account_orders_with_http_info(user_id:, user_secret:, account_id:, state: SENTINEL, extra: {})
|
332
|
+
def get_user_account_orders_with_http_info(user_id:, user_secret:, account_id:, state: SENTINEL, days: SENTINEL, extra: {})
|
330
333
|
extra[:state] = state if state != SENTINEL
|
334
|
+
extra[:days] = days if days != SENTINEL
|
331
335
|
get_user_account_orders_with_http_info_impl(user_id, user_secret, account_id, extra)
|
332
336
|
end
|
333
337
|
|
334
|
-
#
|
338
|
+
# List account orders
|
335
339
|
# Fetch all recent orders from a user's account.
|
336
340
|
# @param user_id [String]
|
337
341
|
# @param user_secret [String]
|
338
342
|
# @param account_id [String] The ID of the account to get orders.
|
339
343
|
# @param [Hash] opts the optional parameters
|
340
344
|
# @option opts [String] :state defaults value is set to \"all\"
|
345
|
+
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 90 days if no value is passed in.
|
341
346
|
# @return [Array<AccountOrderRecord>]
|
342
347
|
def get_user_account_orders_impl(user_id, user_secret, account_id, opts = {})
|
343
348
|
data, _status_code, _headers = get_user_account_orders_with_http_info(user_id, user_secret, account_id, opts)
|
344
349
|
data
|
345
350
|
end
|
346
351
|
|
347
|
-
#
|
352
|
+
# List account orders
|
348
353
|
# Fetch all recent orders from a user's account.
|
349
354
|
# @param user_id [String]
|
350
355
|
# @param user_secret [String]
|
351
356
|
# @param account_id [String] The ID of the account to get orders.
|
352
357
|
# @param [Hash] opts the optional parameters
|
353
358
|
# @option opts [String] :state defaults value is set to \"all\"
|
359
|
+
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 90 days if no value is passed in.
|
354
360
|
# @return [Array<(Array<AccountOrderRecord>, Integer, Hash)>] Array<AccountOrderRecord> data, response status code and response headers
|
355
361
|
def get_user_account_orders_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
356
362
|
if @api_client.config.debugging
|
@@ -372,6 +378,10 @@ module SnapTrade
|
|
372
378
|
if @api_client.config.client_side_validation && opts[:'state'] && !allowable_values.include?(opts[:'state'])
|
373
379
|
fail ArgumentError, "invalid value for \"state\", must be one of #{allowable_values}"
|
374
380
|
end
|
381
|
+
if @api_client.config.client_side_validation && !opts[:'days'].nil? && opts[:'days'] < 1
|
382
|
+
fail ArgumentError, 'invalid value for "opts[:"days"]" when calling AccountInformationApi.get_user_account_orders, must be greater than or equal to 1.'
|
383
|
+
end
|
384
|
+
|
375
385
|
# resource path
|
376
386
|
local_var_path = '/accounts/{accountId}/orders'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
377
387
|
|
@@ -380,6 +390,7 @@ module SnapTrade
|
|
380
390
|
query_params[:'userId'] = user_id
|
381
391
|
query_params[:'userSecret'] = user_secret
|
382
392
|
query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
|
393
|
+
query_params[:'days'] = opts[:'days'] if !opts[:'days'].nil?
|
383
394
|
|
384
395
|
# header parameters
|
385
396
|
header_params = opts[:header_params] || {}
|
@@ -34,6 +34,8 @@ module SnapTrade
|
|
34
34
|
|
35
35
|
attr_accessor :sync_status
|
36
36
|
|
37
|
+
attr_accessor :balance
|
38
|
+
|
37
39
|
# Attribute mapping from ruby-style variable name to JSON key.
|
38
40
|
def self.attribute_map
|
39
41
|
{
|
@@ -46,7 +48,8 @@ module SnapTrade
|
|
46
48
|
:'created_date' => :'created_date',
|
47
49
|
:'meta' => :'meta',
|
48
50
|
:'cash_restrictions' => :'cash_restrictions',
|
49
|
-
:'sync_status' => :'sync_status'
|
51
|
+
:'sync_status' => :'sync_status',
|
52
|
+
:'balance' => :'balance'
|
50
53
|
}
|
51
54
|
end
|
52
55
|
|
@@ -67,7 +70,8 @@ module SnapTrade
|
|
67
70
|
:'created_date' => :'String',
|
68
71
|
:'meta' => :'Hash<String, Object>',
|
69
72
|
:'cash_restrictions' => :'Array<CashRestriction>',
|
70
|
-
:'sync_status' => :'AccountSyncStatus'
|
73
|
+
:'sync_status' => :'AccountSyncStatus',
|
74
|
+
:'balance' => :'AccountBalance'
|
71
75
|
}
|
72
76
|
end
|
73
77
|
|
@@ -135,6 +139,10 @@ module SnapTrade
|
|
135
139
|
if attributes.key?(:'sync_status')
|
136
140
|
self.sync_status = attributes[:'sync_status']
|
137
141
|
end
|
142
|
+
|
143
|
+
if attributes.key?(:'balance')
|
144
|
+
self.balance = attributes[:'balance']
|
145
|
+
end
|
138
146
|
end
|
139
147
|
|
140
148
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -164,7 +172,8 @@ module SnapTrade
|
|
164
172
|
created_date == o.created_date &&
|
165
173
|
meta == o.meta &&
|
166
174
|
cash_restrictions == o.cash_restrictions &&
|
167
|
-
sync_status == o.sync_status
|
175
|
+
sync_status == o.sync_status &&
|
176
|
+
balance == o.balance
|
168
177
|
end
|
169
178
|
|
170
179
|
# @see the `==` method
|
@@ -176,7 +185,7 @@ module SnapTrade
|
|
176
185
|
# Calculates hash code according to all attributes.
|
177
186
|
# @return [Integer] Hash code
|
178
187
|
def hash
|
179
|
-
[id, brokerage_authorization, portfolio_group, name, number, institution_name, created_date, meta, cash_restrictions, sync_status].hash
|
188
|
+
[id, brokerage_authorization, portfolio_group, name, number, institution_name, created_date, meta, cash_restrictions, sync_status, balance].hash
|
180
189
|
end
|
181
190
|
|
182
191
|
# Builds the object from hash
|
@@ -0,0 +1,219 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'date'
|
12
|
+
require 'time'
|
13
|
+
|
14
|
+
module SnapTrade
|
15
|
+
# Balance of the account
|
16
|
+
class AccountBalance
|
17
|
+
attr_accessor :total
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'total' => :'total'
|
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
|
+
:'total' => :'AccountBalanceTotal'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# List of attributes with nullable: true
|
39
|
+
def self.openapi_nullable
|
40
|
+
Set.new([
|
41
|
+
:'total'
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountBalance` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountBalance`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'total')
|
61
|
+
self.total = attributes[:'total']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
66
|
+
# @return Array for valid properties with the reasons
|
67
|
+
def list_invalid_properties
|
68
|
+
invalid_properties = Array.new
|
69
|
+
invalid_properties
|
70
|
+
end
|
71
|
+
|
72
|
+
# Check to see if the all the properties in the model are valid
|
73
|
+
# @return true if the model is valid
|
74
|
+
def valid?
|
75
|
+
true
|
76
|
+
end
|
77
|
+
|
78
|
+
# Checks equality by comparing each attribute.
|
79
|
+
# @param [Object] Object to be compared
|
80
|
+
def ==(o)
|
81
|
+
return true if self.equal?(o)
|
82
|
+
self.class == o.class &&
|
83
|
+
total == o.total
|
84
|
+
end
|
85
|
+
|
86
|
+
# @see the `==` method
|
87
|
+
# @param [Object] Object to be compared
|
88
|
+
def eql?(o)
|
89
|
+
self == o
|
90
|
+
end
|
91
|
+
|
92
|
+
# Calculates hash code according to all attributes.
|
93
|
+
# @return [Integer] Hash code
|
94
|
+
def hash
|
95
|
+
[total].hash
|
96
|
+
end
|
97
|
+
|
98
|
+
# Builds the object from hash
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
100
|
+
# @return [Object] Returns the model itself
|
101
|
+
def self.build_from_hash(attributes)
|
102
|
+
new.build_from_hash(attributes)
|
103
|
+
end
|
104
|
+
|
105
|
+
# Builds the object from hash
|
106
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
107
|
+
# @return [Object] Returns the model itself
|
108
|
+
def build_from_hash(attributes)
|
109
|
+
return nil unless attributes.is_a?(Hash)
|
110
|
+
attributes = attributes.transform_keys(&:to_sym)
|
111
|
+
self.class.openapi_types.each_pair do |key, type|
|
112
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
113
|
+
self.send("#{key}=", nil)
|
114
|
+
elsif type =~ /\AArray<(.*)>/i
|
115
|
+
# check to ensure the input is an array given that the attribute
|
116
|
+
# is documented as an array but the input is not
|
117
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
118
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
119
|
+
end
|
120
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
121
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
self
|
126
|
+
end
|
127
|
+
|
128
|
+
# Deserializes the data based on type
|
129
|
+
# @param string type Data type
|
130
|
+
# @param string value Value to be deserialized
|
131
|
+
# @return [Object] Deserialized data
|
132
|
+
def _deserialize(type, value)
|
133
|
+
case type.to_sym
|
134
|
+
when :Time
|
135
|
+
Time.parse(value)
|
136
|
+
when :Date
|
137
|
+
Date.parse(value)
|
138
|
+
when :String
|
139
|
+
value.to_s
|
140
|
+
when :Integer
|
141
|
+
value.to_i
|
142
|
+
when :Float
|
143
|
+
value.to_f
|
144
|
+
when :Boolean
|
145
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
146
|
+
true
|
147
|
+
else
|
148
|
+
false
|
149
|
+
end
|
150
|
+
when :Object
|
151
|
+
# generic object (usually a Hash), return directly
|
152
|
+
value
|
153
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
154
|
+
inner_type = Regexp.last_match[:inner_type]
|
155
|
+
value.map { |v| _deserialize(inner_type, v) }
|
156
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
157
|
+
k_type = Regexp.last_match[:k_type]
|
158
|
+
v_type = Regexp.last_match[:v_type]
|
159
|
+
{}.tap do |hash|
|
160
|
+
value.each do |k, v|
|
161
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
else # model
|
165
|
+
# models (e.g. Pet) or oneOf
|
166
|
+
klass = SnapTrade.const_get(type)
|
167
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# Returns the string representation of the object
|
172
|
+
# @return [String] String presentation of the object
|
173
|
+
def to_s
|
174
|
+
to_hash.to_s
|
175
|
+
end
|
176
|
+
|
177
|
+
# to_body is an alias to to_hash (backward compatibility)
|
178
|
+
# @return [Hash] Returns the object in the form of hash
|
179
|
+
def to_body
|
180
|
+
to_hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Returns the object in the form of hash
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
185
|
+
def to_hash
|
186
|
+
hash = {}
|
187
|
+
self.class.attribute_map.each_pair do |attr, param|
|
188
|
+
value = self.send(attr)
|
189
|
+
if value.nil?
|
190
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
191
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
192
|
+
end
|
193
|
+
|
194
|
+
hash[param] = _to_hash(value)
|
195
|
+
end
|
196
|
+
hash
|
197
|
+
end
|
198
|
+
|
199
|
+
# Outputs non-array value in the form of hash
|
200
|
+
# For object, use to_hash. Otherwise, just return the value
|
201
|
+
# @param [Object] value Any valid value
|
202
|
+
# @return [Hash] Returns the value in the form of hash
|
203
|
+
def _to_hash(value)
|
204
|
+
if value.is_a?(Array)
|
205
|
+
value.compact.map { |v| _to_hash(v) }
|
206
|
+
elsif value.is_a?(Hash)
|
207
|
+
{}.tap do |hash|
|
208
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
209
|
+
end
|
210
|
+
elsif value.respond_to? :to_hash
|
211
|
+
value.to_hash
|
212
|
+
else
|
213
|
+
value
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
end
|
218
|
+
|
219
|
+
end
|
@@ -0,0 +1,234 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'date'
|
12
|
+
require 'time'
|
13
|
+
|
14
|
+
module SnapTrade
|
15
|
+
# Total value of this account (includes cash, equity, fixed income, etc)
|
16
|
+
class AccountBalanceTotal
|
17
|
+
attr_accessor :amount
|
18
|
+
|
19
|
+
attr_accessor :currency
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'amount' => :'amount',
|
25
|
+
:'currency' => :'currency'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns all the JSON keys this model knows about
|
30
|
+
def self.acceptable_attributes
|
31
|
+
attribute_map.values
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.openapi_types
|
36
|
+
{
|
37
|
+
:'amount' => :'Float',
|
38
|
+
:'currency' => :'String'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# List of attributes with nullable: true
|
43
|
+
def self.openapi_nullable
|
44
|
+
Set.new([
|
45
|
+
])
|
46
|
+
end
|
47
|
+
|
48
|
+
# List of class defined in allOf (OpenAPI v3)
|
49
|
+
def self.openapi_all_of
|
50
|
+
[
|
51
|
+
:'Amount'
|
52
|
+
]
|
53
|
+
end
|
54
|
+
|
55
|
+
# Initializes the object
|
56
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
57
|
+
def initialize(attributes = {})
|
58
|
+
if (!attributes.is_a?(Hash))
|
59
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountBalanceTotal` initialize method"
|
60
|
+
end
|
61
|
+
|
62
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
63
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
64
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
65
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountBalanceTotal`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
66
|
+
end
|
67
|
+
h[k.to_sym] = v
|
68
|
+
}
|
69
|
+
|
70
|
+
if attributes.key?(:'amount')
|
71
|
+
self.amount = attributes[:'amount']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.key?(:'currency')
|
75
|
+
self.currency = attributes[:'currency']
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
80
|
+
# @return Array for valid properties with the reasons
|
81
|
+
def list_invalid_properties
|
82
|
+
invalid_properties = Array.new
|
83
|
+
invalid_properties
|
84
|
+
end
|
85
|
+
|
86
|
+
# Check to see if the all the properties in the model are valid
|
87
|
+
# @return true if the model is valid
|
88
|
+
def valid?
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
# Checks equality by comparing each attribute.
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def ==(o)
|
95
|
+
return true if self.equal?(o)
|
96
|
+
self.class == o.class &&
|
97
|
+
amount == o.amount &&
|
98
|
+
currency == o.currency
|
99
|
+
end
|
100
|
+
|
101
|
+
# @see the `==` method
|
102
|
+
# @param [Object] Object to be compared
|
103
|
+
def eql?(o)
|
104
|
+
self == o
|
105
|
+
end
|
106
|
+
|
107
|
+
# Calculates hash code according to all attributes.
|
108
|
+
# @return [Integer] Hash code
|
109
|
+
def hash
|
110
|
+
[amount, currency].hash
|
111
|
+
end
|
112
|
+
|
113
|
+
# Builds the object from hash
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
115
|
+
# @return [Object] Returns the model itself
|
116
|
+
def self.build_from_hash(attributes)
|
117
|
+
new.build_from_hash(attributes)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Builds the object from hash
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
122
|
+
# @return [Object] Returns the model itself
|
123
|
+
def build_from_hash(attributes)
|
124
|
+
return nil unless attributes.is_a?(Hash)
|
125
|
+
attributes = attributes.transform_keys(&:to_sym)
|
126
|
+
self.class.openapi_types.each_pair do |key, type|
|
127
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
128
|
+
self.send("#{key}=", nil)
|
129
|
+
elsif type =~ /\AArray<(.*)>/i
|
130
|
+
# check to ensure the input is an array given that the attribute
|
131
|
+
# is documented as an array but the input is not
|
132
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
133
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
134
|
+
end
|
135
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
136
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
self
|
141
|
+
end
|
142
|
+
|
143
|
+
# Deserializes the data based on type
|
144
|
+
# @param string type Data type
|
145
|
+
# @param string value Value to be deserialized
|
146
|
+
# @return [Object] Deserialized data
|
147
|
+
def _deserialize(type, value)
|
148
|
+
case type.to_sym
|
149
|
+
when :Time
|
150
|
+
Time.parse(value)
|
151
|
+
when :Date
|
152
|
+
Date.parse(value)
|
153
|
+
when :String
|
154
|
+
value.to_s
|
155
|
+
when :Integer
|
156
|
+
value.to_i
|
157
|
+
when :Float
|
158
|
+
value.to_f
|
159
|
+
when :Boolean
|
160
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
161
|
+
true
|
162
|
+
else
|
163
|
+
false
|
164
|
+
end
|
165
|
+
when :Object
|
166
|
+
# generic object (usually a Hash), return directly
|
167
|
+
value
|
168
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
169
|
+
inner_type = Regexp.last_match[:inner_type]
|
170
|
+
value.map { |v| _deserialize(inner_type, v) }
|
171
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
172
|
+
k_type = Regexp.last_match[:k_type]
|
173
|
+
v_type = Regexp.last_match[:v_type]
|
174
|
+
{}.tap do |hash|
|
175
|
+
value.each do |k, v|
|
176
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
else # model
|
180
|
+
# models (e.g. Pet) or oneOf
|
181
|
+
klass = SnapTrade.const_get(type)
|
182
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
# Returns the string representation of the object
|
187
|
+
# @return [String] String presentation of the object
|
188
|
+
def to_s
|
189
|
+
to_hash.to_s
|
190
|
+
end
|
191
|
+
|
192
|
+
# to_body is an alias to to_hash (backward compatibility)
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
194
|
+
def to_body
|
195
|
+
to_hash
|
196
|
+
end
|
197
|
+
|
198
|
+
# Returns the object in the form of hash
|
199
|
+
# @return [Hash] Returns the object in the form of hash
|
200
|
+
def to_hash
|
201
|
+
hash = {}
|
202
|
+
self.class.attribute_map.each_pair do |attr, param|
|
203
|
+
value = self.send(attr)
|
204
|
+
if value.nil?
|
205
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
206
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
207
|
+
end
|
208
|
+
|
209
|
+
hash[param] = _to_hash(value)
|
210
|
+
end
|
211
|
+
hash
|
212
|
+
end
|
213
|
+
|
214
|
+
# Outputs non-array value in the form of hash
|
215
|
+
# For object, use to_hash. Otherwise, just return the value
|
216
|
+
# @param [Object] value Any valid value
|
217
|
+
# @return [Hash] Returns the value in the form of hash
|
218
|
+
def _to_hash(value)
|
219
|
+
if value.is_a?(Array)
|
220
|
+
value.compact.map { |v| _to_hash(v) }
|
221
|
+
elsif value.is_a?(Hash)
|
222
|
+
{}.tap do |hash|
|
223
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
224
|
+
end
|
225
|
+
elsif value.respond_to? :to_hash
|
226
|
+
value.to_hash
|
227
|
+
else
|
228
|
+
value
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
@@ -0,0 +1,227 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'date'
|
12
|
+
require 'time'
|
13
|
+
|
14
|
+
module SnapTrade
|
15
|
+
# Total Value of the account
|
16
|
+
class Amount
|
17
|
+
attr_accessor :amount
|
18
|
+
|
19
|
+
attr_accessor :currency
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'amount' => :'amount',
|
25
|
+
:'currency' => :'currency'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Returns all the JSON keys this model knows about
|
30
|
+
def self.acceptable_attributes
|
31
|
+
attribute_map.values
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.openapi_types
|
36
|
+
{
|
37
|
+
:'amount' => :'Float',
|
38
|
+
:'currency' => :'String'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# List of attributes with nullable: true
|
43
|
+
def self.openapi_nullable
|
44
|
+
Set.new([
|
45
|
+
])
|
46
|
+
end
|
47
|
+
|
48
|
+
# Initializes the object
|
49
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
50
|
+
def initialize(attributes = {})
|
51
|
+
if (!attributes.is_a?(Hash))
|
52
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::Amount` initialize method"
|
53
|
+
end
|
54
|
+
|
55
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
57
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
58
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::Amount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
59
|
+
end
|
60
|
+
h[k.to_sym] = v
|
61
|
+
}
|
62
|
+
|
63
|
+
if attributes.key?(:'amount')
|
64
|
+
self.amount = attributes[:'amount']
|
65
|
+
end
|
66
|
+
|
67
|
+
if attributes.key?(:'currency')
|
68
|
+
self.currency = attributes[:'currency']
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
73
|
+
# @return Array for valid properties with the reasons
|
74
|
+
def list_invalid_properties
|
75
|
+
invalid_properties = Array.new
|
76
|
+
invalid_properties
|
77
|
+
end
|
78
|
+
|
79
|
+
# Check to see if the all the properties in the model are valid
|
80
|
+
# @return true if the model is valid
|
81
|
+
def valid?
|
82
|
+
true
|
83
|
+
end
|
84
|
+
|
85
|
+
# Checks equality by comparing each attribute.
|
86
|
+
# @param [Object] Object to be compared
|
87
|
+
def ==(o)
|
88
|
+
return true if self.equal?(o)
|
89
|
+
self.class == o.class &&
|
90
|
+
amount == o.amount &&
|
91
|
+
currency == o.currency
|
92
|
+
end
|
93
|
+
|
94
|
+
# @see the `==` method
|
95
|
+
# @param [Object] Object to be compared
|
96
|
+
def eql?(o)
|
97
|
+
self == o
|
98
|
+
end
|
99
|
+
|
100
|
+
# Calculates hash code according to all attributes.
|
101
|
+
# @return [Integer] Hash code
|
102
|
+
def hash
|
103
|
+
[amount, currency].hash
|
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 self.build_from_hash(attributes)
|
110
|
+
new.build_from_hash(attributes)
|
111
|
+
end
|
112
|
+
|
113
|
+
# Builds the object from hash
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
115
|
+
# @return [Object] Returns the model itself
|
116
|
+
def build_from_hash(attributes)
|
117
|
+
return nil unless attributes.is_a?(Hash)
|
118
|
+
attributes = attributes.transform_keys(&:to_sym)
|
119
|
+
self.class.openapi_types.each_pair do |key, type|
|
120
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
121
|
+
self.send("#{key}=", nil)
|
122
|
+
elsif type =~ /\AArray<(.*)>/i
|
123
|
+
# check to ensure the input is an array given that the attribute
|
124
|
+
# is documented as an array but the input is not
|
125
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
126
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
127
|
+
end
|
128
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
129
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
# Deserializes the data based on type
|
137
|
+
# @param string type Data type
|
138
|
+
# @param string value Value to be deserialized
|
139
|
+
# @return [Object] Deserialized data
|
140
|
+
def _deserialize(type, value)
|
141
|
+
case type.to_sym
|
142
|
+
when :Time
|
143
|
+
Time.parse(value)
|
144
|
+
when :Date
|
145
|
+
Date.parse(value)
|
146
|
+
when :String
|
147
|
+
value.to_s
|
148
|
+
when :Integer
|
149
|
+
value.to_i
|
150
|
+
when :Float
|
151
|
+
value.to_f
|
152
|
+
when :Boolean
|
153
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
154
|
+
true
|
155
|
+
else
|
156
|
+
false
|
157
|
+
end
|
158
|
+
when :Object
|
159
|
+
# generic object (usually a Hash), return directly
|
160
|
+
value
|
161
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
162
|
+
inner_type = Regexp.last_match[:inner_type]
|
163
|
+
value.map { |v| _deserialize(inner_type, v) }
|
164
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
165
|
+
k_type = Regexp.last_match[:k_type]
|
166
|
+
v_type = Regexp.last_match[:v_type]
|
167
|
+
{}.tap do |hash|
|
168
|
+
value.each do |k, v|
|
169
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
else # model
|
173
|
+
# models (e.g. Pet) or oneOf
|
174
|
+
klass = SnapTrade.const_get(type)
|
175
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
# Returns the string representation of the object
|
180
|
+
# @return [String] String presentation of the object
|
181
|
+
def to_s
|
182
|
+
to_hash.to_s
|
183
|
+
end
|
184
|
+
|
185
|
+
# to_body is an alias to to_hash (backward compatibility)
|
186
|
+
# @return [Hash] Returns the object in the form of hash
|
187
|
+
def to_body
|
188
|
+
to_hash
|
189
|
+
end
|
190
|
+
|
191
|
+
# Returns the object in the form of hash
|
192
|
+
# @return [Hash] Returns the object in the form of hash
|
193
|
+
def to_hash
|
194
|
+
hash = {}
|
195
|
+
self.class.attribute_map.each_pair do |attr, param|
|
196
|
+
value = self.send(attr)
|
197
|
+
if value.nil?
|
198
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
199
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
200
|
+
end
|
201
|
+
|
202
|
+
hash[param] = _to_hash(value)
|
203
|
+
end
|
204
|
+
hash
|
205
|
+
end
|
206
|
+
|
207
|
+
# Outputs non-array value in the form of hash
|
208
|
+
# For object, use to_hash. Otherwise, just return the value
|
209
|
+
# @param [Object] value Any valid value
|
210
|
+
# @return [Hash] Returns the value in the form of hash
|
211
|
+
def _to_hash(value)
|
212
|
+
if value.is_a?(Array)
|
213
|
+
value.compact.map { |v| _to_hash(v) }
|
214
|
+
elsif value.is_a?(Hash)
|
215
|
+
{}.tap do |hash|
|
216
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
217
|
+
end
|
218
|
+
elsif value.respond_to? :to_hash
|
219
|
+
value.to_hash
|
220
|
+
else
|
221
|
+
value
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
end
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -18,6 +18,8 @@ require 'snaptrade/configuration'
|
|
18
18
|
|
19
19
|
# Models
|
20
20
|
require 'snaptrade/models/account'
|
21
|
+
require 'snaptrade/models/account_balance'
|
22
|
+
require 'snaptrade/models/account_balance_total'
|
21
23
|
require 'snaptrade/models/account_holdings'
|
22
24
|
require 'snaptrade/models/account_holdings_account'
|
23
25
|
require 'snaptrade/models/account_order_record'
|
@@ -25,6 +27,7 @@ require 'snaptrade/models/account_order_record_status'
|
|
25
27
|
require 'snaptrade/models/account_simple'
|
26
28
|
require 'snaptrade/models/account_sync_status'
|
27
29
|
require 'snaptrade/models/action'
|
30
|
+
require 'snaptrade/models/amount'
|
28
31
|
require 'snaptrade/models/auth_type'
|
29
32
|
require 'snaptrade/models/authentication_login_snap_trade_user200_response'
|
30
33
|
require 'snaptrade/models/balance'
|
@@ -69,13 +69,14 @@ describe 'AccountInformationApi' do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
# unit tests for get_user_account_orders
|
72
|
-
#
|
72
|
+
# List account orders
|
73
73
|
# Fetch all recent orders from a user's account.
|
74
74
|
# @param user_id
|
75
75
|
# @param user_secret
|
76
76
|
# @param account_id The ID of the account to get orders.
|
77
77
|
# @param [Hash] opts the optional parameters
|
78
78
|
# @option opts [String] :state defaults value is set to \"all\"
|
79
|
+
# @option opts [Integer] :days Number of days in the past to fetch the most recent orders. Defaults to the last 90 days if no value is passed in.
|
79
80
|
# @return [Array<AccountOrderRecord>]
|
80
81
|
describe 'get_user_account_orders test' do
|
81
82
|
it 'should work' do
|
@@ -0,0 +1,30 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'spec_helper'
|
12
|
+
require 'json'
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
# Unit tests for SnapTrade::AccountBalance
|
16
|
+
describe SnapTrade::AccountBalance do
|
17
|
+
let(:instance) { SnapTrade::AccountBalance.new }
|
18
|
+
|
19
|
+
describe 'test an instance of AccountBalance' do
|
20
|
+
it 'should create an instance of AccountBalance' do
|
21
|
+
expect(instance).to be_instance_of(SnapTrade::AccountBalance)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
describe 'test attribute "total"' do
|
25
|
+
it 'should work' do
|
26
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'spec_helper'
|
12
|
+
require 'json'
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
# Unit tests for SnapTrade::AccountBalanceTotal
|
16
|
+
describe SnapTrade::AccountBalanceTotal do
|
17
|
+
let(:instance) { SnapTrade::AccountBalanceTotal.new }
|
18
|
+
|
19
|
+
describe 'test an instance of AccountBalanceTotal' do
|
20
|
+
it 'should create an instance of AccountBalanceTotal' do
|
21
|
+
expect(instance).to be_instance_of(SnapTrade::AccountBalanceTotal)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
describe 'test attribute "amount"' do
|
25
|
+
it 'should work' do
|
26
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test attribute "currency"' do
|
31
|
+
it 'should work' do
|
32
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/spec/models/account_spec.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'spec_helper'
|
12
|
+
require 'json'
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
# Unit tests for SnapTrade::Amount
|
16
|
+
describe SnapTrade::Amount do
|
17
|
+
let(:instance) { SnapTrade::Amount.new }
|
18
|
+
|
19
|
+
describe 'test an instance of Amount' do
|
20
|
+
it 'should create an instance of Amount' do
|
21
|
+
expect(instance).to be_instance_of(SnapTrade::Amount)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
describe 'test attribute "amount"' do
|
25
|
+
it 'should work' do
|
26
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test attribute "currency"' do
|
31
|
+
it 'should work' do
|
32
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
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: 1.17.
|
4
|
+
version: 1.17.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -83,6 +83,8 @@ files:
|
|
83
83
|
- Rakefile
|
84
84
|
- docs/APIStatusApi.md
|
85
85
|
- docs/Account.md
|
86
|
+
- docs/AccountBalance.md
|
87
|
+
- docs/AccountBalanceTotal.md
|
86
88
|
- docs/AccountHoldings.md
|
87
89
|
- docs/AccountHoldingsAccount.md
|
88
90
|
- docs/AccountInformationApi.md
|
@@ -91,6 +93,7 @@ files:
|
|
91
93
|
- docs/AccountSimple.md
|
92
94
|
- docs/AccountSyncStatus.md
|
93
95
|
- docs/Action.md
|
96
|
+
- docs/Amount.md
|
94
97
|
- docs/AuthType.md
|
95
98
|
- docs/AuthenticationApi.md
|
96
99
|
- docs/AuthenticationLoginSnapTradeUser200Response.md
|
@@ -232,6 +235,8 @@ files:
|
|
232
235
|
- lib/snaptrade/api_error.rb
|
233
236
|
- lib/snaptrade/configuration.rb
|
234
237
|
- lib/snaptrade/models/account.rb
|
238
|
+
- lib/snaptrade/models/account_balance.rb
|
239
|
+
- lib/snaptrade/models/account_balance_total.rb
|
235
240
|
- lib/snaptrade/models/account_holdings.rb
|
236
241
|
- lib/snaptrade/models/account_holdings_account.rb
|
237
242
|
- lib/snaptrade/models/account_order_record.rb
|
@@ -239,6 +244,7 @@ files:
|
|
239
244
|
- lib/snaptrade/models/account_simple.rb
|
240
245
|
- lib/snaptrade/models/account_sync_status.rb
|
241
246
|
- lib/snaptrade/models/action.rb
|
247
|
+
- lib/snaptrade/models/amount.rb
|
242
248
|
- lib/snaptrade/models/auth_type.rb
|
243
249
|
- lib/snaptrade/models/authentication_login_snap_trade_user200_response.rb
|
244
250
|
- lib/snaptrade/models/balance.rb
|
@@ -371,6 +377,8 @@ files:
|
|
371
377
|
- spec/api_client_spec.rb
|
372
378
|
- spec/configuration_spec.rb
|
373
379
|
- spec/getting_started_spec.rb
|
380
|
+
- spec/models/account_balance_spec.rb
|
381
|
+
- spec/models/account_balance_total_spec.rb
|
374
382
|
- spec/models/account_holdings_account_spec.rb
|
375
383
|
- spec/models/account_holdings_spec.rb
|
376
384
|
- spec/models/account_order_record_spec.rb
|
@@ -379,6 +387,7 @@ files:
|
|
379
387
|
- spec/models/account_spec.rb
|
380
388
|
- spec/models/account_sync_status_spec.rb
|
381
389
|
- spec/models/action_spec.rb
|
390
|
+
- spec/models/amount_spec.rb
|
382
391
|
- spec/models/auth_type_spec.rb
|
383
392
|
- spec/models/authentication_login_snap_trade_user200_response_spec.rb
|
384
393
|
- spec/models/balance_spec.rb
|
@@ -560,6 +569,7 @@ test_files:
|
|
560
569
|
- spec/models/trading_place_oco_order_request_spec.rb
|
561
570
|
- spec/models/monthly_dividends_spec.rb
|
562
571
|
- spec/models/model_portfolio_security_spec.rb
|
572
|
+
- spec/models/account_balance_total_spec.rb
|
563
573
|
- spec/models/strategy_order_place_spec.rb
|
564
574
|
- spec/models/model_asset_class_target_spec.rb
|
565
575
|
- spec/models/option_strategy_spec.rb
|
@@ -598,6 +608,7 @@ test_files:
|
|
598
608
|
- spec/models/redirect_tokenand_pin_spec.rb
|
599
609
|
- spec/models/type_spec.rb
|
600
610
|
- spec/models/model403_failed_request_response_spec.rb
|
611
|
+
- spec/models/amount_spec.rb
|
601
612
|
- spec/models/account_holdings_spec.rb
|
602
613
|
- spec/models/snap_trade_holdings_account_account_id_spec.rb
|
603
614
|
- spec/models/trade_execution_status_action_spec.rb
|
@@ -624,6 +635,7 @@ test_files:
|
|
624
635
|
- spec/models/snap_trade_register_user_request_body_spec.rb
|
625
636
|
- spec/models/options_symbol_spec.rb
|
626
637
|
- spec/models/options_place_option_strategy_request_spec.rb
|
638
|
+
- spec/models/account_balance_spec.rb
|
627
639
|
- spec/models/action_spec.rb
|
628
640
|
- spec/models/options_get_option_strategy_request_spec.rb
|
629
641
|
- spec/models/currency_spec.rb
|