snaptrade 2.0.30 → 2.0.31

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90d2830fdcb3a1406af0db439f7cdec6d02b895b715c4a90093dca06c4a5e787
4
- data.tar.gz: 67b0d298c28363d224e26a59cd559de0a0330498da7877e81cc3d95f03660460
3
+ metadata.gz: 4473f0d7f5cc9ca2466287af5c01b2d7eb3a32f20bb08407b5192c4f43d1bde5
4
+ data.tar.gz: 95e42f51f88e79ccc23e880f96075ff27904bacaf355b31ab2ed656d7a3c11b7
5
5
  SHA512:
6
- metadata.gz: 6a5af9e47b615b7eee91ec656eda1acb7a8006066df7519c2e7947371fbc09e085f1ed31e8644318033664a64d09e91eab57d468987730b9f9e28a7f6393c05d
7
- data.tar.gz: 3a282337bbcad359000d485fb143dbcf9598e8a3a10fcc5b6d4844893f8aeb8d2ac57e69df4504e5d2f982252554aa2ee5ddf54f402bb1511a19c6f3b0e63f94
6
+ metadata.gz: 4a9684055202d8e628a2411cb281e854e54ee10a129b382eccccce0319357b8df46240646466406d57a2e9d0704406f177b453e85f2d416b3a63c1ee84b76fbe
7
+ data.tar.gz: a8f50d47809964ba63c21f15ce16f5265495973ceced0c85fb1fae94a85c8b6605ed7b86f5df5b370e76f7b77a57c54606e354e53058a21a9293d0ff227eb55c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- snaptrade (2.0.29)
4
+ snaptrade (2.0.30)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart (~> 1.0, >= 1.0.4)
7
7
 
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Connect brokerage accounts to your app for live positions and trading
8
8
 
9
- [![npm](https://img.shields.io/badge/gem-v2.0.30-blue)](https://rubygems.org/gems/snaptrade/versions/2.0.30)
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.30'
73
+ gem 'snaptrade', '~> 2.0.31'
74
74
  ```
75
75
 
76
76
  ## Getting Started<a id="getting-started"></a>
@@ -303,9 +303,7 @@ The ID of the account to get positions.
303
303
 
304
304
  ### `snaptrade.account_information.get_user_holdings`<a id="snaptradeaccount_informationget_user_holdings"></a>
305
305
 
306
- Lists balances, positions and orders for the specified account as well as
307
- option_positions and account metadata. The data returned is similar to the
308
- 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.__
309
307
 
310
308
 
311
309
  #### 🛠️ Usage<a id="🛠️-usage"></a>
@@ -322,8 +320,6 @@ p result
322
320
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
323
321
 
324
322
  ##### account_id: `String`<a id="account_id-string"></a>
325
- The ID of the account to fetch holdings for.
326
-
327
323
  ##### user_id: `String`<a id="user_id-string"></a>
328
324
  ##### user_secret: `String`<a id="user_secret-string"></a>
329
325
  #### 🔄 Return<a id="🔄-return"></a>
@@ -561,13 +561,11 @@ module SnapTrade
561
561
  end
562
562
 
563
563
 
564
- # List balances, positions and orders for the specified account
564
+ # List account holdings
565
565
  #
566
- # Lists balances, positions and orders for the specified account as well as
567
- # option_positions and account metadata. The data returned is similar to the
568
- # 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.__
569
567
  #
570
- # @param account_id [String] The ID of the account to fetch holdings for.
568
+ # @param account_id [String]
571
569
  # @param user_id [String]
572
570
  # @param user_secret [String]
573
571
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
@@ -576,13 +574,11 @@ module SnapTrade
576
574
  data
577
575
  end
578
576
 
579
- # List balances, positions and orders for the specified account
577
+ # List account holdings
580
578
  #
581
- # Lists balances, positions and orders for the specified account as well as
582
- # option_positions and account metadata. The data returned is similar to the
583
- # 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.__
584
580
  #
585
- # @param account_id [String] The ID of the account to fetch holdings for.
581
+ # @param account_id [String]
586
582
  # @param user_id [String]
587
583
  # @param user_secret [String]
588
584
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
@@ -590,9 +586,9 @@ module SnapTrade
590
586
  get_user_holdings_with_http_info_impl(account_id, user_id, user_secret, extra)
591
587
  end
592
588
 
593
- # List balances, positions and orders for the specified account
594
- # Lists balances, positions and orders for the specified account as well as option_positions and account metadata. The data returned is similar to the data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
595
- # @param account_id [String] The ID of the account to fetch holdings for.
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]
596
592
  # @param user_id [String]
597
593
  # @param user_secret [String]
598
594
  # @param [Hash] opts the optional parameters
@@ -602,9 +598,9 @@ module SnapTrade
602
598
  data
603
599
  end
604
600
 
605
- # List balances, positions and orders for the specified account
606
- # Lists balances, positions and orders for the specified account as well as option_positions and account metadata. The data returned is similar to the data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
607
- # @param account_id [String] The ID of the account to fetch holdings for.
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]
608
604
  # @param user_id [String]
609
605
  # @param user_secret [String]
610
606
  # @param [Hash] opts the optional parameters
@@ -11,7 +11,7 @@ require 'date'
11
11
  require 'time'
12
12
 
13
13
  module SnapTrade
14
- # Balance of the account
14
+ # Contains balance related information for the account.
15
15
  class AccountBalance
16
16
  attr_accessor :total
17
17
 
@@ -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
- # Account Holdings with Account ID
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
- # Account Balance
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
- # Currency
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
- # Option Holdings
14
+ # Describes a single option position in an account.
15
15
  class OptionsPosition
16
16
  attr_accessor :symbol
17
17
 
18
- # Trade Price if limit or stop limit order
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
- # Average purchase price for this position
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
- # Account Position
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
- # Average purchase price for this position. Either returned by the underlying broker or calculated using historical transactions.
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
- # Holdings with account ID
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
- # Time
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' => :'String'
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
- # Calculated based on the sum of the values of account positions and cash balances
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.
@@ -8,5 +8,5 @@ Contact: api@snaptrade.com
8
8
  =end
9
9
 
10
10
  module SnapTrade
11
- VERSION = '2.0.30'
11
+ VERSION = '2.0.31'
12
12
  end
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'
@@ -100,9 +100,9 @@ describe 'AccountInformationApi' do
100
100
  end
101
101
 
102
102
  # unit tests for get_user_holdings
103
- # List balances, positions and orders for the specified account
104
- # Lists balances, positions and orders for the specified account as well as option_positions and account metadata. The data returned is similar to the data returned over the more fine-grained **positions**, **orders** and **balances** endpoints.
105
- # @param account_id The ID of the account to fetch holdings for.
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
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.30
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-08-01 00:00:00.000000000 Z
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