snaptrade 2.0.182 → 2.0.184
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 +37 -2
- data/lib/snaptrade/api/experimental_endpoints_api.rb +103 -0
- data/lib/snaptrade/models/account.rb +12 -1
- data/lib/snaptrade/models/account_category.rb +38 -0
- data/lib/snaptrade/models/brokerage_authorization_transactions_sync_confirmation.rb +218 -0
- data/lib/snaptrade/models/transactions_status.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +2 -0
- data/spec/api/experimental_endpoints_api_spec.rb +14 -0
- data/spec/models/account_category_spec.rb +23 -0
- data/spec/models/account_spec.rb +6 -0
- data/spec/models/brokerage_authorization_transactions_sync_confirmation_spec.rb +29 -0
- metadata +8 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 103e29df611463df5d79c9c4cc67b032e9443e14cea4e3221ccda71e1dd5efb1
|
|
4
|
+
data.tar.gz: 05a8cc80097320d9ac15d82bf196266550462ad558c0ab577f75c17f80ea9d16
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8813a51c97da576469bce21f1109bb7e3a8bc7a9a2bb8d3b5aa392c46e56f6bd93c44b7c3475047d7d61f152a75fc7d26881cc0e87269736dbf9dd18ef62fd1f
|
|
7
|
+
data.tar.gz: 7bb0cf6ae9dd1aac3281a03834cc9ac06a77f7156df6d155656b6941b7620189d0f9f5df7426b8998eb6fa9ff30177b2075ff342ea0748c217b331dee2bb260c
|
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
|
-
[](https://rubygems.org/gems/snaptrade/versions/2.0.184)
|
|
10
10
|
[](https://snaptrade.com/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
@@ -49,6 +49,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
49
49
|
* [`snaptrade.experimental_endpoints.get_user_account_order_detail_v2`](#snaptradeexperimental_endpointsget_user_account_order_detail_v2)
|
|
50
50
|
* [`snaptrade.experimental_endpoints.get_user_account_orders_v2`](#snaptradeexperimental_endpointsget_user_account_orders_v2)
|
|
51
51
|
* [`snaptrade.experimental_endpoints.get_user_account_recent_orders_v2`](#snaptradeexperimental_endpointsget_user_account_recent_orders_v2)
|
|
52
|
+
* [`snaptrade.experimental_endpoints.sync_brokerage_authorization_transactions`](#snaptradeexperimental_endpointssync_brokerage_authorization_transactions)
|
|
52
53
|
* [`snaptrade.options.list_option_holdings`](#snaptradeoptionslist_option_holdings)
|
|
53
54
|
* [`snaptrade.reference_data.get_currency_exchange_rate_pair`](#snaptradereference_dataget_currency_exchange_rate_pair)
|
|
54
55
|
* [`snaptrade.reference_data.get_partner_info`](#snaptradereference_dataget_partner_info)
|
|
@@ -87,7 +88,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
|
87
88
|
Add to Gemfile:
|
|
88
89
|
|
|
89
90
|
```ruby
|
|
90
|
-
gem 'snaptrade', '~> 2.0.
|
|
91
|
+
gem 'snaptrade', '~> 2.0.184'
|
|
91
92
|
```
|
|
92
93
|
|
|
93
94
|
## Getting Started<a id="getting-started"></a>
|
|
@@ -1349,6 +1350,40 @@ false to retrieve non executed orders as well
|
|
|
1349
1350
|
---
|
|
1350
1351
|
|
|
1351
1352
|
|
|
1353
|
+
### `snaptrade.experimental_endpoints.sync_brokerage_authorization_transactions`<a id="snaptradeexperimental_endpointssync_brokerage_authorization_transactions"></a>
|
|
1354
|
+
|
|
1355
|
+
Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
|
1359
|
+
|
|
1360
|
+
```ruby
|
|
1361
|
+
result = snaptrade.experimental_endpoints.sync_brokerage_authorization_transactions(
|
|
1362
|
+
authorization_id: "87b24961-b51e-4db8-9226-f198f6518a89",
|
|
1363
|
+
user_id: "snaptrade-user-123",
|
|
1364
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
|
1365
|
+
)
|
|
1366
|
+
p result
|
|
1367
|
+
```
|
|
1368
|
+
|
|
1369
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
|
1370
|
+
|
|
1371
|
+
##### authorization_id: `String`<a id="authorization_id-string"></a>
|
|
1372
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
|
1373
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
|
1374
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
|
1375
|
+
|
|
1376
|
+
[BrokerageAuthorizationTransactionsSyncConfirmation](./lib/snaptrade/models/brokerage_authorization_transactions_sync_confirmation.rb)
|
|
1377
|
+
|
|
1378
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
|
1379
|
+
|
|
1380
|
+
`/authorizations/{authorizationId}/transactions/sync` `POST`
|
|
1381
|
+
|
|
1382
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
|
1383
|
+
|
|
1384
|
+
---
|
|
1385
|
+
|
|
1386
|
+
|
|
1352
1387
|
### `snaptrade.options.list_option_holdings`<a id="snaptradeoptionslist_option_holdings"></a>
|
|
1353
1388
|
|
|
1354
1389
|
Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions).
|
|
@@ -494,6 +494,109 @@ module SnapTrade
|
|
|
494
494
|
end
|
|
495
495
|
return data, status_code, headers, response
|
|
496
496
|
end
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
# Sync transactions for a connection
|
|
500
|
+
#
|
|
501
|
+
# Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
|
|
502
|
+
#
|
|
503
|
+
# @param authorization_id [String]
|
|
504
|
+
# @param user_id [String]
|
|
505
|
+
# @param user_secret [String]
|
|
506
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
507
|
+
def sync_brokerage_authorization_transactions(authorization_id:, user_id:, user_secret:, extra: {})
|
|
508
|
+
data, _status_code, _headers = sync_brokerage_authorization_transactions_with_http_info_impl(authorization_id, user_id, user_secret, extra)
|
|
509
|
+
data
|
|
510
|
+
end
|
|
511
|
+
|
|
512
|
+
# Sync transactions for a connection
|
|
513
|
+
#
|
|
514
|
+
# Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
|
|
515
|
+
#
|
|
516
|
+
# @param authorization_id [String]
|
|
517
|
+
# @param user_id [String]
|
|
518
|
+
# @param user_secret [String]
|
|
519
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
|
520
|
+
def sync_brokerage_authorization_transactions_with_http_info(authorization_id:, user_id:, user_secret:, extra: {})
|
|
521
|
+
sync_brokerage_authorization_transactions_with_http_info_impl(authorization_id, user_id, user_secret, extra)
|
|
522
|
+
end
|
|
523
|
+
|
|
524
|
+
# Sync transactions for a connection
|
|
525
|
+
# Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
|
|
526
|
+
# @param authorization_id [String]
|
|
527
|
+
# @param user_id [String]
|
|
528
|
+
# @param user_secret [String]
|
|
529
|
+
# @param [Hash] opts the optional parameters
|
|
530
|
+
# @return [BrokerageAuthorizationTransactionsSyncConfirmation]
|
|
531
|
+
private def sync_brokerage_authorization_transactions_impl(authorization_id, user_id, user_secret, opts = {})
|
|
532
|
+
data, _status_code, _headers = sync_brokerage_authorization_transactions_with_http_info(authorization_id, user_id, user_secret, opts)
|
|
533
|
+
data
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
# Sync transactions for a connection
|
|
537
|
+
# Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
|
|
538
|
+
# @param authorization_id [String]
|
|
539
|
+
# @param user_id [String]
|
|
540
|
+
# @param user_secret [String]
|
|
541
|
+
# @param [Hash] opts the optional parameters
|
|
542
|
+
# @return [Array<(BrokerageAuthorizationTransactionsSyncConfirmation, Integer, Hash)>] BrokerageAuthorizationTransactionsSyncConfirmation data, response status code and response headers
|
|
543
|
+
private def sync_brokerage_authorization_transactions_with_http_info_impl(authorization_id, user_id, user_secret, opts = {})
|
|
544
|
+
if @api_client.config.debugging
|
|
545
|
+
@api_client.config.logger.debug 'Calling API: ExperimentalEndpointsApi.sync_brokerage_authorization_transactions ...'
|
|
546
|
+
end
|
|
547
|
+
# verify the required parameter 'authorization_id' is set
|
|
548
|
+
if @api_client.config.client_side_validation && authorization_id.nil?
|
|
549
|
+
fail ArgumentError, "Missing the required parameter 'authorization_id' when calling ExperimentalEndpointsApi.sync_brokerage_authorization_transactions"
|
|
550
|
+
end
|
|
551
|
+
# verify the required parameter 'user_id' is set
|
|
552
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
|
553
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling ExperimentalEndpointsApi.sync_brokerage_authorization_transactions"
|
|
554
|
+
end
|
|
555
|
+
# verify the required parameter 'user_secret' is set
|
|
556
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
|
557
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling ExperimentalEndpointsApi.sync_brokerage_authorization_transactions"
|
|
558
|
+
end
|
|
559
|
+
# resource path
|
|
560
|
+
local_var_path = '/authorizations/{authorizationId}/transactions/sync'.sub('{' + 'authorizationId' + '}', CGI.escape(authorization_id.to_s))
|
|
561
|
+
|
|
562
|
+
# query parameters
|
|
563
|
+
query_params = opts[:query_params] || {}
|
|
564
|
+
query_params[:'userId'] = user_id
|
|
565
|
+
query_params[:'userSecret'] = user_secret
|
|
566
|
+
|
|
567
|
+
# header parameters
|
|
568
|
+
header_params = opts[:header_params] || {}
|
|
569
|
+
# HTTP header 'Accept' (if needed)
|
|
570
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
|
571
|
+
|
|
572
|
+
# form parameters
|
|
573
|
+
form_params = opts[:form_params] || {}
|
|
574
|
+
|
|
575
|
+
# http body (model)
|
|
576
|
+
post_body = opts[:debug_body]
|
|
577
|
+
|
|
578
|
+
# return_type
|
|
579
|
+
return_type = opts[:debug_return_type] || 'BrokerageAuthorizationTransactionsSyncConfirmation'
|
|
580
|
+
|
|
581
|
+
# auth_names
|
|
582
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
|
583
|
+
|
|
584
|
+
new_options = opts.merge(
|
|
585
|
+
:operation => :"ExperimentalEndpointsApi.sync_brokerage_authorization_transactions",
|
|
586
|
+
:header_params => header_params,
|
|
587
|
+
:query_params => query_params,
|
|
588
|
+
:form_params => form_params,
|
|
589
|
+
:body => post_body,
|
|
590
|
+
:auth_names => auth_names,
|
|
591
|
+
:return_type => return_type
|
|
592
|
+
)
|
|
593
|
+
|
|
594
|
+
data, status_code, headers, response = @api_client.call_api(:POST, local_var_path, new_options)
|
|
595
|
+
if @api_client.config.debugging
|
|
596
|
+
@api_client.config.logger.debug "API called: ExperimentalEndpointsApi#sync_brokerage_authorization_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
597
|
+
end
|
|
598
|
+
return data, status_code, headers, response
|
|
599
|
+
end
|
|
497
600
|
end
|
|
498
601
|
|
|
499
602
|
# top-level client access to avoid having the user to insantiate their own API instances
|
|
@@ -50,6 +50,9 @@ module SnapTrade
|
|
|
50
50
|
# The account type as provided by the brokerage
|
|
51
51
|
attr_accessor :raw_type
|
|
52
52
|
|
|
53
|
+
# The category of the account, normalized across institutions. Returns `null` if the category could not be determined. Use this field to filter out non-investment accounts if your integration only supports trading / holdings flows. See [Filtering Accounts by Category](https://docs.snaptrade.com/docs/filtering-accounts-by-category) for more information. - `INVESTMENT`: A brokerage / investment account (equities, options, crypto, etc.). - `DEPOSIT`: A bank deposit account (checking, savings). - `LOC`: A line of credit account.
|
|
54
|
+
attr_accessor :account_category
|
|
55
|
+
|
|
53
56
|
# Additional information about the account, such as account type, status, etc. This information is specific to the brokerage and there's no standard format for this data. This field is deprecated and subject to removal in a future version.
|
|
54
57
|
attr_accessor :meta
|
|
55
58
|
|
|
@@ -78,6 +81,7 @@ module SnapTrade
|
|
|
78
81
|
:'balance' => :'balance',
|
|
79
82
|
:'status' => :'status',
|
|
80
83
|
:'raw_type' => :'raw_type',
|
|
84
|
+
:'account_category' => :'account_category',
|
|
81
85
|
:'meta' => :'meta',
|
|
82
86
|
:'portfolio_group' => :'portfolio_group',
|
|
83
87
|
:'cash_restrictions' => :'cash_restrictions',
|
|
@@ -106,6 +110,7 @@ module SnapTrade
|
|
|
106
110
|
:'balance' => :'AccountBalance',
|
|
107
111
|
:'status' => :'AccountStatus',
|
|
108
112
|
:'raw_type' => :'String',
|
|
113
|
+
:'account_category' => :'AccountCategory',
|
|
109
114
|
:'meta' => :'Hash<String, Object>',
|
|
110
115
|
:'portfolio_group' => :'String',
|
|
111
116
|
:'cash_restrictions' => :'Array<String>',
|
|
@@ -122,6 +127,7 @@ module SnapTrade
|
|
|
122
127
|
:'opening_date',
|
|
123
128
|
:'status',
|
|
124
129
|
:'raw_type',
|
|
130
|
+
:'account_category',
|
|
125
131
|
])
|
|
126
132
|
end
|
|
127
133
|
|
|
@@ -192,6 +198,10 @@ module SnapTrade
|
|
|
192
198
|
self.raw_type = attributes[:'raw_type']
|
|
193
199
|
end
|
|
194
200
|
|
|
201
|
+
if attributes.key?(:'account_category')
|
|
202
|
+
self.account_category = attributes[:'account_category']
|
|
203
|
+
end
|
|
204
|
+
|
|
195
205
|
if attributes.key?(:'meta')
|
|
196
206
|
if (value = attributes[:'meta']).is_a?(Hash)
|
|
197
207
|
self.meta = value
|
|
@@ -284,6 +294,7 @@ module SnapTrade
|
|
|
284
294
|
balance == o.balance &&
|
|
285
295
|
status == o.status &&
|
|
286
296
|
raw_type == o.raw_type &&
|
|
297
|
+
account_category == o.account_category &&
|
|
287
298
|
meta == o.meta &&
|
|
288
299
|
portfolio_group == o.portfolio_group &&
|
|
289
300
|
cash_restrictions == o.cash_restrictions &&
|
|
@@ -299,7 +310,7 @@ module SnapTrade
|
|
|
299
310
|
# Calculates hash code according to all attributes.
|
|
300
311
|
# @return [Integer] Hash code
|
|
301
312
|
def hash
|
|
302
|
-
[id, brokerage_authorization, name, number, institution_account_id, institution_name, created_date, funding_date, opening_date, sync_status, balance, status, raw_type, meta, portfolio_group, cash_restrictions, is_paper].hash
|
|
313
|
+
[id, brokerage_authorization, name, number, institution_account_id, institution_name, created_date, funding_date, opening_date, sync_status, balance, status, raw_type, account_category, meta, portfolio_group, cash_restrictions, is_paper].hash
|
|
303
314
|
end
|
|
304
315
|
|
|
305
316
|
# Builds the object from hash
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
class AccountCategory
|
|
15
|
+
INVESTMENT = "INVESTMENT".freeze
|
|
16
|
+
DEPOSIT = "DEPOSIT".freeze
|
|
17
|
+
LOC = "LOC".freeze
|
|
18
|
+
|
|
19
|
+
def self.all_vars
|
|
20
|
+
@all_vars ||= [INVESTMENT, DEPOSIT, LOC].freeze
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Builds the enum from string
|
|
24
|
+
# @param [String] The enum value in the form of the string
|
|
25
|
+
# @return [String] The enum value
|
|
26
|
+
def self.build_from_hash(value)
|
|
27
|
+
new.build_from_hash(value)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Builds the enum from string
|
|
31
|
+
# @param [String] The enum value in the form of the string
|
|
32
|
+
# @return [String] The enum value
|
|
33
|
+
def build_from_hash(value)
|
|
34
|
+
return value if AccountCategory.all_vars.include?(value)
|
|
35
|
+
raise "Invalid ENUM value #{value} for class #AccountCategory"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,218 @@
|
|
|
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
|
+
# Confirmation that the transaction syncs have been scheduled.
|
|
15
|
+
class BrokerageAuthorizationTransactionsSyncConfirmation
|
|
16
|
+
# Transactions sync confirmation details
|
|
17
|
+
attr_accessor :detail
|
|
18
|
+
|
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
20
|
+
def self.attribute_map
|
|
21
|
+
{
|
|
22
|
+
:'detail' => :'detail'
|
|
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
|
+
:'detail' => :'String'
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# List of attributes with nullable: true
|
|
39
|
+
def self.openapi_nullable
|
|
40
|
+
Set.new([
|
|
41
|
+
])
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Initializes the object
|
|
45
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
46
|
+
def initialize(attributes = {})
|
|
47
|
+
if (!attributes.is_a?(Hash))
|
|
48
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::BrokerageAuthorizationTransactionsSyncConfirmation` initialize method"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
52
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
53
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
54
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::BrokerageAuthorizationTransactionsSyncConfirmation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
55
|
+
end
|
|
56
|
+
h[k.to_sym] = v
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if attributes.key?(:'detail')
|
|
60
|
+
self.detail = attributes[:'detail']
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
65
|
+
# @return Array for valid properties with the reasons
|
|
66
|
+
def list_invalid_properties
|
|
67
|
+
invalid_properties = Array.new
|
|
68
|
+
invalid_properties
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Check to see if the all the properties in the model are valid
|
|
72
|
+
# @return true if the model is valid
|
|
73
|
+
def valid?
|
|
74
|
+
true
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Checks equality by comparing each attribute.
|
|
78
|
+
# @param [Object] Object to be compared
|
|
79
|
+
def ==(o)
|
|
80
|
+
return true if self.equal?(o)
|
|
81
|
+
self.class == o.class &&
|
|
82
|
+
detail == o.detail
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# @see the `==` method
|
|
86
|
+
# @param [Object] Object to be compared
|
|
87
|
+
def eql?(o)
|
|
88
|
+
self == o
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Calculates hash code according to all attributes.
|
|
92
|
+
# @return [Integer] Hash code
|
|
93
|
+
def hash
|
|
94
|
+
[detail].hash
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Builds the object from hash
|
|
98
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
99
|
+
# @return [Object] Returns the model itself
|
|
100
|
+
def self.build_from_hash(attributes)
|
|
101
|
+
new.build_from_hash(attributes)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Builds the object from hash
|
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
106
|
+
# @return [Object] Returns the model itself
|
|
107
|
+
def build_from_hash(attributes)
|
|
108
|
+
return nil unless attributes.is_a?(Hash)
|
|
109
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
110
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
111
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
112
|
+
self.send("#{key}=", nil)
|
|
113
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
114
|
+
# check to ensure the input is an array given that the attribute
|
|
115
|
+
# is documented as an array but the input is not
|
|
116
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
117
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
118
|
+
end
|
|
119
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
120
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
self
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Deserializes the data based on type
|
|
128
|
+
# @param string type Data type
|
|
129
|
+
# @param string value Value to be deserialized
|
|
130
|
+
# @return [Object] Deserialized data
|
|
131
|
+
def _deserialize(type, value)
|
|
132
|
+
case type.to_sym
|
|
133
|
+
when :Time
|
|
134
|
+
Time.parse(value)
|
|
135
|
+
when :Date
|
|
136
|
+
Date.parse(value)
|
|
137
|
+
when :String
|
|
138
|
+
value.to_s
|
|
139
|
+
when :Integer
|
|
140
|
+
value.to_i
|
|
141
|
+
when :Float
|
|
142
|
+
value.to_f
|
|
143
|
+
when :Boolean
|
|
144
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
145
|
+
true
|
|
146
|
+
else
|
|
147
|
+
false
|
|
148
|
+
end
|
|
149
|
+
when :Object
|
|
150
|
+
# generic object (usually a Hash), return directly
|
|
151
|
+
value
|
|
152
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
153
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
154
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
155
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
156
|
+
k_type = Regexp.last_match[:k_type]
|
|
157
|
+
v_type = Regexp.last_match[:v_type]
|
|
158
|
+
{}.tap do |hash|
|
|
159
|
+
value.each do |k, v|
|
|
160
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
else # model
|
|
164
|
+
# models (e.g. Pet) or oneOf
|
|
165
|
+
klass = SnapTrade.const_get(type)
|
|
166
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Returns the string representation of the object
|
|
171
|
+
# @return [String] String presentation of the object
|
|
172
|
+
def to_s
|
|
173
|
+
to_hash.to_s
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
177
|
+
# @return [Hash] Returns the object in the form of hash
|
|
178
|
+
def to_body
|
|
179
|
+
to_hash
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Returns the object in the form of hash
|
|
183
|
+
# @return [Hash] Returns the object in the form of hash
|
|
184
|
+
def to_hash
|
|
185
|
+
hash = {}
|
|
186
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
187
|
+
value = self.send(attr)
|
|
188
|
+
if value.nil?
|
|
189
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
190
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
hash[param] = _to_hash(value)
|
|
194
|
+
end
|
|
195
|
+
hash
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Outputs non-array value in the form of hash
|
|
199
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
200
|
+
# @param [Object] value Any valid value
|
|
201
|
+
# @return [Hash] Returns the value in the form of hash
|
|
202
|
+
def _to_hash(value)
|
|
203
|
+
if value.is_a?(Array)
|
|
204
|
+
value.compact.map { |v| _to_hash(v) }
|
|
205
|
+
elsif value.is_a?(Hash)
|
|
206
|
+
{}.tap do |hash|
|
|
207
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
208
|
+
end
|
|
209
|
+
elsif value.respond_to? :to_hash
|
|
210
|
+
value.to_hash
|
|
211
|
+
else
|
|
212
|
+
value
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
end
|
|
@@ -11,7 +11,7 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module SnapTrade
|
|
14
|
-
# Status of account transaction sync. SnapTrade syncs transactions from the brokerage under the following conditions: 1. Initial connection - SnapTrade syncs all transactions from the brokerage account as far back as the brokerage allows. Check [our integrations doc](https://support.snaptrade.com/brokerages-table?v=6fab8012ade6441fa0c6d9af9c55ce3a) for details on how far back we sync for each brokerage. 2. Daily sync - Once a day SnapTrade syncs new transactions from the brokerage. 3. Manual sync - You can
|
|
14
|
+
# Status of account transaction sync. SnapTrade syncs transactions from the brokerage under the following conditions: 1. Initial connection - SnapTrade syncs all transactions from the brokerage account as far back as the brokerage allows. Check [our integrations doc](https://support.snaptrade.com/brokerages-table?v=6fab8012ade6441fa0c6d9af9c55ce3a) for details on how far back we sync for each brokerage. 2. Daily sync - Once a day SnapTrade syncs new transactions from the brokerage. 3. Manual sync - You can trigger an incremental sync of transactions with the [transactions sync](/reference/Experimental%20endpoints/Connections_syncBrokerageAuthorizationTransactions) endpoint.
|
|
15
15
|
class TransactionsStatus
|
|
16
16
|
# Indicates if the initial sync of transactions has been completed. For accounts with a large number of transactions, the initial sync may take a while to complete.
|
|
17
17
|
attr_accessor :initial_sync_completed
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
|
@@ -19,6 +19,7 @@ require 'snaptrade/configuration'
|
|
|
19
19
|
require 'snaptrade/models/account'
|
|
20
20
|
require 'snaptrade/models/account_balance'
|
|
21
21
|
require 'snaptrade/models/account_balance_total'
|
|
22
|
+
require 'snaptrade/models/account_category'
|
|
22
23
|
require 'snaptrade/models/account_holdings'
|
|
23
24
|
require 'snaptrade/models/account_holdings_account'
|
|
24
25
|
require 'snaptrade/models/account_information_get_user_account_order_detail_request'
|
|
@@ -54,6 +55,7 @@ require 'snaptrade/models/brokerage'
|
|
|
54
55
|
require 'snaptrade/models/brokerage_authorization'
|
|
55
56
|
require 'snaptrade/models/brokerage_authorization_disabled_confirmation'
|
|
56
57
|
require 'snaptrade/models/brokerage_authorization_refresh_confirmation'
|
|
58
|
+
require 'snaptrade/models/brokerage_authorization_transactions_sync_confirmation'
|
|
57
59
|
require 'snaptrade/models/brokerage_authorization_type_read_only'
|
|
58
60
|
require 'snaptrade/models/brokerage_authorization_type_read_only_brokerage'
|
|
59
61
|
require 'snaptrade/models/brokerage_authorization_type_read_only_type'
|
|
@@ -87,4 +87,18 @@ describe 'ExperimentalEndpointsApi' do
|
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
+
# unit tests for sync_brokerage_authorization_transactions
|
|
91
|
+
# Sync transactions for a connection
|
|
92
|
+
# Trigger a transactions sync for all accounts under this connection. Updates will be queued asynchronously. Transactions are not updated intra-day, but calling this endpoint can ensure that the previous day's transactions have been synced. For more information on sync behaviour, see: https://docs.snaptrade.com/docs/syncing
|
|
93
|
+
# @param authorization_id
|
|
94
|
+
# @param user_id
|
|
95
|
+
# @param user_secret
|
|
96
|
+
# @param [Hash] opts the optional parameters
|
|
97
|
+
# @return [BrokerageAuthorizationTransactionsSyncConfirmation]
|
|
98
|
+
describe 'sync_brokerage_authorization_transactions test' do
|
|
99
|
+
it 'should work' do
|
|
100
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
90
104
|
end
|
|
@@ -0,0 +1,23 @@
|
|
|
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::AccountCategory
|
|
15
|
+
describe SnapTrade::AccountCategory do
|
|
16
|
+
let(:instance) { SnapTrade::AccountCategory.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of AccountCategory' do
|
|
19
|
+
it 'should create an instance of AccountCategory' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::AccountCategory)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
data/spec/models/account_spec.rb
CHANGED
|
@@ -98,6 +98,12 @@ describe SnapTrade::Account do
|
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
+
describe 'test attribute "account_category"' do
|
|
102
|
+
it 'should work' do
|
|
103
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
101
107
|
describe 'test attribute "meta"' do
|
|
102
108
|
it 'should work' do
|
|
103
109
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#SnapTrade
|
|
3
|
+
|
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: api@snaptrade.com
|
|
8
|
+
=end
|
|
9
|
+
|
|
10
|
+
require 'spec_helper'
|
|
11
|
+
require 'json'
|
|
12
|
+
require 'date'
|
|
13
|
+
|
|
14
|
+
# Unit tests for SnapTrade::BrokerageAuthorizationTransactionsSyncConfirmation
|
|
15
|
+
describe SnapTrade::BrokerageAuthorizationTransactionsSyncConfirmation do
|
|
16
|
+
let(:instance) { SnapTrade::BrokerageAuthorizationTransactionsSyncConfirmation.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of BrokerageAuthorizationTransactionsSyncConfirmation' do
|
|
19
|
+
it 'should create an instance of BrokerageAuthorizationTransactionsSyncConfirmation' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::BrokerageAuthorizationTransactionsSyncConfirmation)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
describe 'test attribute "detail"' do
|
|
24
|
+
it 'should work' do
|
|
25
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: snaptrade
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.184
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SnapTrade
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-04-
|
|
11
|
+
date: 2026-04-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -99,6 +99,7 @@ files:
|
|
|
99
99
|
- lib/snaptrade/models/account.rb
|
|
100
100
|
- lib/snaptrade/models/account_balance.rb
|
|
101
101
|
- lib/snaptrade/models/account_balance_total.rb
|
|
102
|
+
- lib/snaptrade/models/account_category.rb
|
|
102
103
|
- lib/snaptrade/models/account_holdings.rb
|
|
103
104
|
- lib/snaptrade/models/account_holdings_account.rb
|
|
104
105
|
- lib/snaptrade/models/account_information_get_user_account_order_detail_request.rb
|
|
@@ -134,6 +135,7 @@ files:
|
|
|
134
135
|
- lib/snaptrade/models/brokerage_authorization.rb
|
|
135
136
|
- lib/snaptrade/models/brokerage_authorization_disabled_confirmation.rb
|
|
136
137
|
- lib/snaptrade/models/brokerage_authorization_refresh_confirmation.rb
|
|
138
|
+
- lib/snaptrade/models/brokerage_authorization_transactions_sync_confirmation.rb
|
|
137
139
|
- lib/snaptrade/models/brokerage_authorization_type_read_only.rb
|
|
138
140
|
- lib/snaptrade/models/brokerage_authorization_type_read_only_brokerage.rb
|
|
139
141
|
- lib/snaptrade/models/brokerage_authorization_type_read_only_type.rb
|
|
@@ -285,6 +287,7 @@ files:
|
|
|
285
287
|
- spec/getting_started_spec.rb
|
|
286
288
|
- spec/models/account_balance_spec.rb
|
|
287
289
|
- spec/models/account_balance_total_spec.rb
|
|
290
|
+
- spec/models/account_category_spec.rb
|
|
288
291
|
- spec/models/account_holdings_account_spec.rb
|
|
289
292
|
- spec/models/account_holdings_spec.rb
|
|
290
293
|
- spec/models/account_information_get_user_account_order_detail_request_spec.rb
|
|
@@ -320,6 +323,7 @@ files:
|
|
|
320
323
|
- spec/models/brokerage_authorization_disabled_confirmation_spec.rb
|
|
321
324
|
- spec/models/brokerage_authorization_refresh_confirmation_spec.rb
|
|
322
325
|
- spec/models/brokerage_authorization_spec.rb
|
|
326
|
+
- spec/models/brokerage_authorization_transactions_sync_confirmation_spec.rb
|
|
323
327
|
- spec/models/brokerage_authorization_type_read_only_brokerage_spec.rb
|
|
324
328
|
- spec/models/brokerage_authorization_type_read_only_spec.rb
|
|
325
329
|
- spec/models/brokerage_authorization_type_read_only_type_spec.rb
|
|
@@ -553,6 +557,7 @@ test_files:
|
|
|
553
557
|
- spec/models/account_order_record_status_v2_spec.rb
|
|
554
558
|
- spec/models/brokerage_authorization_spec.rb
|
|
555
559
|
- spec/models/encrypted_response_spec.rb
|
|
560
|
+
- spec/models/account_category_spec.rb
|
|
556
561
|
- spec/models/symbol_query_spec.rb
|
|
557
562
|
- spec/models/sub_period_return_rate_spec.rb
|
|
558
563
|
- spec/models/paginated_universal_activity_spec.rb
|
|
@@ -601,6 +606,7 @@ test_files:
|
|
|
601
606
|
- spec/models/crypto_order_preview_estimated_fee_spec.rb
|
|
602
607
|
- spec/models/timeframe_spec.rb
|
|
603
608
|
- spec/models/crypto_trading_instrument_spec.rb
|
|
609
|
+
- spec/models/brokerage_authorization_transactions_sync_confirmation_spec.rb
|
|
604
610
|
- spec/models/status_spec.rb
|
|
605
611
|
- spec/models/rate_of_return_object_spec.rb
|
|
606
612
|
- spec/models/account_order_record_trailing_stop_spec.rb
|