snaptrade 2.0.54 → 2.0.56
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 +72 -2
- data/lib/snaptrade/api/account_information_api.rb +103 -0
- data/lib/snaptrade/api/connections_api.rb +103 -0
- data/lib/snaptrade/models/rate_of_return_object.rb +238 -0
- data/lib/snaptrade/models/rate_of_return_response.rb +220 -0
- data/lib/snaptrade/models/security_type.rb +1 -1
- data/lib/snaptrade/models/timeframe.rb +40 -0
- data/lib/snaptrade/models/underlying_symbol_type.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +3 -0
- data/spec/api/account_information_api_spec.rb +14 -0
- data/spec/api/connections_api_spec.rb +14 -0
- data/spec/models/rate_of_return_object_spec.rb +41 -0
- data/spec/models/rate_of_return_response_spec.rb +29 -0
- data/spec/models/timeframe_spec.rb +23 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 962d39a6576fd86c258ba583b874280494d03415ff23f14f0f91d211e5579584
|
4
|
+
data.tar.gz: 55dd7b9413baf952cbaa2276f016b6593d80a0233177c3c685ac601ad95b28da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83ba257bbb94b35e2b3b98345febbeac17a00c162bbfe7fc7e036f5e655237277f61566ba37a54177c0791202b7a7cc58d502d564705589b92be9201bda1e2b0
|
7
|
+
data.tar.gz: c8bac13ccd529d7ea5a64057d05ded6978e36c9027380d4e0c625a6492b44e6f84f5b78f511414f2d301267bb0f3f4de2fb0bb464aa3d4fda8157758b3d271e8
|
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.56)
|
10
10
|
[](https://snaptrade.com/)
|
11
11
|
|
12
12
|
</div>
|
@@ -25,6 +25,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
25
25
|
* [`snaptrade.account_information.get_user_account_orders`](#snaptradeaccount_informationget_user_account_orders)
|
26
26
|
* [`snaptrade.account_information.get_user_account_positions`](#snaptradeaccount_informationget_user_account_positions)
|
27
27
|
* [`snaptrade.account_information.get_user_account_recent_orders`](#snaptradeaccount_informationget_user_account_recent_orders)
|
28
|
+
* [`snaptrade.account_information.get_user_account_return_rates`](#snaptradeaccount_informationget_user_account_return_rates)
|
28
29
|
* [`snaptrade.account_information.get_user_holdings`](#snaptradeaccount_informationget_user_holdings)
|
29
30
|
* [`snaptrade.account_information.list_user_accounts`](#snaptradeaccount_informationlist_user_accounts)
|
30
31
|
* [`snaptrade.account_information.update_user_account`](#snaptradeaccount_informationupdate_user_account)
|
@@ -39,6 +40,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
39
40
|
* [`snaptrade.connections.list_brokerage_authorizations`](#snaptradeconnectionslist_brokerage_authorizations)
|
40
41
|
* [`snaptrade.connections.refresh_brokerage_authorization`](#snaptradeconnectionsrefresh_brokerage_authorization)
|
41
42
|
* [`snaptrade.connections.remove_brokerage_authorization`](#snaptradeconnectionsremove_brokerage_authorization)
|
43
|
+
* [`snaptrade.connections.return_rates`](#snaptradeconnectionsreturn_rates)
|
42
44
|
* [`snaptrade.connections.session_events`](#snaptradeconnectionssession_events)
|
43
45
|
* [`snaptrade.options.get_option_strategy`](#snaptradeoptionsget_option_strategy)
|
44
46
|
* [`snaptrade.options.get_options_chain`](#snaptradeoptionsget_options_chain)
|
@@ -71,7 +73,7 @@ Connect brokerage accounts to your app for live positions and trading
|
|
71
73
|
Add to Gemfile:
|
72
74
|
|
73
75
|
```ruby
|
74
|
-
gem 'snaptrade', '~> 2.0.
|
76
|
+
gem 'snaptrade', '~> 2.0.56'
|
75
77
|
```
|
76
78
|
|
77
79
|
## Getting Started<a id="getting-started"></a>
|
@@ -341,6 +343,40 @@ p result
|
|
341
343
|
---
|
342
344
|
|
343
345
|
|
346
|
+
### `snaptrade.account_information.get_user_account_return_rates`<a id="snaptradeaccount_informationget_user_account_return_rates"></a>
|
347
|
+
|
348
|
+
Returns a list of rate of return percents for a given account. Will include timeframes available from the brokerage, for example "ALL", "1Y", "6M", "3M", "1M"
|
349
|
+
|
350
|
+
|
351
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
352
|
+
|
353
|
+
```ruby
|
354
|
+
result = snaptrade.account_information.get_user_account_return_rates(
|
355
|
+
user_id: "snaptrade-user-123",
|
356
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
357
|
+
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
|
358
|
+
)
|
359
|
+
p result
|
360
|
+
```
|
361
|
+
|
362
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
363
|
+
|
364
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
365
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
366
|
+
##### account_id: `String`<a id="account_id-string"></a>
|
367
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
368
|
+
|
369
|
+
[RateOfReturnResponse](./lib/snaptrade/models/rate_of_return_response.rb)
|
370
|
+
|
371
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
372
|
+
|
373
|
+
`/accounts/{accountId}/returnRates` `GET`
|
374
|
+
|
375
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
376
|
+
|
377
|
+
---
|
378
|
+
|
379
|
+
|
344
380
|
### `snaptrade.account_information.get_user_holdings`<a id="snaptradeaccount_informationget_user_holdings"></a>
|
345
381
|
|
346
382
|
Returns a list of balances, positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__
|
@@ -837,6 +873,40 @@ snaptrade.connections.remove_brokerage_authorization(
|
|
837
873
|
---
|
838
874
|
|
839
875
|
|
876
|
+
### `snaptrade.connections.return_rates`<a id="snaptradeconnectionsreturn_rates"></a>
|
877
|
+
|
878
|
+
Returns a list of rate of return percents for a given connection. Will include timeframes available from the brokerage, for example "ALL", "1Y", "6M", "3M", "1M"
|
879
|
+
|
880
|
+
|
881
|
+
#### 🛠️ Usage<a id="🛠️-usage"></a>
|
882
|
+
|
883
|
+
```ruby
|
884
|
+
result = snaptrade.connections.return_rates(
|
885
|
+
user_id: "snaptrade-user-123",
|
886
|
+
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
|
887
|
+
authorization_id: "87b24961-b51e-4db8-9226-f198f6518a89",
|
888
|
+
)
|
889
|
+
p result
|
890
|
+
```
|
891
|
+
|
892
|
+
#### ⚙️ Parameters<a id="⚙️-parameters"></a>
|
893
|
+
|
894
|
+
##### user_id: `String`<a id="user_id-string"></a>
|
895
|
+
##### user_secret: `String`<a id="user_secret-string"></a>
|
896
|
+
##### authorization_id: `String`<a id="authorization_id-string"></a>
|
897
|
+
#### 🔄 Return<a id="🔄-return"></a>
|
898
|
+
|
899
|
+
[RateOfReturnResponse](./lib/snaptrade/models/rate_of_return_response.rb)
|
900
|
+
|
901
|
+
#### 🌐 Endpoint<a id="🌐-endpoint"></a>
|
902
|
+
|
903
|
+
`/authorizations/{authorizationId}/returnRates` `GET`
|
904
|
+
|
905
|
+
[🔙 **Back to Table of Contents**](#table-of-contents)
|
906
|
+
|
907
|
+
---
|
908
|
+
|
909
|
+
|
840
910
|
### `snaptrade.connections.session_events`<a id="snaptradeconnectionssession_events"></a>
|
841
911
|
|
842
912
|
Returns a list of session events associated with a user.
|
@@ -684,6 +684,109 @@ module SnapTrade
|
|
684
684
|
end
|
685
685
|
|
686
686
|
|
687
|
+
# List account rate of returns
|
688
|
+
#
|
689
|
+
# Returns a list of rate of return percents for a given account. Will include timeframes available from the brokerage, for example "ALL", "1Y", "6M", "3M", "1M"
|
690
|
+
#
|
691
|
+
# @param user_id [String]
|
692
|
+
# @param user_secret [String]
|
693
|
+
# @param account_id [String]
|
694
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
695
|
+
def get_user_account_return_rates(user_id:, user_secret:, account_id:, extra: {})
|
696
|
+
data, _status_code, _headers = get_user_account_return_rates_with_http_info_impl(user_id, user_secret, account_id, extra)
|
697
|
+
data
|
698
|
+
end
|
699
|
+
|
700
|
+
# List account rate of returns
|
701
|
+
#
|
702
|
+
# Returns a list of rate of return percents for a given account. Will include timeframes available from the brokerage, for example "ALL", "1Y", "6M", "3M", "1M"
|
703
|
+
#
|
704
|
+
# @param user_id [String]
|
705
|
+
# @param user_secret [String]
|
706
|
+
# @param account_id [String]
|
707
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
708
|
+
def get_user_account_return_rates_with_http_info(user_id:, user_secret:, account_id:, extra: {})
|
709
|
+
get_user_account_return_rates_with_http_info_impl(user_id, user_secret, account_id, extra)
|
710
|
+
end
|
711
|
+
|
712
|
+
# List account rate of returns
|
713
|
+
# Returns a list of rate of return percents for a given account. Will include timeframes available from the brokerage, for example \"ALL\", \"1Y\", \"6M\", \"3M\", \"1M\"
|
714
|
+
# @param user_id [String]
|
715
|
+
# @param user_secret [String]
|
716
|
+
# @param account_id [String]
|
717
|
+
# @param [Hash] opts the optional parameters
|
718
|
+
# @return [RateOfReturnResponse]
|
719
|
+
private def get_user_account_return_rates_impl(user_id, user_secret, account_id, opts = {})
|
720
|
+
data, _status_code, _headers = get_user_account_return_rates_with_http_info(user_id, user_secret, account_id, opts)
|
721
|
+
data
|
722
|
+
end
|
723
|
+
|
724
|
+
# List account rate of returns
|
725
|
+
# Returns a list of rate of return percents for a given account. Will include timeframes available from the brokerage, for example \"ALL\", \"1Y\", \"6M\", \"3M\", \"1M\"
|
726
|
+
# @param user_id [String]
|
727
|
+
# @param user_secret [String]
|
728
|
+
# @param account_id [String]
|
729
|
+
# @param [Hash] opts the optional parameters
|
730
|
+
# @return [Array<(RateOfReturnResponse, Integer, Hash)>] RateOfReturnResponse data, response status code and response headers
|
731
|
+
private def get_user_account_return_rates_with_http_info_impl(user_id, user_secret, account_id, opts = {})
|
732
|
+
if @api_client.config.debugging
|
733
|
+
@api_client.config.logger.debug 'Calling API: AccountInformationApi.get_user_account_return_rates ...'
|
734
|
+
end
|
735
|
+
# verify the required parameter 'user_id' is set
|
736
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
737
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling AccountInformationApi.get_user_account_return_rates"
|
738
|
+
end
|
739
|
+
# verify the required parameter 'user_secret' is set
|
740
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
741
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling AccountInformationApi.get_user_account_return_rates"
|
742
|
+
end
|
743
|
+
# verify the required parameter 'account_id' is set
|
744
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
745
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling AccountInformationApi.get_user_account_return_rates"
|
746
|
+
end
|
747
|
+
# resource path
|
748
|
+
local_var_path = '/accounts/{accountId}/returnRates'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s))
|
749
|
+
|
750
|
+
# query parameters
|
751
|
+
query_params = opts[:query_params] || {}
|
752
|
+
query_params[:'userId'] = user_id
|
753
|
+
query_params[:'userSecret'] = user_secret
|
754
|
+
|
755
|
+
# header parameters
|
756
|
+
header_params = opts[:header_params] || {}
|
757
|
+
# HTTP header 'Accept' (if needed)
|
758
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
759
|
+
|
760
|
+
# form parameters
|
761
|
+
form_params = opts[:form_params] || {}
|
762
|
+
|
763
|
+
# http body (model)
|
764
|
+
post_body = opts[:debug_body]
|
765
|
+
|
766
|
+
# return_type
|
767
|
+
return_type = opts[:debug_return_type] || 'RateOfReturnResponse'
|
768
|
+
|
769
|
+
# auth_names
|
770
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
771
|
+
|
772
|
+
new_options = opts.merge(
|
773
|
+
:operation => :"AccountInformationApi.get_user_account_return_rates",
|
774
|
+
:header_params => header_params,
|
775
|
+
:query_params => query_params,
|
776
|
+
:form_params => form_params,
|
777
|
+
:body => post_body,
|
778
|
+
:auth_names => auth_names,
|
779
|
+
:return_type => return_type
|
780
|
+
)
|
781
|
+
|
782
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
783
|
+
if @api_client.config.debugging
|
784
|
+
@api_client.config.logger.debug "API called: AccountInformationApi#get_user_account_return_rates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
785
|
+
end
|
786
|
+
return data, status_code, headers, response
|
787
|
+
end
|
788
|
+
|
789
|
+
|
687
790
|
# List account holdings
|
688
791
|
#
|
689
792
|
# Returns a list of balances, positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__
|
@@ -540,6 +540,109 @@ module SnapTrade
|
|
540
540
|
end
|
541
541
|
|
542
542
|
|
543
|
+
# List connection rate of returns
|
544
|
+
#
|
545
|
+
# Returns a list of rate of return percents for a given connection. Will include timeframes available from the brokerage, for example "ALL", "1Y", "6M", "3M", "1M"
|
546
|
+
#
|
547
|
+
# @param user_id [String]
|
548
|
+
# @param user_secret [String]
|
549
|
+
# @param authorization_id [String]
|
550
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
551
|
+
def return_rates(user_id:, user_secret:, authorization_id:, extra: {})
|
552
|
+
data, _status_code, _headers = return_rates_with_http_info_impl(user_id, user_secret, authorization_id, extra)
|
553
|
+
data
|
554
|
+
end
|
555
|
+
|
556
|
+
# List connection rate of returns
|
557
|
+
#
|
558
|
+
# Returns a list of rate of return percents for a given connection. Will include timeframes available from the brokerage, for example "ALL", "1Y", "6M", "3M", "1M"
|
559
|
+
#
|
560
|
+
# @param user_id [String]
|
561
|
+
# @param user_secret [String]
|
562
|
+
# @param authorization_id [String]
|
563
|
+
# @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
|
564
|
+
def return_rates_with_http_info(user_id:, user_secret:, authorization_id:, extra: {})
|
565
|
+
return_rates_with_http_info_impl(user_id, user_secret, authorization_id, extra)
|
566
|
+
end
|
567
|
+
|
568
|
+
# List connection rate of returns
|
569
|
+
# Returns a list of rate of return percents for a given connection. Will include timeframes available from the brokerage, for example \"ALL\", \"1Y\", \"6M\", \"3M\", \"1M\"
|
570
|
+
# @param user_id [String]
|
571
|
+
# @param user_secret [String]
|
572
|
+
# @param authorization_id [String]
|
573
|
+
# @param [Hash] opts the optional parameters
|
574
|
+
# @return [RateOfReturnResponse]
|
575
|
+
private def return_rates_impl(user_id, user_secret, authorization_id, opts = {})
|
576
|
+
data, _status_code, _headers = return_rates_with_http_info(user_id, user_secret, authorization_id, opts)
|
577
|
+
data
|
578
|
+
end
|
579
|
+
|
580
|
+
# List connection rate of returns
|
581
|
+
# Returns a list of rate of return percents for a given connection. Will include timeframes available from the brokerage, for example \"ALL\", \"1Y\", \"6M\", \"3M\", \"1M\"
|
582
|
+
# @param user_id [String]
|
583
|
+
# @param user_secret [String]
|
584
|
+
# @param authorization_id [String]
|
585
|
+
# @param [Hash] opts the optional parameters
|
586
|
+
# @return [Array<(RateOfReturnResponse, Integer, Hash)>] RateOfReturnResponse data, response status code and response headers
|
587
|
+
private def return_rates_with_http_info_impl(user_id, user_secret, authorization_id, opts = {})
|
588
|
+
if @api_client.config.debugging
|
589
|
+
@api_client.config.logger.debug 'Calling API: ConnectionsApi.return_rates ...'
|
590
|
+
end
|
591
|
+
# verify the required parameter 'user_id' is set
|
592
|
+
if @api_client.config.client_side_validation && user_id.nil?
|
593
|
+
fail ArgumentError, "Missing the required parameter 'user_id' when calling ConnectionsApi.return_rates"
|
594
|
+
end
|
595
|
+
# verify the required parameter 'user_secret' is set
|
596
|
+
if @api_client.config.client_side_validation && user_secret.nil?
|
597
|
+
fail ArgumentError, "Missing the required parameter 'user_secret' when calling ConnectionsApi.return_rates"
|
598
|
+
end
|
599
|
+
# verify the required parameter 'authorization_id' is set
|
600
|
+
if @api_client.config.client_side_validation && authorization_id.nil?
|
601
|
+
fail ArgumentError, "Missing the required parameter 'authorization_id' when calling ConnectionsApi.return_rates"
|
602
|
+
end
|
603
|
+
# resource path
|
604
|
+
local_var_path = '/authorizations/{authorizationId}/returnRates'.sub('{' + 'authorizationId' + '}', CGI.escape(authorization_id.to_s))
|
605
|
+
|
606
|
+
# query parameters
|
607
|
+
query_params = opts[:query_params] || {}
|
608
|
+
query_params[:'userId'] = user_id
|
609
|
+
query_params[:'userSecret'] = user_secret
|
610
|
+
|
611
|
+
# header parameters
|
612
|
+
header_params = opts[:header_params] || {}
|
613
|
+
# HTTP header 'Accept' (if needed)
|
614
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
615
|
+
|
616
|
+
# form parameters
|
617
|
+
form_params = opts[:form_params] || {}
|
618
|
+
|
619
|
+
# http body (model)
|
620
|
+
post_body = opts[:debug_body]
|
621
|
+
|
622
|
+
# return_type
|
623
|
+
return_type = opts[:debug_return_type] || 'RateOfReturnResponse'
|
624
|
+
|
625
|
+
# auth_names
|
626
|
+
auth_names = opts[:debug_auth_names] || ['PartnerClientId', 'PartnerSignature', 'PartnerTimestamp']
|
627
|
+
|
628
|
+
new_options = opts.merge(
|
629
|
+
:operation => :"ConnectionsApi.return_rates",
|
630
|
+
:header_params => header_params,
|
631
|
+
:query_params => query_params,
|
632
|
+
:form_params => form_params,
|
633
|
+
:body => post_body,
|
634
|
+
:auth_names => auth_names,
|
635
|
+
:return_type => return_type
|
636
|
+
)
|
637
|
+
|
638
|
+
data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options)
|
639
|
+
if @api_client.config.debugging
|
640
|
+
@api_client.config.logger.debug "API called: ConnectionsApi#return_rates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
641
|
+
end
|
642
|
+
return data, status_code, headers, response
|
643
|
+
end
|
644
|
+
|
645
|
+
|
543
646
|
# Get all session events for a user
|
544
647
|
#
|
545
648
|
# Returns a list of session events associated with a user.
|
@@ -0,0 +1,238 @@
|
|
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
|
+
# Individual rate of return object with return percent and timeframe
|
15
|
+
class RateOfReturnObject
|
16
|
+
# The timeframe this return percent is reflecting
|
17
|
+
attr_accessor :timeframe
|
18
|
+
|
19
|
+
# The percent return of the portfolio, directly from the brokerage. 5.97 indicates a 5.97% return over the timeframe
|
20
|
+
attr_accessor :return_percent
|
21
|
+
|
22
|
+
# The date this was fetched
|
23
|
+
attr_accessor :created_date
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'timeframe' => :'timeframe',
|
29
|
+
:'return_percent' => :'return_percent',
|
30
|
+
:'created_date' => :'created_date'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns all the JSON keys this model knows about
|
35
|
+
def self.acceptable_attributes
|
36
|
+
attribute_map.values
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.openapi_types
|
41
|
+
{
|
42
|
+
:'timeframe' => :'Timeframe',
|
43
|
+
:'return_percent' => :'Float',
|
44
|
+
:'created_date' => :'Time'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# List of attributes with nullable: true
|
49
|
+
def self.openapi_nullable
|
50
|
+
Set.new([
|
51
|
+
])
|
52
|
+
end
|
53
|
+
|
54
|
+
# Initializes the object
|
55
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
56
|
+
def initialize(attributes = {})
|
57
|
+
if (!attributes.is_a?(Hash))
|
58
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::RateOfReturnObject` initialize method"
|
59
|
+
end
|
60
|
+
|
61
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
63
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
64
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::RateOfReturnObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
65
|
+
end
|
66
|
+
h[k.to_sym] = v
|
67
|
+
}
|
68
|
+
|
69
|
+
if attributes.key?(:'timeframe')
|
70
|
+
self.timeframe = attributes[:'timeframe']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:'return_percent')
|
74
|
+
self.return_percent = attributes[:'return_percent']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.key?(:'created_date')
|
78
|
+
self.created_date = attributes[:'created_date']
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
83
|
+
# @return Array for valid properties with the reasons
|
84
|
+
def list_invalid_properties
|
85
|
+
invalid_properties = Array.new
|
86
|
+
invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
true
|
93
|
+
end
|
94
|
+
|
95
|
+
# Checks equality by comparing each attribute.
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def ==(o)
|
98
|
+
return true if self.equal?(o)
|
99
|
+
self.class == o.class &&
|
100
|
+
timeframe == o.timeframe &&
|
101
|
+
return_percent == o.return_percent &&
|
102
|
+
created_date == o.created_date
|
103
|
+
end
|
104
|
+
|
105
|
+
# @see the `==` method
|
106
|
+
# @param [Object] Object to be compared
|
107
|
+
def eql?(o)
|
108
|
+
self == o
|
109
|
+
end
|
110
|
+
|
111
|
+
# Calculates hash code according to all attributes.
|
112
|
+
# @return [Integer] Hash code
|
113
|
+
def hash
|
114
|
+
[timeframe, return_percent, created_date].hash
|
115
|
+
end
|
116
|
+
|
117
|
+
# Builds the object from hash
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
119
|
+
# @return [Object] Returns the model itself
|
120
|
+
def self.build_from_hash(attributes)
|
121
|
+
new.build_from_hash(attributes)
|
122
|
+
end
|
123
|
+
|
124
|
+
# Builds the object from hash
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
126
|
+
# @return [Object] Returns the model itself
|
127
|
+
def build_from_hash(attributes)
|
128
|
+
return nil unless attributes.is_a?(Hash)
|
129
|
+
attributes = attributes.transform_keys(&:to_sym)
|
130
|
+
self.class.openapi_types.each_pair do |key, type|
|
131
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
132
|
+
self.send("#{key}=", nil)
|
133
|
+
elsif type =~ /\AArray<(.*)>/i
|
134
|
+
# check to ensure the input is an array given that the attribute
|
135
|
+
# is documented as an array but the input is not
|
136
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
137
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
138
|
+
end
|
139
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
140
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
self
|
145
|
+
end
|
146
|
+
|
147
|
+
# Deserializes the data based on type
|
148
|
+
# @param string type Data type
|
149
|
+
# @param string value Value to be deserialized
|
150
|
+
# @return [Object] Deserialized data
|
151
|
+
def _deserialize(type, value)
|
152
|
+
case type.to_sym
|
153
|
+
when :Time
|
154
|
+
Time.parse(value)
|
155
|
+
when :Date
|
156
|
+
Date.parse(value)
|
157
|
+
when :String
|
158
|
+
value.to_s
|
159
|
+
when :Integer
|
160
|
+
value.to_i
|
161
|
+
when :Float
|
162
|
+
value.to_f
|
163
|
+
when :Boolean
|
164
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
165
|
+
true
|
166
|
+
else
|
167
|
+
false
|
168
|
+
end
|
169
|
+
when :Object
|
170
|
+
# generic object (usually a Hash), return directly
|
171
|
+
value
|
172
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
173
|
+
inner_type = Regexp.last_match[:inner_type]
|
174
|
+
value.map { |v| _deserialize(inner_type, v) }
|
175
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
176
|
+
k_type = Regexp.last_match[:k_type]
|
177
|
+
v_type = Regexp.last_match[:v_type]
|
178
|
+
{}.tap do |hash|
|
179
|
+
value.each do |k, v|
|
180
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
else # model
|
184
|
+
# models (e.g. Pet) or oneOf
|
185
|
+
klass = SnapTrade.const_get(type)
|
186
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
# Returns the string representation of the object
|
191
|
+
# @return [String] String presentation of the object
|
192
|
+
def to_s
|
193
|
+
to_hash.to_s
|
194
|
+
end
|
195
|
+
|
196
|
+
# to_body is an alias to to_hash (backward compatibility)
|
197
|
+
# @return [Hash] Returns the object in the form of hash
|
198
|
+
def to_body
|
199
|
+
to_hash
|
200
|
+
end
|
201
|
+
|
202
|
+
# Returns the object in the form of hash
|
203
|
+
# @return [Hash] Returns the object in the form of hash
|
204
|
+
def to_hash
|
205
|
+
hash = {}
|
206
|
+
self.class.attribute_map.each_pair do |attr, param|
|
207
|
+
value = self.send(attr)
|
208
|
+
if value.nil?
|
209
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
210
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
211
|
+
end
|
212
|
+
|
213
|
+
hash[param] = _to_hash(value)
|
214
|
+
end
|
215
|
+
hash
|
216
|
+
end
|
217
|
+
|
218
|
+
# Outputs non-array value in the form of hash
|
219
|
+
# For object, use to_hash. Otherwise, just return the value
|
220
|
+
# @param [Object] value Any valid value
|
221
|
+
# @return [Hash] Returns the value in the form of hash
|
222
|
+
def _to_hash(value)
|
223
|
+
if value.is_a?(Array)
|
224
|
+
value.compact.map { |v| _to_hash(v) }
|
225
|
+
elsif value.is_a?(Hash)
|
226
|
+
{}.tap do |hash|
|
227
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
228
|
+
end
|
229
|
+
elsif value.respond_to? :to_hash
|
230
|
+
value.to_hash
|
231
|
+
else
|
232
|
+
value
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
end
|
237
|
+
|
238
|
+
end
|
@@ -0,0 +1,220 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
require 'time'
|
12
|
+
|
13
|
+
module SnapTrade
|
14
|
+
# List of return rates with their timeframe
|
15
|
+
class RateOfReturnResponse
|
16
|
+
# List of return percentages
|
17
|
+
attr_accessor :data
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
:'data' => :'data'
|
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
|
+
:'data' => :'Array<RateOfReturnObject>'
|
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::RateOfReturnResponse` 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::RateOfReturnResponse`. 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?(:'data')
|
60
|
+
if (value = attributes[:'data']).is_a?(Array)
|
61
|
+
self.data = value
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
67
|
+
# @return Array for valid properties with the reasons
|
68
|
+
def list_invalid_properties
|
69
|
+
invalid_properties = Array.new
|
70
|
+
invalid_properties
|
71
|
+
end
|
72
|
+
|
73
|
+
# Check to see if the all the properties in the model are valid
|
74
|
+
# @return true if the model is valid
|
75
|
+
def valid?
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
79
|
+
# Checks equality by comparing each attribute.
|
80
|
+
# @param [Object] Object to be compared
|
81
|
+
def ==(o)
|
82
|
+
return true if self.equal?(o)
|
83
|
+
self.class == o.class &&
|
84
|
+
data == o.data
|
85
|
+
end
|
86
|
+
|
87
|
+
# @see the `==` method
|
88
|
+
# @param [Object] Object to be compared
|
89
|
+
def eql?(o)
|
90
|
+
self == o
|
91
|
+
end
|
92
|
+
|
93
|
+
# Calculates hash code according to all attributes.
|
94
|
+
# @return [Integer] Hash code
|
95
|
+
def hash
|
96
|
+
[data].hash
|
97
|
+
end
|
98
|
+
|
99
|
+
# Builds the object from hash
|
100
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
101
|
+
# @return [Object] Returns the model itself
|
102
|
+
def self.build_from_hash(attributes)
|
103
|
+
new.build_from_hash(attributes)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Builds the object from hash
|
107
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
108
|
+
# @return [Object] Returns the model itself
|
109
|
+
def build_from_hash(attributes)
|
110
|
+
return nil unless attributes.is_a?(Hash)
|
111
|
+
attributes = attributes.transform_keys(&:to_sym)
|
112
|
+
self.class.openapi_types.each_pair do |key, type|
|
113
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
114
|
+
self.send("#{key}=", nil)
|
115
|
+
elsif type =~ /\AArray<(.*)>/i
|
116
|
+
# check to ensure the input is an array given that the attribute
|
117
|
+
# is documented as an array but the input is not
|
118
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
119
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
120
|
+
end
|
121
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
122
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
self
|
127
|
+
end
|
128
|
+
|
129
|
+
# Deserializes the data based on type
|
130
|
+
# @param string type Data type
|
131
|
+
# @param string value Value to be deserialized
|
132
|
+
# @return [Object] Deserialized data
|
133
|
+
def _deserialize(type, value)
|
134
|
+
case type.to_sym
|
135
|
+
when :Time
|
136
|
+
Time.parse(value)
|
137
|
+
when :Date
|
138
|
+
Date.parse(value)
|
139
|
+
when :String
|
140
|
+
value.to_s
|
141
|
+
when :Integer
|
142
|
+
value.to_i
|
143
|
+
when :Float
|
144
|
+
value.to_f
|
145
|
+
when :Boolean
|
146
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
147
|
+
true
|
148
|
+
else
|
149
|
+
false
|
150
|
+
end
|
151
|
+
when :Object
|
152
|
+
# generic object (usually a Hash), return directly
|
153
|
+
value
|
154
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
155
|
+
inner_type = Regexp.last_match[:inner_type]
|
156
|
+
value.map { |v| _deserialize(inner_type, v) }
|
157
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
158
|
+
k_type = Regexp.last_match[:k_type]
|
159
|
+
v_type = Regexp.last_match[:v_type]
|
160
|
+
{}.tap do |hash|
|
161
|
+
value.each do |k, v|
|
162
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
else # model
|
166
|
+
# models (e.g. Pet) or oneOf
|
167
|
+
klass = SnapTrade.const_get(type)
|
168
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# Returns the string representation of the object
|
173
|
+
# @return [String] String presentation of the object
|
174
|
+
def to_s
|
175
|
+
to_hash.to_s
|
176
|
+
end
|
177
|
+
|
178
|
+
# to_body is an alias to to_hash (backward compatibility)
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
180
|
+
def to_body
|
181
|
+
to_hash
|
182
|
+
end
|
183
|
+
|
184
|
+
# Returns the object in the form of hash
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_hash
|
187
|
+
hash = {}
|
188
|
+
self.class.attribute_map.each_pair do |attr, param|
|
189
|
+
value = self.send(attr)
|
190
|
+
if value.nil?
|
191
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
192
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
193
|
+
end
|
194
|
+
|
195
|
+
hash[param] = _to_hash(value)
|
196
|
+
end
|
197
|
+
hash
|
198
|
+
end
|
199
|
+
|
200
|
+
# Outputs non-array value in the form of hash
|
201
|
+
# For object, use to_hash. Otherwise, just return the value
|
202
|
+
# @param [Object] value Any valid value
|
203
|
+
# @return [Hash] Returns the value in the form of hash
|
204
|
+
def _to_hash(value)
|
205
|
+
if value.is_a?(Array)
|
206
|
+
value.compact.map { |v| _to_hash(v) }
|
207
|
+
elsif value.is_a?(Hash)
|
208
|
+
{}.tap do |hash|
|
209
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
210
|
+
end
|
211
|
+
elsif value.respond_to? :to_hash
|
212
|
+
value.to_hash
|
213
|
+
else
|
214
|
+
value
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
@@ -16,7 +16,7 @@ module SnapTrade
|
|
16
16
|
# Unique identifier for the security type within SnapTrade. This is the ID used to reference the security type in SnapTrade API calls.
|
17
17
|
attr_accessor :id
|
18
18
|
|
19
|
-
# A short code representing the security type. For example, \"cs\" for Common Stock. Here are some common values: ad - ADR bnd - Bond cs - Common Stock cef - Closed End Fund et - ETF oef - Open Ended Fund ps - Preferred Stock rt - Right struct - Structured Product ut - Unit wi - When Issued wt - Warrant
|
19
|
+
# A short code representing the security type. For example, \"cs\" for Common Stock. Here are some common values: - `ad` - ADR - `bnd` - Bond - `cs` - Common Stock - `cef` - Closed End Fund - `et` - ETF - `oef` - Open Ended Fund - `ps` - Preferred Stock - `rt` - Right - `struct` - Structured Product - `ut` - Unit - `wi` - When Issued - `wt` - Warrant
|
20
20
|
attr_accessor :code
|
21
21
|
|
22
22
|
# A human-readable description of the security type. For example, \"Common Stock\" or \"ETF\".
|
@@ -0,0 +1,40 @@
|
|
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 Timeframe
|
15
|
+
ALL = "ALL".freeze
|
16
|
+
N1_Y = "1Y".freeze
|
17
|
+
N6_M = "6M".freeze
|
18
|
+
N3_M = "3M".freeze
|
19
|
+
N1_M = "1M".freeze
|
20
|
+
|
21
|
+
def self.all_vars
|
22
|
+
@all_vars ||= [ALL, N1_Y, N6_M, N3_M, N1_M].freeze
|
23
|
+
end
|
24
|
+
|
25
|
+
# Builds the enum from string
|
26
|
+
# @param [String] The enum value in the form of the string
|
27
|
+
# @return [String] The enum value
|
28
|
+
def self.build_from_hash(value)
|
29
|
+
new.build_from_hash(value)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Builds the enum from string
|
33
|
+
# @param [String] The enum value in the form of the string
|
34
|
+
# @return [String] The enum value
|
35
|
+
def build_from_hash(value)
|
36
|
+
return value if Timeframe.all_vars.include?(value)
|
37
|
+
raise "Invalid ENUM value #{value} for class #Timeframe"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -16,7 +16,7 @@ module SnapTrade
|
|
16
16
|
# Unique identifier for the security type within SnapTrade. This is the ID used to reference the security type in SnapTrade API calls.
|
17
17
|
attr_accessor :id
|
18
18
|
|
19
|
-
# A short code representing the security type. For example, \"cs\" for Common Stock. Here are some common values: ad - ADR bnd - Bond cs - Common Stock cef - Closed End Fund et - ETF oef - Open Ended Fund ps - Preferred Stock rt - Right struct - Structured Product ut - Unit wi - When Issued wt - Warrant
|
19
|
+
# A short code representing the security type. For example, \"cs\" for Common Stock. Here are some common values: - `ad` - ADR - `bnd` - Bond - `cs` - Common Stock - `cef` - Closed End Fund - `et` - ETF - `oef` - Open Ended Fund - `ps` - Preferred Stock - `rt` - Right - `struct` - Structured Product - `ut` - Unit - `wi` - When Issued - `wt` - Warrant
|
20
20
|
attr_accessor :code
|
21
21
|
|
22
22
|
# A human-readable description of the security type. For example, \"Common Stock\" or \"ETF\".
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
@@ -94,6 +94,8 @@ require 'snaptrade/models/past_value'
|
|
94
94
|
require 'snaptrade/models/performance_custom'
|
95
95
|
require 'snaptrade/models/position'
|
96
96
|
require 'snaptrade/models/position_symbol'
|
97
|
+
require 'snaptrade/models/rate_of_return_object'
|
98
|
+
require 'snaptrade/models/rate_of_return_response'
|
97
99
|
require 'snaptrade/models/recent_orders_response'
|
98
100
|
require 'snaptrade/models/security_type'
|
99
101
|
require 'snaptrade/models/session_event'
|
@@ -116,6 +118,7 @@ require 'snaptrade/models/symbol_figi_instrument'
|
|
116
118
|
require 'snaptrade/models/symbol_query'
|
117
119
|
require 'snaptrade/models/symbols_quotes_inner'
|
118
120
|
require 'snaptrade/models/time_in_force_strict'
|
121
|
+
require 'snaptrade/models/timeframe'
|
119
122
|
require 'snaptrade/models/trading_cancel_user_account_order_request'
|
120
123
|
require 'snaptrade/models/transactions_status'
|
121
124
|
require 'snaptrade/models/type'
|
@@ -113,6 +113,20 @@ describe 'AccountInformationApi' do
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
+
# unit tests for get_user_account_return_rates
|
117
|
+
# List account rate of returns
|
118
|
+
# Returns a list of rate of return percents for a given account. Will include timeframes available from the brokerage, for example \"ALL\", \"1Y\", \"6M\", \"3M\", \"1M\"
|
119
|
+
# @param user_id
|
120
|
+
# @param user_secret
|
121
|
+
# @param account_id
|
122
|
+
# @param [Hash] opts the optional parameters
|
123
|
+
# @return [RateOfReturnResponse]
|
124
|
+
describe 'get_user_account_return_rates test' do
|
125
|
+
it 'should work' do
|
126
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
116
130
|
# unit tests for get_user_holdings
|
117
131
|
# List account holdings
|
118
132
|
# Returns a list of balances, positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__ The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**.
|
@@ -96,6 +96,20 @@ describe 'ConnectionsApi' do
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
+
# unit tests for return_rates
|
100
|
+
# List connection rate of returns
|
101
|
+
# Returns a list of rate of return percents for a given connection. Will include timeframes available from the brokerage, for example \"ALL\", \"1Y\", \"6M\", \"3M\", \"1M\"
|
102
|
+
# @param user_id
|
103
|
+
# @param user_secret
|
104
|
+
# @param authorization_id
|
105
|
+
# @param [Hash] opts the optional parameters
|
106
|
+
# @return [RateOfReturnResponse]
|
107
|
+
describe 'return_rates test' do
|
108
|
+
it 'should work' do
|
109
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
99
113
|
# unit tests for session_events
|
100
114
|
# Get all session events for a user
|
101
115
|
# Returns a list of session events associated with a user.
|
@@ -0,0 +1,41 @@
|
|
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::RateOfReturnObject
|
15
|
+
describe SnapTrade::RateOfReturnObject do
|
16
|
+
let(:instance) { SnapTrade::RateOfReturnObject.new }
|
17
|
+
|
18
|
+
describe 'test an instance of RateOfReturnObject' do
|
19
|
+
it 'should create an instance of RateOfReturnObject' do
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::RateOfReturnObject)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe 'test attribute "timeframe"' 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 "return_percent"' 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 "created_date"' 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
|
+
end
|
@@ -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::RateOfReturnResponse
|
15
|
+
describe SnapTrade::RateOfReturnResponse do
|
16
|
+
let(:instance) { SnapTrade::RateOfReturnResponse.new }
|
17
|
+
|
18
|
+
describe 'test an instance of RateOfReturnResponse' do
|
19
|
+
it 'should create an instance of RateOfReturnResponse' do
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::RateOfReturnResponse)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
describe 'test attribute "data"' 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
|
@@ -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::Timeframe
|
15
|
+
describe SnapTrade::Timeframe do
|
16
|
+
let(:instance) { SnapTrade::Timeframe.new }
|
17
|
+
|
18
|
+
describe 'test an instance of Timeframe' do
|
19
|
+
it 'should create an instance of Timeframe' do
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::Timeframe)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
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.56
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SnapTrade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -173,6 +173,8 @@ files:
|
|
173
173
|
- lib/snaptrade/models/performance_custom.rb
|
174
174
|
- lib/snaptrade/models/position.rb
|
175
175
|
- lib/snaptrade/models/position_symbol.rb
|
176
|
+
- lib/snaptrade/models/rate_of_return_object.rb
|
177
|
+
- lib/snaptrade/models/rate_of_return_response.rb
|
176
178
|
- lib/snaptrade/models/recent_orders_response.rb
|
177
179
|
- lib/snaptrade/models/security_type.rb
|
178
180
|
- lib/snaptrade/models/session_event.rb
|
@@ -195,6 +197,7 @@ files:
|
|
195
197
|
- lib/snaptrade/models/symbol_query.rb
|
196
198
|
- lib/snaptrade/models/symbols_quotes_inner.rb
|
197
199
|
- lib/snaptrade/models/time_in_force_strict.rb
|
200
|
+
- lib/snaptrade/models/timeframe.rb
|
198
201
|
- lib/snaptrade/models/trading_cancel_user_account_order_request.rb
|
199
202
|
- lib/snaptrade/models/transactions_status.rb
|
200
203
|
- lib/snaptrade/models/type.rb
|
@@ -300,6 +303,8 @@ files:
|
|
300
303
|
- spec/models/performance_custom_spec.rb
|
301
304
|
- spec/models/position_spec.rb
|
302
305
|
- spec/models/position_symbol_spec.rb
|
306
|
+
- spec/models/rate_of_return_object_spec.rb
|
307
|
+
- spec/models/rate_of_return_response_spec.rb
|
303
308
|
- spec/models/recent_orders_response_spec.rb
|
304
309
|
- spec/models/security_type_spec.rb
|
305
310
|
- spec/models/session_event_spec.rb
|
@@ -322,6 +327,7 @@ files:
|
|
322
327
|
- spec/models/symbol_spec.rb
|
323
328
|
- spec/models/symbols_quotes_inner_spec.rb
|
324
329
|
- spec/models/time_in_force_strict_spec.rb
|
330
|
+
- spec/models/timeframe_spec.rb
|
325
331
|
- spec/models/trading_cancel_user_account_order_request_spec.rb
|
326
332
|
- spec/models/transactions_status_spec.rb
|
327
333
|
- spec/models/type_spec.rb
|
@@ -431,12 +437,14 @@ test_files:
|
|
431
437
|
- spec/models/options_place_option_strategy_request_spec.rb
|
432
438
|
- spec/models/notional_value_spec.rb
|
433
439
|
- spec/models/account_order_record_universal_symbol_spec.rb
|
440
|
+
- spec/models/timeframe_spec.rb
|
434
441
|
- spec/models/session_event_type_spec.rb
|
435
442
|
- spec/models/underlying_symbol_spec.rb
|
436
443
|
- spec/models/trading_cancel_user_account_order_request_spec.rb
|
437
444
|
- spec/models/us_exchange_spec.rb
|
438
445
|
- spec/models/strategy_order_record_status_spec.rb
|
439
446
|
- spec/models/balance_spec.rb
|
447
|
+
- spec/models/rate_of_return_object_spec.rb
|
440
448
|
- spec/models/universal_symbol_spec.rb
|
441
449
|
- spec/models/strategy_quotes_greek_spec.rb
|
442
450
|
- spec/models/options_position_spec.rb
|
@@ -470,6 +478,7 @@ test_files:
|
|
470
478
|
- spec/models/options_position_currency_spec.rb
|
471
479
|
- spec/models/authentication_login_snap_trade_user200_response_spec.rb
|
472
480
|
- spec/models/account_holdings_spec.rb
|
481
|
+
- spec/models/rate_of_return_response_spec.rb
|
473
482
|
- spec/models/encrypted_response_encrypted_message_data_spec.rb
|
474
483
|
- spec/models/strategy_type_spec.rb
|
475
484
|
- spec/models/manual_trade_and_impact_spec.rb
|