snaptrade 2.0.29 โ 2.0.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +15 -15
- data/lib/snaptrade/api/account_information_api.rb +22 -22
- data/lib/snaptrade/api/authentication_api.rb +10 -10
- data/lib/snaptrade/api/connections_api.rb +4 -4
- data/lib/snaptrade/api/trading_api.rb +4 -4
- data/lib/snaptrade/models/account_balance.rb +1 -1
- data/lib/snaptrade/models/account_balance_total.rb +2 -0
- data/lib/snaptrade/models/account_holdings_account.rb +5 -1
- data/lib/snaptrade/models/amount.rb +2 -0
- data/lib/snaptrade/models/balance.rb +3 -1
- data/lib/snaptrade/models/currency.rb +4 -1
- data/lib/snaptrade/models/options_position.rb +4 -3
- data/lib/snaptrade/models/options_position_currency.rb +3 -0
- data/lib/snaptrade/models/position.rb +6 -4
- data/lib/snaptrade/models/snap_trade_holdings_account_account_id.rb +11 -3
- data/lib/snaptrade/models/snap_trade_holdings_total_value.rb +3 -1
- data/lib/snaptrade/models/snap_trade_login_user_request_body.rb +2 -2
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +0 -1
- data/spec/api/account_information_api_spec.rb +4 -4
- data/spec/api/authentication_api_spec.rb +1 -1
- data/spec/api/connections_api_spec.rb +1 -1
- data/spec/api/trading_api_spec.rb +1 -1
- metadata +2 -5
- data/lib/snaptrade/models/options_holdings.rb +0 -267
- data/spec/models/options_holdings_spec.rb +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4473f0d7f5cc9ca2466287af5c01b2d7eb3a32f20bb08407b5192c4f43d1bde5
|
4
|
+
data.tar.gz: 95e42f51f88e79ccc23e880f96075ff27904bacaf355b31ab2ed656d7a3c11b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a9684055202d8e628a2411cb281e854e54ee10a129b382eccccce0319357b8df46240646466406d57a2e9d0704406f177b453e85f2d416b3a63c1ee84b76fbe
|
7
|
+
data.tar.gz: a8f50d47809964ba63c21f15ce16f5265495973ceced0c85fb1fae94a85c8b6605ed7b86f5df5b370e76f7b77a57c54606e354e53058a21a9293d0ff227eb55c
|
data/Gemfile.lock
CHANGED
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.31-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.31)
|
10
10
|
[![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -70,7 +70,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
70
70
|
Add to Gemfile:
|
71
71
|
|
72
72
|
```ruby
|
73
|
-
gem 'snaptrade', '~> 2.0.
|
73
|
+
gem 'snaptrade', '~> 2.0.31'
|
74
74
|
```
|
75
75
|
|
76
76
|
## Getting Started<a id="getting-started"></a>
|
@@ -112,8 +112,10 @@ p.result[3] # [Faraday::Response] Raw HTTP response
|
|
112
112
|
### `snaptrade.account_information.get_all_user_holdings`<a id="snaptradeaccount_informationget_all_user_holdings"></a>
|
113
113
|
![Deprecated](https://img.shields.io/badge/deprecated-yellow)
|
114
114
|
|
115
|
-
|
116
|
-
|
115
|
+
**Deprecated, please use the account-specific holdings endpoint instead.**
|
116
|
+
|
117
|
+
List all accounts for the user, plus balances, positions, and orders for each
|
118
|
+
account.
|
117
119
|
|
118
120
|
|
119
121
|
#### ๐ ๏ธ Usage<a id="๐ ๏ธ-usage"></a>
|
@@ -301,9 +303,7 @@ The ID of the account to get positions.
|
|
301
303
|
|
302
304
|
### `snaptrade.account_information.get_user_holdings`<a id="snaptradeaccount_informationget_user_holdings"></a>
|
303
305
|
|
304
|
-
Lists balances, positions and orders for the specified account
|
305
|
-
option_positions and account metadata. The data returned is similar to the
|
306
|
-
data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
306
|
+
Lists balances, positions, option 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.__
|
307
307
|
|
308
308
|
|
309
309
|
#### ๐ ๏ธ Usage<a id="๐ ๏ธ-usage"></a>
|
@@ -320,8 +320,6 @@ p result
|
|
320
320
|
#### โ๏ธ Parameters<a id="โ๏ธ-parameters"></a>
|
321
321
|
|
322
322
|
##### account_id: `String`<a id="account_id-string"></a>
|
323
|
-
The ID of the account to fetch holdings for.
|
324
|
-
|
325
323
|
##### user_id: `String`<a id="user_id-string"></a>
|
326
324
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
327
325
|
#### ๐ Return<a id="๐-return"></a>
|
@@ -501,7 +499,9 @@ p result
|
|
501
499
|
##### user_id: `String`<a id="user_id-string"></a>
|
502
500
|
##### user_secret: `String`<a id="user_secret-string"></a>
|
503
501
|
##### broker: `String`<a id="broker-string"></a>
|
504
|
-
Slug of the brokerage to connect the user to
|
502
|
+
Slug of the brokerage to connect the user to. See [this
|
503
|
+
document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead)
|
504
|
+
for a list of supported brokerages and their slugs.
|
505
505
|
|
506
506
|
##### immediateRedirect: `Boolean`<a id="immediateredirect-boolean"></a>
|
507
507
|
When set to True, user will be redirected back to the partner's site instead of
|
@@ -519,7 +519,7 @@ Accountsโ for more information.
|
|
519
519
|
Sets whether the connection should be read or trade
|
520
520
|
|
521
521
|
##### connectionPortalVersion: [`ConnectionPortalVersion`](./lib/snaptrade/models/connection_portal_version.rb)<a id="connectionportalversion-connectionportalversionlibsnaptrademodelsconnection_portal_versionrb"></a>
|
522
|
-
Sets the version of the connection portal to render, with a default to '
|
522
|
+
Sets the version of the connection portal to render, with a default to 'v3'
|
523
523
|
|
524
524
|
#### ๐ Return<a id="๐-return"></a>
|
525
525
|
|
@@ -536,8 +536,8 @@ Sets the version of the connection portal to render, with a default to 'v2'
|
|
536
536
|
|
537
537
|
### `snaptrade.authentication.register_snap_trade_user`<a id="snaptradeauthenticationregister_snap_trade_user"></a>
|
538
538
|
|
539
|
-
Registers a new SnapTrade user under your ClientID.
|
540
|
-
Most SnapTrade operations require a user to be passed as a parameter.
|
539
|
+
Registers a new SnapTrade user under your ClientID. A user secret will be automatically generated for you and must be properly stored in your database.
|
540
|
+
Most SnapTrade operations require a user ID and user secret to be passed as a parameter.
|
541
541
|
|
542
542
|
|
543
543
|
#### ๐ ๏ธ Usage<a id="๐ ๏ธ-usage"></a>
|
@@ -714,7 +714,7 @@ p result
|
|
714
714
|
|
715
715
|
### `snaptrade.connections.refresh_brokerage_authorization`<a id="snaptradeconnectionsrefresh_brokerage_authorization"></a>
|
716
716
|
|
717
|
-
Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes
|
717
|
+
Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes. Please contact support for access as this endpoint is not enabled by default
|
718
718
|
|
719
719
|
#### ๐ ๏ธ Usage<a id="๐ ๏ธ-usage"></a>
|
720
720
|
|
@@ -1441,7 +1441,7 @@ Canceled
|
|
1441
1441
|
|
1442
1442
|
### `snaptrade.trading.get_user_account_quotes`<a id="snaptradetradingget_user_account_quotes"></a>
|
1443
1443
|
|
1444
|
-
Returns
|
1444
|
+
Returns quote(s) from the brokerage for the specified symbol(s).
|
1445
1445
|
|
1446
1446
|
#### ๐ ๏ธ Usage<a id="๐ ๏ธ-usage"></a>
|
1447
1447
|
|
@@ -19,8 +19,10 @@ module SnapTrade
|
|
19
19
|
|
20
20
|
# List all accounts for the user, plus balances, positions, and orders for each account.
|
21
21
|
#
|
22
|
-
#
|
23
|
-
#
|
22
|
+
# **Deprecated, please use the account-specific holdings endpoint instead.**
|
23
|
+
#
|
24
|
+
# List all accounts for the user, plus balances, positions, and orders for each
|
25
|
+
# account.
|
24
26
|
#
|
25
27
|
# @param user_id [String]
|
26
28
|
# @param user_secret [String]
|
@@ -34,8 +36,10 @@ module SnapTrade
|
|
34
36
|
|
35
37
|
# List all accounts for the user, plus balances, positions, and orders for each account.
|
36
38
|
#
|
37
|
-
#
|
38
|
-
#
|
39
|
+
# **Deprecated, please use the account-specific holdings endpoint instead.**
|
40
|
+
#
|
41
|
+
# List all accounts for the user, plus balances, positions, and orders for each
|
42
|
+
# account.
|
39
43
|
#
|
40
44
|
# @param user_id [String]
|
41
45
|
# @param user_secret [String]
|
@@ -47,7 +51,7 @@ module SnapTrade
|
|
47
51
|
end
|
48
52
|
|
49
53
|
# List all accounts for the user, plus balances, positions, and orders for each account.
|
50
|
-
#
|
54
|
+
# **Deprecated, please use the account-specific holdings endpoint instead.** List all accounts for the user, plus balances, positions, and orders for each account.
|
51
55
|
# @param user_id [String]
|
52
56
|
# @param user_secret [String]
|
53
57
|
# @param [Hash] opts the optional parameters
|
@@ -59,7 +63,7 @@ module SnapTrade
|
|
59
63
|
end
|
60
64
|
|
61
65
|
# List all accounts for the user, plus balances, positions, and orders for each account.
|
62
|
-
#
|
66
|
+
# **Deprecated, please use the account-specific holdings endpoint instead.** List all accounts for the user, plus balances, positions, and orders for each account.
|
63
67
|
# @param user_id [String]
|
64
68
|
# @param user_secret [String]
|
65
69
|
# @param [Hash] opts the optional parameters
|
@@ -557,13 +561,11 @@ module SnapTrade
|
|
557
561
|
end
|
558
562
|
|
559
563
|
|
560
|
-
# List
|
564
|
+
# List account holdings
|
561
565
|
#
|
562
|
-
# Lists balances, positions and orders for the specified account
|
563
|
-
# option_positions and account metadata. The data returned is similar to the
|
564
|
-
# data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
566
|
+
# Lists balances, positions, option 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.__
|
565
567
|
#
|
566
|
-
# @param account_id [String]
|
568
|
+
# @param account_id [String]
|
567
569
|
# @param user_id [String]
|
568
570
|
# @param user_secret [String]
|
569
571
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -572,13 +574,11 @@ module SnapTrade
|
|
572
574
|
data
|
573
575
|
end
|
574
576
|
|
575
|
-
# List
|
577
|
+
# List account holdings
|
576
578
|
#
|
577
|
-
# Lists balances, positions and orders for the specified account
|
578
|
-
# option_positions and account metadata. The data returned is similar to the
|
579
|
-
# data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
|
579
|
+
# Lists balances, positions, option 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.__
|
580
580
|
#
|
581
|
-
# @param account_id [String]
|
581
|
+
# @param account_id [String]
|
582
582
|
# @param user_id [String]
|
583
583
|
# @param user_secret [String]
|
584
584
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
@@ -586,9 +586,9 @@ module SnapTrade
|
|
586
586
|
get_user_holdings_with_http_info_impl(account_id, user_id, user_secret, extra)
|
587
587
|
end
|
588
588
|
|
589
|
-
# List
|
590
|
-
# Lists balances, positions and orders for the specified account
|
591
|
-
# @param account_id [String]
|
589
|
+
# List account holdings
|
590
|
+
# Lists balances, positions, option 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.__
|
591
|
+
# @param account_id [String]
|
592
592
|
# @param user_id [String]
|
593
593
|
# @param user_secret [String]
|
594
594
|
# @param [Hash] opts the optional parameters
|
@@ -598,9 +598,9 @@ module SnapTrade
|
|
598
598
|
data
|
599
599
|
end
|
600
600
|
|
601
|
-
# List
|
602
|
-
# Lists balances, positions and orders for the specified account
|
603
|
-
# @param account_id [String]
|
601
|
+
# List account holdings
|
602
|
+
# Lists balances, positions, option 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.__
|
603
|
+
# @param account_id [String]
|
604
604
|
# @param user_id [String]
|
605
605
|
# @param user_secret [String]
|
606
606
|
# @param [Hash] opts the optional parameters
|
@@ -186,12 +186,12 @@ module SnapTrade
|
|
186
186
|
#
|
187
187
|
# @param user_id [String]
|
188
188
|
# @param user_secret [String]
|
189
|
-
# @param broker [String] Slug of the brokerage to connect the user to
|
189
|
+
# @param broker [String] Slug of the brokerage to connect the user to. See [this document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead) for a list of supported brokerages and their slugs.
|
190
190
|
# @param immediate_redirect [Boolean] When set to True, user will be redirected back to the partner's site instead of the connection portal
|
191
191
|
# @param custom_redirect [String] URL to redirect the user to after the user connects their brokerage account
|
192
192
|
# @param reconnect [String] The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See โReconnecting Accountsโ for more information.
|
193
193
|
# @param connection_type [ConnectionType] Sets whether the connection should be read or trade
|
194
|
-
# @param connection_portal_version [ConnectionPortalVersion] Sets the version of the connection portal to render, with a default to '
|
194
|
+
# @param connection_portal_version [ConnectionPortalVersion] Sets the version of the connection portal to render, with a default to 'v3'
|
195
195
|
# @param body [SnapTradeLoginUserRequestBody]
|
196
196
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
197
197
|
def login_snap_trade_user(user_id:, user_secret:, broker: SENTINEL, immediate_redirect: SENTINEL, custom_redirect: SENTINEL, reconnect: SENTINEL, connection_type: SENTINEL, connection_portal_version: SENTINEL, extra: {})
|
@@ -213,12 +213,12 @@ module SnapTrade
|
|
213
213
|
#
|
214
214
|
# @param user_id [String]
|
215
215
|
# @param user_secret [String]
|
216
|
-
# @param broker [String] Slug of the brokerage to connect the user to
|
216
|
+
# @param broker [String] Slug of the brokerage to connect the user to. See [this document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead) for a list of supported brokerages and their slugs.
|
217
217
|
# @param immediate_redirect [Boolean] When set to True, user will be redirected back to the partner's site instead of the connection portal
|
218
218
|
# @param custom_redirect [String] URL to redirect the user to after the user connects their brokerage account
|
219
219
|
# @param reconnect [String] The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See โReconnecting Accountsโ for more information.
|
220
220
|
# @param connection_type [ConnectionType] Sets whether the connection should be read or trade
|
221
|
-
# @param connection_portal_version [ConnectionPortalVersion] Sets the version of the connection portal to render, with a default to '
|
221
|
+
# @param connection_portal_version [ConnectionPortalVersion] Sets the version of the connection portal to render, with a default to 'v3'
|
222
222
|
# @param body [SnapTradeLoginUserRequestBody]
|
223
223
|
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
224
224
|
def login_snap_trade_user_with_http_info(user_id:, user_secret:, broker: SENTINEL, immediate_redirect: SENTINEL, custom_redirect: SENTINEL, reconnect: SENTINEL, connection_type: SENTINEL, connection_portal_version: SENTINEL, extra: {})
|
@@ -314,8 +314,8 @@ module SnapTrade
|
|
314
314
|
|
315
315
|
# Create SnapTrade user
|
316
316
|
#
|
317
|
-
# Registers a new SnapTrade user under your ClientID.
|
318
|
-
# Most SnapTrade operations require a user to be passed as a parameter.
|
317
|
+
# Registers a new SnapTrade user under your ClientID. A user secret will be automatically generated for you and must be properly stored in your database.
|
318
|
+
# Most SnapTrade operations require a user ID and user secret to be passed as a parameter.
|
319
319
|
#
|
320
320
|
# @param user_id [String] SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
321
321
|
# @param body [SnapTradeRegisterUserRequestBody]
|
@@ -330,8 +330,8 @@ module SnapTrade
|
|
330
330
|
|
331
331
|
# Create SnapTrade user
|
332
332
|
#
|
333
|
-
# Registers a new SnapTrade user under your ClientID.
|
334
|
-
# Most SnapTrade operations require a user to be passed as a parameter.
|
333
|
+
# Registers a new SnapTrade user under your ClientID. A user secret will be automatically generated for you and must be properly stored in your database.
|
334
|
+
# Most SnapTrade operations require a user ID and user secret to be passed as a parameter.
|
335
335
|
#
|
336
336
|
# @param user_id [String] SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
|
337
337
|
# @param body [SnapTradeRegisterUserRequestBody]
|
@@ -344,7 +344,7 @@ module SnapTrade
|
|
344
344
|
end
|
345
345
|
|
346
346
|
# Create SnapTrade user
|
347
|
-
# Registers a new SnapTrade user under your ClientID. Most SnapTrade operations require a user to be passed as a parameter.
|
347
|
+
# Registers a new SnapTrade user under your ClientID. A user secret will be automatically generated for you and must be properly stored in your database. Most SnapTrade operations require a user ID and user secret to be passed as a parameter.
|
348
348
|
# @param snap_trade_register_user_request_body [SnapTradeRegisterUserRequestBody]
|
349
349
|
# @param [Hash] opts the optional parameters
|
350
350
|
# @return [UserIDandSecret]
|
@@ -354,7 +354,7 @@ module SnapTrade
|
|
354
354
|
end
|
355
355
|
|
356
356
|
# Create SnapTrade user
|
357
|
-
# Registers a new SnapTrade user under your ClientID. Most SnapTrade operations require a user to be passed as a parameter.
|
357
|
+
# Registers a new SnapTrade user under your ClientID. A user secret will be automatically generated for you and must be properly stored in your database. Most SnapTrade operations require a user ID and user secret to be passed as a parameter.
|
358
358
|
# @param snap_trade_register_user_request_body [SnapTradeRegisterUserRequestBody]
|
359
359
|
# @param [Hash] opts the optional parameters
|
360
360
|
# @return [Array<(UserIDandSecret, Integer, Hash)>] UserIDandSecret data, response status code and response headers
|
@@ -320,7 +320,7 @@ module SnapTrade
|
|
320
320
|
|
321
321
|
# Refresh holdings for a connection
|
322
322
|
#
|
323
|
-
# Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes
|
323
|
+
# Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes. Please contact support for access as this endpoint is not enabled by default
|
324
324
|
#
|
325
325
|
# @param authorization_id [String] The ID of a brokerage authorization object.
|
326
326
|
# @param user_id [String]
|
@@ -333,7 +333,7 @@ module SnapTrade
|
|
333
333
|
|
334
334
|
# Refresh holdings for a connection
|
335
335
|
#
|
336
|
-
# Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes
|
336
|
+
# Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes. Please contact support for access as this endpoint is not enabled by default
|
337
337
|
#
|
338
338
|
# @param authorization_id [String] The ID of a brokerage authorization object.
|
339
339
|
# @param user_id [String]
|
@@ -344,7 +344,7 @@ module SnapTrade
|
|
344
344
|
end
|
345
345
|
|
346
346
|
# Refresh holdings for a connection
|
347
|
-
# Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes
|
347
|
+
# Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes. Please contact support for access as this endpoint is not enabled by default
|
348
348
|
# @param authorization_id [String] The ID of a brokerage authorization object.
|
349
349
|
# @param user_id [String]
|
350
350
|
# @param user_secret [String]
|
@@ -356,7 +356,7 @@ module SnapTrade
|
|
356
356
|
end
|
357
357
|
|
358
358
|
# Refresh holdings for a connection
|
359
|
-
# Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes
|
359
|
+
# Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes. Please contact support for access as this endpoint is not enabled by default
|
360
360
|
# @param authorization_id [String] The ID of a brokerage authorization object.
|
361
361
|
# @param user_id [String]
|
362
362
|
# @param user_secret [String]
|
@@ -293,7 +293,7 @@ module SnapTrade
|
|
293
293
|
|
294
294
|
# Get symbol quotes
|
295
295
|
#
|
296
|
-
# Returns
|
296
|
+
# Returns quote(s) from the brokerage for the specified symbol(s).
|
297
297
|
#
|
298
298
|
# @param user_id [String]
|
299
299
|
# @param user_secret [String]
|
@@ -309,7 +309,7 @@ module SnapTrade
|
|
309
309
|
|
310
310
|
# Get symbol quotes
|
311
311
|
#
|
312
|
-
# Returns
|
312
|
+
# Returns quote(s) from the brokerage for the specified symbol(s).
|
313
313
|
#
|
314
314
|
# @param user_id [String]
|
315
315
|
# @param user_secret [String]
|
@@ -323,7 +323,7 @@ module SnapTrade
|
|
323
323
|
end
|
324
324
|
|
325
325
|
# Get symbol quotes
|
326
|
-
# Returns
|
326
|
+
# Returns quote(s) from the brokerage for the specified symbol(s).
|
327
327
|
# @param user_id [String]
|
328
328
|
# @param user_secret [String]
|
329
329
|
# @param symbols [String] List of universal_symbol_id or tickers to get quotes for.
|
@@ -337,7 +337,7 @@ module SnapTrade
|
|
337
337
|
end
|
338
338
|
|
339
339
|
# Get symbol quotes
|
340
|
-
# Returns
|
340
|
+
# Returns quote(s) from the brokerage for the specified symbol(s).
|
341
341
|
# @param user_id [String]
|
342
342
|
# @param user_secret [String]
|
343
343
|
# @param symbols [String] List of universal_symbol_id or tickers to get quotes for.
|
@@ -13,8 +13,10 @@ require 'time'
|
|
13
13
|
module SnapTrade
|
14
14
|
# Total value of this account (includes cash, equity, fixed income, etc)
|
15
15
|
class AccountBalanceTotal
|
16
|
+
# Total value denominated in the currency of the `currency` field.
|
16
17
|
attr_accessor :amount
|
17
18
|
|
19
|
+
# The ISO-4217 currency code for the amount.
|
18
20
|
attr_accessor :currency
|
19
21
|
|
20
22
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -11,16 +11,20 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
#
|
14
|
+
# A wrapper object containing holdings information for a single account
|
15
15
|
class AccountHoldingsAccount
|
16
16
|
attr_accessor :account
|
17
17
|
|
18
|
+
# List of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade [allows holding multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances).
|
18
19
|
attr_accessor :balances
|
19
20
|
|
21
|
+
# List of stock/ETF/crypto/mutual fund positions in the account.
|
20
22
|
attr_accessor :positions
|
21
23
|
|
24
|
+
# List of option positions in the account.
|
22
25
|
attr_accessor :option_positions
|
23
26
|
|
27
|
+
# List of recent orders in the account, including both pending and executed orders.
|
24
28
|
attr_accessor :orders
|
25
29
|
|
26
30
|
attr_accessor :total_value
|
@@ -13,8 +13,10 @@ require 'time'
|
|
13
13
|
module SnapTrade
|
14
14
|
# Total value of the account, as reported by the brokerage
|
15
15
|
class Amount
|
16
|
+
# Total value denominated in the currency of the `currency` field.
|
16
17
|
attr_accessor :amount
|
17
18
|
|
19
|
+
# The ISO-4217 currency code for the amount.
|
18
20
|
attr_accessor :currency
|
19
21
|
|
20
22
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -11,12 +11,14 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
#
|
14
|
+
# Holds balance information for a single currency in an account.
|
15
15
|
class Balance
|
16
16
|
attr_accessor :currency
|
17
17
|
|
18
|
+
# The amount of available cash in the account denominated in the currency of the `currency` field.
|
18
19
|
attr_accessor :cash
|
19
20
|
|
21
|
+
# Buying power only applies to margin accounts. For non-margin accounts, buying power should be the same as cash. Please note that this field is not always available for all brokerages.
|
20
22
|
attr_accessor :buying_power
|
21
23
|
|
22
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -11,12 +11,15 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
#
|
14
|
+
# Describes a currency object.
|
15
15
|
class Currency
|
16
|
+
# Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade.
|
16
17
|
attr_accessor :id
|
17
18
|
|
19
|
+
# The ISO-4217 currency code for the currency.
|
18
20
|
attr_accessor :code
|
19
21
|
|
22
|
+
# A human-friendly name of the currency.
|
20
23
|
attr_accessor :name
|
21
24
|
|
22
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -11,18 +11,19 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
#
|
14
|
+
# Describes a single option position in an account.
|
15
15
|
class OptionsPosition
|
16
16
|
attr_accessor :symbol
|
17
17
|
|
18
|
-
#
|
18
|
+
# Last known market price for the option contract. The freshness of this price depends on the brokerage. Some brokerages provide real-time prices, while others provide delayed prices. It is recommended that you rely on your own third-party market data provider for most up to date prices.
|
19
19
|
attr_accessor :price
|
20
20
|
|
21
|
+
# The number of contracts for this option position.
|
21
22
|
attr_accessor :units
|
22
23
|
|
23
24
|
attr_accessor :currency
|
24
25
|
|
25
|
-
#
|
26
|
+
# Cost basis _per contract_ of this option position. To get the cost basis _per share_, divide this value by the number of shares per contract (usually 100).
|
26
27
|
attr_accessor :average_purchase_price
|
27
28
|
|
28
29
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -12,10 +12,13 @@ require 'time'
|
|
12
12
|
|
13
13
|
module SnapTrade
|
14
14
|
class OptionsPositionCurrency
|
15
|
+
# Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade.
|
15
16
|
attr_accessor :id
|
16
17
|
|
18
|
+
# The ISO-4217 currency code for the currency.
|
17
19
|
attr_accessor :code
|
18
20
|
|
21
|
+
# A human-friendly name of the currency.
|
19
22
|
attr_accessor :name
|
20
23
|
|
21
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -11,21 +11,23 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
#
|
14
|
+
# Describes a single stock/ETF/crypto/mutual fund position in an account.
|
15
15
|
class Position
|
16
16
|
attr_accessor :symbol
|
17
17
|
|
18
|
+
# The number of shares of the position. This can be fractional or integer units.
|
18
19
|
attr_accessor :units
|
19
20
|
|
20
|
-
# Last known market price for the symbol
|
21
|
+
# Last known market price for the symbol. The freshness of this price depends on the brokerage. Some brokerages provide real-time prices, while others provide delayed prices. It is recommended that you rely on your own third-party market data provider for most up to date prices.
|
21
22
|
attr_accessor :price
|
22
23
|
|
24
|
+
# The profit or loss on the position since it was opened. This is calculated as the difference between the current market value of the position and the total cost of the position. It is recommended to calculate this value using the average purchase price and the current market price yourself, instead of relying on this field.
|
23
25
|
attr_accessor :open_pnl
|
24
26
|
|
25
|
-
# Deprecated, use the units field for both fractional and integer units going forward
|
27
|
+
# Deprecated, use the `units` field for both fractional and integer units going forward
|
26
28
|
attr_accessor :fractional_units
|
27
29
|
|
28
|
-
#
|
30
|
+
# Cost basis _per share_ of this position.
|
29
31
|
attr_accessor :average_purchase_price
|
30
32
|
|
31
33
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -11,27 +11,35 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
#
|
14
|
+
# A single brokerage account at a financial institution.
|
15
15
|
class SnapTradeHoldingsAccountAccountId
|
16
|
+
# Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
|
16
17
|
attr_accessor :id
|
17
18
|
|
19
|
+
# Unique identifier for the connection (brokerage authorization). This is the UUID used to reference the connection in SnapTrade.
|
18
20
|
attr_accessor :brokerage_authorization
|
19
21
|
|
22
|
+
# Portfolio Group ID. Portfolio Groups have been deprecated. Please contact support if you have a usecase for it.
|
20
23
|
attr_accessor :portfolio_group
|
21
24
|
|
25
|
+
# A display name for the account. Either assigned by the user or by the financial institution itself. For certain institutions, SnapTrade appends the institution name to the account name for clarity.
|
22
26
|
attr_accessor :name
|
23
27
|
|
28
|
+
# The account number assigned by the financial institution.
|
24
29
|
attr_accessor :number
|
25
30
|
|
31
|
+
# The name of the financial institution that holds the account.
|
26
32
|
attr_accessor :institution_name
|
27
33
|
|
28
34
|
attr_accessor :balance
|
29
35
|
|
36
|
+
# Additional information about the account, such as account type, status, etc. This information is specific to the financial institution and there's no standard format for this data. Please use at your own risk.
|
30
37
|
attr_accessor :meta
|
31
38
|
|
39
|
+
# This field is deprecated.
|
32
40
|
attr_accessor :cash_restrictions
|
33
41
|
|
34
|
-
#
|
42
|
+
# Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was created in SnapTrade. This is _not_ the account opening date at the financial institution.
|
35
43
|
attr_accessor :created_date
|
36
44
|
|
37
45
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -67,7 +75,7 @@ module SnapTrade
|
|
67
75
|
:'balance' => :'SnapTradeHoldingsAccountAccountIdBalance',
|
68
76
|
:'meta' => :'Hash<String, Object>',
|
69
77
|
:'cash_restrictions' => :'Array<CashRestriction>',
|
70
|
-
:'created_date' => :'
|
78
|
+
:'created_date' => :'Time'
|
71
79
|
}
|
72
80
|
end
|
73
81
|
|
@@ -11,10 +11,12 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
#
|
14
|
+
# The total market value of the account. Note that this field is calculated based on the sum of the values of account positions and cash balances known to SnapTrade. It may not be accurate if the brokerage account has holdings that SnapTrade is not aware of. For example, if the brokerage account holds assets that SnapTrade does not support, the total value may be underreported. To get the brokerage reported total market value of the account, refer to `account.balance.total`.
|
15
15
|
class SnapTradeHoldingsTotalValue
|
16
|
+
# Total value denominated in the currency of the `currency` field.
|
16
17
|
attr_accessor :value
|
17
18
|
|
19
|
+
# The ISO-4217 currency code for the amount.
|
18
20
|
attr_accessor :currency
|
19
21
|
|
20
22
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -13,7 +13,7 @@ require 'time'
|
|
13
13
|
module SnapTrade
|
14
14
|
# Data to login a user via SnapTrade Partner
|
15
15
|
class SnapTradeLoginUserRequestBody
|
16
|
-
# Slug of the brokerage to connect the user to
|
16
|
+
# Slug of the brokerage to connect the user to. See [this document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead) for a list of supported brokerages and their slugs.
|
17
17
|
attr_accessor :broker
|
18
18
|
|
19
19
|
# When set to True, user will be redirected back to the partner's site instead of the connection portal
|
@@ -28,7 +28,7 @@ module SnapTrade
|
|
28
28
|
# Sets whether the connection should be read or trade
|
29
29
|
attr_accessor :connection_type
|
30
30
|
|
31
|
-
# Sets the version of the connection portal to render, with a default to '
|
31
|
+
# Sets the version of the connection portal to render, with a default to 'v3'
|
32
32
|
attr_accessor :connection_portal_version
|
33
33
|
|
34
34
|
# Attribute mapping from ruby-style variable name to JSON key.
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -96,7 +96,6 @@ require 'snaptrade/models/option_strategy'
|
|
96
96
|
require 'snaptrade/models/option_strategy_legs_inner'
|
97
97
|
require 'snaptrade/models/option_type'
|
98
98
|
require 'snaptrade/models/options_get_option_strategy_request'
|
99
|
-
require 'snaptrade/models/options_holdings'
|
100
99
|
require 'snaptrade/models/options_place_option_strategy_request'
|
101
100
|
require 'snaptrade/models/options_position'
|
102
101
|
require 'snaptrade/models/options_position_currency'
|
@@ -29,7 +29,7 @@ describe 'AccountInformationApi' do
|
|
29
29
|
|
30
30
|
# unit tests for get_all_user_holdings
|
31
31
|
# List all accounts for the user, plus balances, positions, and orders for each account.
|
32
|
-
#
|
32
|
+
# **Deprecated, please use the account-specific holdings endpoint instead.** List all accounts for the user, plus balances, positions, and orders for each account.
|
33
33
|
# @param user_id
|
34
34
|
# @param user_secret
|
35
35
|
# @param [Hash] opts the optional parameters
|
@@ -100,9 +100,9 @@ describe 'AccountInformationApi' do
|
|
100
100
|
end
|
101
101
|
|
102
102
|
# unit tests for get_user_holdings
|
103
|
-
# List
|
104
|
-
# Lists balances, positions and orders for the specified account
|
105
|
-
# @param account_id
|
103
|
+
# List account holdings
|
104
|
+
# Lists balances, positions, option 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.__
|
105
|
+
# @param account_id
|
106
106
|
# @param user_id
|
107
107
|
# @param user_secret
|
108
108
|
# @param [Hash] opts the optional parameters
|
@@ -66,7 +66,7 @@ describe 'AuthenticationApi' do
|
|
66
66
|
|
67
67
|
# unit tests for register_snap_trade_user
|
68
68
|
# Create SnapTrade user
|
69
|
-
# Registers a new SnapTrade user under your ClientID. Most SnapTrade operations require a user to be passed as a parameter.
|
69
|
+
# Registers a new SnapTrade user under your ClientID. A user secret will be automatically generated for you and must be properly stored in your database. Most SnapTrade operations require a user ID and user secret to be passed as a parameter.
|
70
70
|
# @param snap_trade_register_user_request_body
|
71
71
|
# @param [Hash] opts the optional parameters
|
72
72
|
# @return [UserIDandSecret]
|
@@ -70,7 +70,7 @@ describe 'ConnectionsApi' do
|
|
70
70
|
|
71
71
|
# unit tests for refresh_brokerage_authorization
|
72
72
|
# Refresh holdings for a connection
|
73
|
-
# Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes
|
73
|
+
# Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes. Please contact support for access as this endpoint is not enabled by default
|
74
74
|
# @param authorization_id The ID of a brokerage authorization object.
|
75
75
|
# @param user_id
|
76
76
|
# @param user_secret
|
@@ -58,7 +58,7 @@ describe 'TradingApi' do
|
|
58
58
|
|
59
59
|
# unit tests for get_user_account_quotes
|
60
60
|
# Get symbol quotes
|
61
|
-
# Returns
|
61
|
+
# Returns quote(s) from the brokerage for the specified symbol(s).
|
62
62
|
# @param user_id
|
63
63
|
# @param user_secret
|
64
64
|
# @param symbols List of universal_symbol_id or tickers to get quotes for.
|
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.31
|
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
|
+
date: 2024-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -175,7 +175,6 @@ files:
|
|
175
175
|
- lib/snaptrade/models/option_strategy_legs_inner.rb
|
176
176
|
- lib/snaptrade/models/option_type.rb
|
177
177
|
- lib/snaptrade/models/options_get_option_strategy_request.rb
|
178
|
-
- lib/snaptrade/models/options_holdings.rb
|
179
178
|
- lib/snaptrade/models/options_place_option_strategy_request.rb
|
180
179
|
- lib/snaptrade/models/options_position.rb
|
181
180
|
- lib/snaptrade/models/options_position_currency.rb
|
@@ -329,7 +328,6 @@ files:
|
|
329
328
|
- spec/models/option_strategy_spec.rb
|
330
329
|
- spec/models/option_type_spec.rb
|
331
330
|
- spec/models/options_get_option_strategy_request_spec.rb
|
332
|
-
- spec/models/options_holdings_spec.rb
|
333
331
|
- spec/models/options_place_option_strategy_request_spec.rb
|
334
332
|
- spec/models/options_position_currency_spec.rb
|
335
333
|
- spec/models/options_position_spec.rb
|
@@ -494,7 +492,6 @@ test_files:
|
|
494
492
|
- spec/models/strategy_order_place_orders_inner_spec.rb
|
495
493
|
- spec/models/connection_type_spec.rb
|
496
494
|
- spec/models/strategy_order_record_status_spec.rb
|
497
|
-
- spec/models/options_holdings_spec.rb
|
498
495
|
- spec/models/redirect_tokenand_pin_spec.rb
|
499
496
|
- spec/models/type_spec.rb
|
500
497
|
- spec/models/model403_failed_request_response_spec.rb
|
@@ -1,267 +0,0 @@
|
|
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
|
-
# Option Holdings
|
15
|
-
class OptionsHoldings
|
16
|
-
# Options information
|
17
|
-
attr_accessor :id
|
18
|
-
|
19
|
-
attr_accessor :symbol
|
20
|
-
|
21
|
-
attr_accessor :option_symbol
|
22
|
-
|
23
|
-
# Trade Price if limit or stop limit order
|
24
|
-
attr_accessor :price
|
25
|
-
|
26
|
-
attr_accessor :currency
|
27
|
-
|
28
|
-
# Average purchase price for this position
|
29
|
-
attr_accessor :average_purchase_price
|
30
|
-
|
31
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
32
|
-
def self.attribute_map
|
33
|
-
{
|
34
|
-
:'id' => :'id',
|
35
|
-
:'symbol' => :'symbol',
|
36
|
-
:'option_symbol' => :'option_symbol',
|
37
|
-
:'price' => :'price',
|
38
|
-
:'currency' => :'currency',
|
39
|
-
:'average_purchase_price' => :'average_purchase_price'
|
40
|
-
}
|
41
|
-
end
|
42
|
-
|
43
|
-
# Returns all the JSON keys this model knows about
|
44
|
-
def self.acceptable_attributes
|
45
|
-
attribute_map.values
|
46
|
-
end
|
47
|
-
|
48
|
-
# Attribute type mapping.
|
49
|
-
def self.openapi_types
|
50
|
-
{
|
51
|
-
:'id' => :'String',
|
52
|
-
:'symbol' => :'String',
|
53
|
-
:'option_symbol' => :'OptionsSymbol',
|
54
|
-
:'price' => :'Float',
|
55
|
-
:'currency' => :'Currency',
|
56
|
-
:'average_purchase_price' => :'Float'
|
57
|
-
}
|
58
|
-
end
|
59
|
-
|
60
|
-
# List of attributes with nullable: true
|
61
|
-
def self.openapi_nullable
|
62
|
-
Set.new([
|
63
|
-
:'price',
|
64
|
-
:'average_purchase_price'
|
65
|
-
])
|
66
|
-
end
|
67
|
-
|
68
|
-
# Initializes the object
|
69
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
70
|
-
def initialize(attributes = {})
|
71
|
-
if (!attributes.is_a?(Hash))
|
72
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::OptionsHoldings` initialize method"
|
73
|
-
end
|
74
|
-
|
75
|
-
# check to see if the attribute exists and convert string to symbol for hash key
|
76
|
-
attributes = attributes.each_with_object({}) { |(k, v), h|
|
77
|
-
if (!self.class.attribute_map.key?(k.to_sym))
|
78
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::OptionsHoldings`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
79
|
-
end
|
80
|
-
h[k.to_sym] = v
|
81
|
-
}
|
82
|
-
|
83
|
-
if attributes.key?(:'id')
|
84
|
-
self.id = attributes[:'id']
|
85
|
-
end
|
86
|
-
|
87
|
-
if attributes.key?(:'symbol')
|
88
|
-
self.symbol = attributes[:'symbol']
|
89
|
-
end
|
90
|
-
|
91
|
-
if attributes.key?(:'option_symbol')
|
92
|
-
self.option_symbol = attributes[:'option_symbol']
|
93
|
-
end
|
94
|
-
|
95
|
-
if attributes.key?(:'price')
|
96
|
-
self.price = attributes[:'price']
|
97
|
-
end
|
98
|
-
|
99
|
-
if attributes.key?(:'currency')
|
100
|
-
self.currency = attributes[:'currency']
|
101
|
-
end
|
102
|
-
|
103
|
-
if attributes.key?(:'average_purchase_price')
|
104
|
-
self.average_purchase_price = attributes[:'average_purchase_price']
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
109
|
-
# @return Array for valid properties with the reasons
|
110
|
-
def list_invalid_properties
|
111
|
-
invalid_properties = Array.new
|
112
|
-
invalid_properties
|
113
|
-
end
|
114
|
-
|
115
|
-
# Check to see if the all the properties in the model are valid
|
116
|
-
# @return true if the model is valid
|
117
|
-
def valid?
|
118
|
-
true
|
119
|
-
end
|
120
|
-
|
121
|
-
# Checks equality by comparing each attribute.
|
122
|
-
# @param [Object] Object to be compared
|
123
|
-
def ==(o)
|
124
|
-
return true if self.equal?(o)
|
125
|
-
self.class == o.class &&
|
126
|
-
id == o.id &&
|
127
|
-
symbol == o.symbol &&
|
128
|
-
option_symbol == o.option_symbol &&
|
129
|
-
price == o.price &&
|
130
|
-
currency == o.currency &&
|
131
|
-
average_purchase_price == o.average_purchase_price
|
132
|
-
end
|
133
|
-
|
134
|
-
# @see the `==` method
|
135
|
-
# @param [Object] Object to be compared
|
136
|
-
def eql?(o)
|
137
|
-
self == o
|
138
|
-
end
|
139
|
-
|
140
|
-
# Calculates hash code according to all attributes.
|
141
|
-
# @return [Integer] Hash code
|
142
|
-
def hash
|
143
|
-
[id, symbol, option_symbol, price, currency, average_purchase_price].hash
|
144
|
-
end
|
145
|
-
|
146
|
-
# Builds the object from hash
|
147
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
148
|
-
# @return [Object] Returns the model itself
|
149
|
-
def self.build_from_hash(attributes)
|
150
|
-
new.build_from_hash(attributes)
|
151
|
-
end
|
152
|
-
|
153
|
-
# Builds the object from hash
|
154
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
155
|
-
# @return [Object] Returns the model itself
|
156
|
-
def build_from_hash(attributes)
|
157
|
-
return nil unless attributes.is_a?(Hash)
|
158
|
-
attributes = attributes.transform_keys(&:to_sym)
|
159
|
-
self.class.openapi_types.each_pair do |key, type|
|
160
|
-
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
161
|
-
self.send("#{key}=", nil)
|
162
|
-
elsif type =~ /\AArray<(.*)>/i
|
163
|
-
# check to ensure the input is an array given that the attribute
|
164
|
-
# is documented as an array but the input is not
|
165
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
166
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
167
|
-
end
|
168
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
169
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
self
|
174
|
-
end
|
175
|
-
|
176
|
-
# Deserializes the data based on type
|
177
|
-
# @param string type Data type
|
178
|
-
# @param string value Value to be deserialized
|
179
|
-
# @return [Object] Deserialized data
|
180
|
-
def _deserialize(type, value)
|
181
|
-
case type.to_sym
|
182
|
-
when :Time
|
183
|
-
Time.parse(value)
|
184
|
-
when :Date
|
185
|
-
Date.parse(value)
|
186
|
-
when :String
|
187
|
-
value.to_s
|
188
|
-
when :Integer
|
189
|
-
value.to_i
|
190
|
-
when :Float
|
191
|
-
value.to_f
|
192
|
-
when :Boolean
|
193
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
194
|
-
true
|
195
|
-
else
|
196
|
-
false
|
197
|
-
end
|
198
|
-
when :Object
|
199
|
-
# generic object (usually a Hash), return directly
|
200
|
-
value
|
201
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
202
|
-
inner_type = Regexp.last_match[:inner_type]
|
203
|
-
value.map { |v| _deserialize(inner_type, v) }
|
204
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
205
|
-
k_type = Regexp.last_match[:k_type]
|
206
|
-
v_type = Regexp.last_match[:v_type]
|
207
|
-
{}.tap do |hash|
|
208
|
-
value.each do |k, v|
|
209
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
210
|
-
end
|
211
|
-
end
|
212
|
-
else # model
|
213
|
-
# models (e.g. Pet) or oneOf
|
214
|
-
klass = SnapTrade.const_get(type)
|
215
|
-
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
# Returns the string representation of the object
|
220
|
-
# @return [String] String presentation of the object
|
221
|
-
def to_s
|
222
|
-
to_hash.to_s
|
223
|
-
end
|
224
|
-
|
225
|
-
# to_body is an alias to to_hash (backward compatibility)
|
226
|
-
# @return [Hash] Returns the object in the form of hash
|
227
|
-
def to_body
|
228
|
-
to_hash
|
229
|
-
end
|
230
|
-
|
231
|
-
# Returns the object in the form of hash
|
232
|
-
# @return [Hash] Returns the object in the form of hash
|
233
|
-
def to_hash
|
234
|
-
hash = {}
|
235
|
-
self.class.attribute_map.each_pair do |attr, param|
|
236
|
-
value = self.send(attr)
|
237
|
-
if value.nil?
|
238
|
-
is_nullable = self.class.openapi_nullable.include?(attr)
|
239
|
-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
240
|
-
end
|
241
|
-
|
242
|
-
hash[param] = _to_hash(value)
|
243
|
-
end
|
244
|
-
hash
|
245
|
-
end
|
246
|
-
|
247
|
-
# Outputs non-array value in the form of hash
|
248
|
-
# For object, use to_hash. Otherwise, just return the value
|
249
|
-
# @param [Object] value Any valid value
|
250
|
-
# @return [Hash] Returns the value in the form of hash
|
251
|
-
def _to_hash(value)
|
252
|
-
if value.is_a?(Array)
|
253
|
-
value.compact.map { |v| _to_hash(v) }
|
254
|
-
elsif value.is_a?(Hash)
|
255
|
-
{}.tap do |hash|
|
256
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
257
|
-
end
|
258
|
-
elsif value.respond_to? :to_hash
|
259
|
-
value.to_hash
|
260
|
-
else
|
261
|
-
value
|
262
|
-
end
|
263
|
-
end
|
264
|
-
|
265
|
-
end
|
266
|
-
|
267
|
-
end
|
@@ -1,59 +0,0 @@
|
|
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::OptionsHoldings
|
15
|
-
describe SnapTrade::OptionsHoldings do
|
16
|
-
let(:instance) { SnapTrade::OptionsHoldings.new }
|
17
|
-
|
18
|
-
describe 'test an instance of OptionsHoldings' do
|
19
|
-
it 'should create an instance of OptionsHoldings' do
|
20
|
-
expect(instance).to be_instance_of(SnapTrade::OptionsHoldings)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
describe 'test attribute "id"' do
|
24
|
-
it 'should work' do
|
25
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe 'test attribute "symbol"' do
|
30
|
-
it 'should work' do
|
31
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe 'test attribute "option_symbol"' do
|
36
|
-
it 'should work' do
|
37
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe 'test attribute "price"' do
|
42
|
-
it 'should work' do
|
43
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
describe 'test attribute "currency"' do
|
48
|
-
it 'should work' do
|
49
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe 'test attribute "average_purchase_price"' do
|
54
|
-
it 'should work' do
|
55
|
-
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|