snaptrade 1.12.0 → 1.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -1
- data/docs/BrokerageSymbol.md +4 -2
- data/docs/BrokerageSymbolOptionSymbol.md +32 -0
- data/docs/BrokerageSymbolSymbol.md +32 -0
- data/docs/OptionsPosition.md +10 -8
- data/docs/OptionsPositionCurrency.md +22 -0
- data/docs/OptionsSymbol.md +3 -9
- data/docs/Position.md +3 -1
- data/docs/UniversalActivity.md +1 -1
- data/docs/UserIDandSecret.md +1 -1
- data/lib/snaptrade/models/brokerage_symbol.rb +17 -6
- data/lib/snaptrade/models/brokerage_symbol_option_symbol.rb +287 -0
- data/lib/snaptrade/models/brokerage_symbol_symbol.rb +290 -0
- data/lib/snaptrade/models/options_position.rb +40 -25
- data/lib/snaptrade/models/options_position_currency.rb +242 -0
- data/lib/snaptrade/models/options_symbol.rb +7 -36
- data/lib/snaptrade/models/position.rb +16 -5
- data/lib/snaptrade/models/universal_activity.rb +1 -1
- data/lib/snaptrade/models/user_i_dand_secret.rb +1 -1
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +3 -0
- data/spec/models/brokerage_symbol_option_symbol_spec.rb +72 -0
- data/spec/models/brokerage_symbol_spec.rb +6 -0
- data/spec/models/brokerage_symbol_symbol_spec.rb +72 -0
- data/spec/models/options_position_currency_spec.rb +42 -0
- data/spec/models/options_position_spec.rb +12 -6
- data/spec/models/options_symbol_spec.rb +1 -19
- data/spec/models/position_spec.rb +6 -0
- metadata +14 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b145b8d37b4404626e867090cda31862a8e85df7d74997f1a4c514a82c6de55f
|
4
|
+
data.tar.gz: 9f25d29f4064feb78c6dc9eefbcdb17f81d0a7fcf2ce15c444505ba503dbe26d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66541d183c4254fa293c874c0c80573b972d15c670a667e4061a4b01cd2c2b83f866b2a7678b764c74f458f41118c65e8b2cc95c4bf7e59f91f738885d3d059a
|
7
|
+
data.tar.gz: 83d31339af8591b9f263dbd54657e4d29afffd3b4d5554201b651c5d6d22109483f80dc3510bb039ebf15b9102eaaeb8ed108312f1d63a02df55059901b6edd1
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@ For more information, please visit [https://snaptrade.com/](https://snaptrade.co
|
|
9
9
|
Add to Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem 'snaptrade', '~> 1.
|
12
|
+
gem 'snaptrade', '~> 1.14.0'
|
13
13
|
```
|
14
14
|
|
15
15
|
## Getting Started
|
@@ -109,6 +109,8 @@ Class | Method | HTTP request | Description
|
|
109
109
|
- [SnapTrade::BrokerageAuthorizationTypeReadOnlyType](docs/BrokerageAuthorizationTypeReadOnlyType.md)
|
110
110
|
- [SnapTrade::BrokerageAuthorizationTypeType](docs/BrokerageAuthorizationTypeType.md)
|
111
111
|
- [SnapTrade::BrokerageSymbol](docs/BrokerageSymbol.md)
|
112
|
+
- [SnapTrade::BrokerageSymbolOptionSymbol](docs/BrokerageSymbolOptionSymbol.md)
|
113
|
+
- [SnapTrade::BrokerageSymbolSymbol](docs/BrokerageSymbolSymbol.md)
|
112
114
|
- [SnapTrade::BrokerageType](docs/BrokerageType.md)
|
113
115
|
- [SnapTrade::CalculatedTrade](docs/CalculatedTrade.md)
|
114
116
|
- [SnapTrade::CashRestriction](docs/CashRestriction.md)
|
@@ -155,6 +157,7 @@ Class | Method | HTTP request | Description
|
|
155
157
|
- [SnapTrade::OptionsHoldings](docs/OptionsHoldings.md)
|
156
158
|
- [SnapTrade::OptionsPlaceOptionStrategyRequest](docs/OptionsPlaceOptionStrategyRequest.md)
|
157
159
|
- [SnapTrade::OptionsPosition](docs/OptionsPosition.md)
|
160
|
+
- [SnapTrade::OptionsPositionCurrency](docs/OptionsPositionCurrency.md)
|
158
161
|
- [SnapTrade::OptionsSymbol](docs/OptionsSymbol.md)
|
159
162
|
- [SnapTrade::OrderStrategyExecuteBodyOrderType](docs/OrderStrategyExecuteBodyOrderType.md)
|
160
163
|
- [SnapTrade::OrderStrategyExecuteBodyTimeInForce](docs/OrderStrategyExecuteBodyTimeInForce.md)
|
data/docs/BrokerageSymbol.md
CHANGED
@@ -5,10 +5,11 @@
|
|
5
5
|
| Name | Type | Description | Notes |
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
7
7
|
| **id** | **String** | | [optional] |
|
8
|
-
| **symbol** | [**
|
8
|
+
| **symbol** | [**BrokerageSymbolSymbol**](BrokerageSymbolSymbol.md) | | [optional] |
|
9
9
|
| **brokerage_authorization** | [**BrokerageAuthorization**](BrokerageAuthorization.md) | | [optional] |
|
10
10
|
| **description** | **String** | | [optional] |
|
11
11
|
| **allows_fractional_units** | **Boolean** | | [optional] |
|
12
|
+
| **option_symbol** | [**BrokerageSymbolOptionSymbol**](BrokerageSymbolOptionSymbol.md) | | [optional] |
|
12
13
|
|
13
14
|
## Example
|
14
15
|
|
@@ -20,7 +21,8 @@ instance = SnapTrade::BrokerageSymbol.new(
|
|
20
21
|
symbol: null,
|
21
22
|
brokerage_authorization: null,
|
22
23
|
description: VANGUARD CDN AGGREGATE BOND INDEX ETF,
|
23
|
-
allows_fractional_units: true
|
24
|
+
allows_fractional_units: true,
|
25
|
+
option_symbol: null
|
24
26
|
)
|
25
27
|
```
|
26
28
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# SnapTrade::BrokerageSymbolOptionSymbol
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **id** | **String** | | [optional] |
|
8
|
+
| **ticker** | **String** | | [optional] |
|
9
|
+
| **strike_price** | **Float** | | [optional] |
|
10
|
+
| **expiration_date** | **String** | | [optional] |
|
11
|
+
| **is_mini_option** | **Boolean** | | [optional] |
|
12
|
+
| **underlying_symbol** | [**UnderlyingSymbol**](UnderlyingSymbol.md) | | [optional] |
|
13
|
+
| **local_id** | **String** | | [optional] |
|
14
|
+
| **exchange_id** | **String** | | [optional] |
|
15
|
+
|
16
|
+
## Example
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
require 'snaptrade'
|
20
|
+
|
21
|
+
instance = SnapTrade::BrokerageSymbolOptionSymbol.new(
|
22
|
+
id: 2bcd7cc3-e922-4976-bce1-9858296801c3,
|
23
|
+
ticker: SPY 220819P00200000,
|
24
|
+
strike_price: 200,
|
25
|
+
expiration_date: 2017-07-17T15:13:07.177712+00:00,
|
26
|
+
is_mini_option: false,
|
27
|
+
underlying_symbol: null,
|
28
|
+
local_id: 40817960,
|
29
|
+
exchange_id: null
|
30
|
+
)
|
31
|
+
```
|
32
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# SnapTrade::BrokerageSymbolSymbol
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **id** | **String** | | [optional] |
|
8
|
+
| **symbol** | **String** | | [optional] |
|
9
|
+
| **raw_symbol** | **String** | | [optional] |
|
10
|
+
| **description** | **String** | | [optional] |
|
11
|
+
| **currency** | [**Currency**](Currency.md) | | [optional] |
|
12
|
+
| **exchange** | [**Exchange**](Exchange.md) | | [optional] |
|
13
|
+
| **type** | [**SecurityType**](SecurityType.md) | | [optional] |
|
14
|
+
| **currencies** | [**Array<Currency>**](Currency.md) | | [optional] |
|
15
|
+
|
16
|
+
## Example
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
require 'snaptrade'
|
20
|
+
|
21
|
+
instance = SnapTrade::BrokerageSymbolSymbol.new(
|
22
|
+
id: 2bcd7cc3-e922-4976-bce1-9858296801c3,
|
23
|
+
symbol: VAB.TO,
|
24
|
+
raw_symbol: VAB,
|
25
|
+
description: VANGUARD CDN AGGREGATE BOND INDEX ETF,
|
26
|
+
currency: null,
|
27
|
+
exchange: null,
|
28
|
+
type: null,
|
29
|
+
currencies: null
|
30
|
+
)
|
31
|
+
```
|
32
|
+
|
data/docs/OptionsPosition.md
CHANGED
@@ -4,13 +4,14 @@
|
|
4
4
|
|
5
5
|
| Name | Type | Description | Notes |
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
7
|
-
| **symbol** | **
|
8
|
-
| **description** | **String** | | [optional] |
|
9
|
-
| **option_symbol** | [**OptionsSymbol**](OptionsSymbol.md) | | [optional] |
|
7
|
+
| **symbol** | [**BrokerageSymbol**](BrokerageSymbol.md) | | [optional] |
|
10
8
|
| **price** | **Float** | Trade Price if limit or stop limit order | [optional] |
|
11
9
|
| **units** | **Float** | | [optional] |
|
12
|
-
| **currency** | [**
|
10
|
+
| **currency** | [**OptionsPositionCurrency**](OptionsPositionCurrency.md) | | [optional] |
|
13
11
|
| **average_purchase_price** | **Float** | Average purchase price for this position | [optional] |
|
12
|
+
| **open_pnl** | **Float** | | [optional] |
|
13
|
+
| **fractional_units** | **Float** | Deprecated, use the units field for both fractional and integer units going forward | [optional] |
|
14
|
+
| **book_price** | **Float** | The book price of the asset | [optional] |
|
14
15
|
|
15
16
|
## Example
|
16
17
|
|
@@ -18,13 +19,14 @@
|
|
18
19
|
require 'snaptrade'
|
19
20
|
|
20
21
|
instance = SnapTrade::OptionsPosition.new(
|
21
|
-
symbol:
|
22
|
-
description: SPY PUT Aug 2022,
|
23
|
-
option_symbol: null,
|
22
|
+
symbol: null,
|
24
23
|
price: 31.33,
|
25
24
|
units: 10,
|
26
25
|
currency: null,
|
27
|
-
average_purchase_price: 108.3353
|
26
|
+
average_purchase_price: 108.3353,
|
27
|
+
open_pnl: 0.44,
|
28
|
+
fractional_units: 1.44,
|
29
|
+
book_price: 5
|
28
30
|
)
|
29
31
|
```
|
30
32
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# SnapTrade::OptionsPositionCurrency
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **id** | **String** | | [optional] |
|
8
|
+
| **code** | **String** | | [optional] |
|
9
|
+
| **name** | **String** | | [optional] |
|
10
|
+
|
11
|
+
## Example
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'snaptrade'
|
15
|
+
|
16
|
+
instance = SnapTrade::OptionsPositionCurrency.new(
|
17
|
+
id: 87b24961-b51e-4db8-9226-f198f6518a89,
|
18
|
+
code: USD,
|
19
|
+
name: US Dollar
|
20
|
+
)
|
21
|
+
```
|
22
|
+
|
data/docs/OptionsSymbol.md
CHANGED
@@ -11,10 +11,7 @@
|
|
11
11
|
| **is_mini_option** | **Boolean** | | [optional] |
|
12
12
|
| **underlying_symbol** | [**UnderlyingSymbol**](UnderlyingSymbol.md) | | [optional] |
|
13
13
|
| **local_id** | **String** | | [optional] |
|
14
|
-
| **
|
15
|
-
| **listing_exchange** | **Object** | | [optional] |
|
16
|
-
| **is_quotable** | **Boolean** | | [optional] |
|
17
|
-
| **is_tradable** | **Boolean** | | [optional] |
|
14
|
+
| **exchange_id** | **String** | | [optional] |
|
18
15
|
|
19
16
|
## Example
|
20
17
|
|
@@ -25,14 +22,11 @@ instance = SnapTrade::OptionsSymbol.new(
|
|
25
22
|
id: 2bcd7cc3-e922-4976-bce1-9858296801c3,
|
26
23
|
ticker: SPY 220819P00200000,
|
27
24
|
strike_price: 200,
|
28
|
-
expiration_date:
|
25
|
+
expiration_date: 2017-07-17T15:13:07.177712+00:00,
|
29
26
|
is_mini_option: false,
|
30
27
|
underlying_symbol: null,
|
31
28
|
local_id: 40817960,
|
32
|
-
|
33
|
-
listing_exchange: {},
|
34
|
-
is_quotable: true,
|
35
|
-
is_tradable: true
|
29
|
+
exchange_id: null
|
36
30
|
)
|
37
31
|
```
|
38
32
|
|
data/docs/Position.md
CHANGED
@@ -10,6 +10,7 @@
|
|
10
10
|
| **open_pnl** | **Float** | | [optional] |
|
11
11
|
| **fractional_units** | **Float** | Deprecated, use the units field for both fractional and integer units going forward | [optional] |
|
12
12
|
| **average_purchase_price** | **Float** | Average purchase price for this position. Either returned by the underlying broker or calculated using historical transactions. | [optional] |
|
13
|
+
| **book_price** | **Float** | The book price of the asset | [optional] |
|
13
14
|
|
14
15
|
## Example
|
15
16
|
|
@@ -22,7 +23,8 @@ instance = SnapTrade::Position.new(
|
|
22
23
|
price: 113.15,
|
23
24
|
open_pnl: 0.44,
|
24
25
|
fractional_units: 1.44,
|
25
|
-
average_purchase_price: 108.3353
|
26
|
+
average_purchase_price: 108.3353,
|
27
|
+
book_price: 5
|
26
28
|
)
|
27
29
|
```
|
28
30
|
|
data/docs/UniversalActivity.md
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
| **symbol** | [**Symbol**](Symbol.md) | | [optional] |
|
19
19
|
| **option_symbol** | [**OptionsSymbol**](OptionsSymbol.md) | | [optional] |
|
20
20
|
| **trade_date** | **String** | | [optional] |
|
21
|
-
| **type** | **String** | Potential values include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT | [optional] |
|
21
|
+
| **type** | **String** | Potential values include (but are not limited to) - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT | [optional] |
|
22
22
|
| **units** | **Float** | Usually but not necessarily an integer | [optional] |
|
23
23
|
|
24
24
|
## Example
|
data/docs/UserIDandSecret.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
| Name | Type | Description | Notes |
|
6
6
|
| ---- | ---- | ----------- | ----- |
|
7
7
|
| **user_id** | **String** | SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it's unique to a user | [optional] |
|
8
|
-
| **user_secret** | **String** | SnapTrade User Secret randomly generated by
|
8
|
+
| **user_secret** | **String** | SnapTrade User Secret randomly generated by SnapTrade. This should be considered priviledged information and if compromised, you should delete and re-create this SnapTrade user. | [optional] |
|
9
9
|
|
10
10
|
## Example
|
11
11
|
|
@@ -24,6 +24,8 @@ module SnapTrade
|
|
24
24
|
|
25
25
|
attr_accessor :allows_fractional_units
|
26
26
|
|
27
|
+
attr_accessor :option_symbol
|
28
|
+
|
27
29
|
# Attribute mapping from ruby-style variable name to JSON key.
|
28
30
|
def self.attribute_map
|
29
31
|
{
|
@@ -31,7 +33,8 @@ module SnapTrade
|
|
31
33
|
:'symbol' => :'symbol',
|
32
34
|
:'brokerage_authorization' => :'brokerage_authorization',
|
33
35
|
:'description' => :'description',
|
34
|
-
:'allows_fractional_units' => :'allows_fractional_units'
|
36
|
+
:'allows_fractional_units' => :'allows_fractional_units',
|
37
|
+
:'option_symbol' => :'option_symbol'
|
35
38
|
}
|
36
39
|
end
|
37
40
|
|
@@ -44,17 +47,20 @@ module SnapTrade
|
|
44
47
|
def self.openapi_types
|
45
48
|
{
|
46
49
|
:'id' => :'String',
|
47
|
-
:'symbol' => :'
|
50
|
+
:'symbol' => :'BrokerageSymbolSymbol',
|
48
51
|
:'brokerage_authorization' => :'BrokerageAuthorization',
|
49
52
|
:'description' => :'String',
|
50
|
-
:'allows_fractional_units' => :'Boolean'
|
53
|
+
:'allows_fractional_units' => :'Boolean',
|
54
|
+
:'option_symbol' => :'BrokerageSymbolOptionSymbol'
|
51
55
|
}
|
52
56
|
end
|
53
57
|
|
54
58
|
# List of attributes with nullable: true
|
55
59
|
def self.openapi_nullable
|
56
60
|
Set.new([
|
57
|
-
:'
|
61
|
+
:'symbol',
|
62
|
+
:'allows_fractional_units',
|
63
|
+
:'option_symbol'
|
58
64
|
])
|
59
65
|
end
|
60
66
|
|
@@ -92,6 +98,10 @@ module SnapTrade
|
|
92
98
|
if attributes.key?(:'allows_fractional_units')
|
93
99
|
self.allows_fractional_units = attributes[:'allows_fractional_units']
|
94
100
|
end
|
101
|
+
|
102
|
+
if attributes.key?(:'option_symbol')
|
103
|
+
self.option_symbol = attributes[:'option_symbol']
|
104
|
+
end
|
95
105
|
end
|
96
106
|
|
97
107
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -116,7 +126,8 @@ module SnapTrade
|
|
116
126
|
symbol == o.symbol &&
|
117
127
|
brokerage_authorization == o.brokerage_authorization &&
|
118
128
|
description == o.description &&
|
119
|
-
allows_fractional_units == o.allows_fractional_units
|
129
|
+
allows_fractional_units == o.allows_fractional_units &&
|
130
|
+
option_symbol == o.option_symbol
|
120
131
|
end
|
121
132
|
|
122
133
|
# @see the `==` method
|
@@ -128,7 +139,7 @@ module SnapTrade
|
|
128
139
|
# Calculates hash code according to all attributes.
|
129
140
|
# @return [Integer] Hash code
|
130
141
|
def hash
|
131
|
-
[id, symbol, brokerage_authorization, description, allows_fractional_units].hash
|
142
|
+
[id, symbol, brokerage_authorization, description, allows_fractional_units, option_symbol].hash
|
132
143
|
end
|
133
144
|
|
134
145
|
# Builds the object from hash
|
@@ -0,0 +1,287 @@
|
|
1
|
+
=begin
|
2
|
+
#SnapTrade
|
3
|
+
|
4
|
+
#Connect brokerage accounts to your app for live positions and trading
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
Contact: api@snaptrade.com
|
8
|
+
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'date'
|
12
|
+
require 'time'
|
13
|
+
|
14
|
+
module SnapTrade
|
15
|
+
class BrokerageSymbolOptionSymbol
|
16
|
+
attr_accessor :id
|
17
|
+
|
18
|
+
attr_accessor :ticker
|
19
|
+
|
20
|
+
attr_accessor :strike_price
|
21
|
+
|
22
|
+
attr_accessor :expiration_date
|
23
|
+
|
24
|
+
attr_accessor :is_mini_option
|
25
|
+
|
26
|
+
attr_accessor :underlying_symbol
|
27
|
+
|
28
|
+
attr_accessor :local_id
|
29
|
+
|
30
|
+
attr_accessor :exchange_id
|
31
|
+
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
33
|
+
def self.attribute_map
|
34
|
+
{
|
35
|
+
:'id' => :'id',
|
36
|
+
:'ticker' => :'ticker',
|
37
|
+
:'strike_price' => :'strike_price',
|
38
|
+
:'expiration_date' => :'expiration_date',
|
39
|
+
:'is_mini_option' => :'is_mini_option',
|
40
|
+
:'underlying_symbol' => :'underlying_symbol',
|
41
|
+
:'local_id' => :'local_id',
|
42
|
+
:'exchange_id' => :'exchange_id'
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Returns all the JSON keys this model knows about
|
47
|
+
def self.acceptable_attributes
|
48
|
+
attribute_map.values
|
49
|
+
end
|
50
|
+
|
51
|
+
# Attribute type mapping.
|
52
|
+
def self.openapi_types
|
53
|
+
{
|
54
|
+
:'id' => :'String',
|
55
|
+
:'ticker' => :'String',
|
56
|
+
:'strike_price' => :'Float',
|
57
|
+
:'expiration_date' => :'String',
|
58
|
+
:'is_mini_option' => :'Boolean',
|
59
|
+
:'underlying_symbol' => :'UnderlyingSymbol',
|
60
|
+
:'local_id' => :'String',
|
61
|
+
:'exchange_id' => :'String'
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
# List of attributes with nullable: true
|
66
|
+
def self.openapi_nullable
|
67
|
+
Set.new([
|
68
|
+
])
|
69
|
+
end
|
70
|
+
|
71
|
+
# List of class defined in allOf (OpenAPI v3)
|
72
|
+
def self.openapi_all_of
|
73
|
+
[
|
74
|
+
:'OptionsSymbol'
|
75
|
+
]
|
76
|
+
end
|
77
|
+
|
78
|
+
# Initializes the object
|
79
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
80
|
+
def initialize(attributes = {})
|
81
|
+
if (!attributes.is_a?(Hash))
|
82
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::BrokerageSymbolOptionSymbol` initialize method"
|
83
|
+
end
|
84
|
+
|
85
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
86
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
87
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
88
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::BrokerageSymbolOptionSymbol`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
89
|
+
end
|
90
|
+
h[k.to_sym] = v
|
91
|
+
}
|
92
|
+
|
93
|
+
if attributes.key?(:'id')
|
94
|
+
self.id = attributes[:'id']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.key?(:'ticker')
|
98
|
+
self.ticker = attributes[:'ticker']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'strike_price')
|
102
|
+
self.strike_price = attributes[:'strike_price']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'expiration_date')
|
106
|
+
self.expiration_date = attributes[:'expiration_date']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'is_mini_option')
|
110
|
+
self.is_mini_option = attributes[:'is_mini_option']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'underlying_symbol')
|
114
|
+
self.underlying_symbol = attributes[:'underlying_symbol']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'local_id')
|
118
|
+
self.local_id = attributes[:'local_id']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.key?(:'exchange_id')
|
122
|
+
self.exchange_id = attributes[:'exchange_id']
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
127
|
+
# @return Array for valid properties with the reasons
|
128
|
+
def list_invalid_properties
|
129
|
+
invalid_properties = Array.new
|
130
|
+
invalid_properties
|
131
|
+
end
|
132
|
+
|
133
|
+
# Check to see if the all the properties in the model are valid
|
134
|
+
# @return true if the model is valid
|
135
|
+
def valid?
|
136
|
+
true
|
137
|
+
end
|
138
|
+
|
139
|
+
# Checks equality by comparing each attribute.
|
140
|
+
# @param [Object] Object to be compared
|
141
|
+
def ==(o)
|
142
|
+
return true if self.equal?(o)
|
143
|
+
self.class == o.class &&
|
144
|
+
id == o.id &&
|
145
|
+
ticker == o.ticker &&
|
146
|
+
strike_price == o.strike_price &&
|
147
|
+
expiration_date == o.expiration_date &&
|
148
|
+
is_mini_option == o.is_mini_option &&
|
149
|
+
underlying_symbol == o.underlying_symbol &&
|
150
|
+
local_id == o.local_id &&
|
151
|
+
exchange_id == o.exchange_id
|
152
|
+
end
|
153
|
+
|
154
|
+
# @see the `==` method
|
155
|
+
# @param [Object] Object to be compared
|
156
|
+
def eql?(o)
|
157
|
+
self == o
|
158
|
+
end
|
159
|
+
|
160
|
+
# Calculates hash code according to all attributes.
|
161
|
+
# @return [Integer] Hash code
|
162
|
+
def hash
|
163
|
+
[id, ticker, strike_price, expiration_date, is_mini_option, underlying_symbol, local_id, exchange_id].hash
|
164
|
+
end
|
165
|
+
|
166
|
+
# Builds the object from hash
|
167
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
168
|
+
# @return [Object] Returns the model itself
|
169
|
+
def self.build_from_hash(attributes)
|
170
|
+
new.build_from_hash(attributes)
|
171
|
+
end
|
172
|
+
|
173
|
+
# Builds the object from hash
|
174
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
175
|
+
# @return [Object] Returns the model itself
|
176
|
+
def build_from_hash(attributes)
|
177
|
+
return nil unless attributes.is_a?(Hash)
|
178
|
+
attributes = attributes.transform_keys(&:to_sym)
|
179
|
+
self.class.openapi_types.each_pair do |key, type|
|
180
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
181
|
+
self.send("#{key}=", nil)
|
182
|
+
elsif type =~ /\AArray<(.*)>/i
|
183
|
+
# check to ensure the input is an array given that the attribute
|
184
|
+
# is documented as an array but the input is not
|
185
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
186
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
187
|
+
end
|
188
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
189
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
self
|
194
|
+
end
|
195
|
+
|
196
|
+
# Deserializes the data based on type
|
197
|
+
# @param string type Data type
|
198
|
+
# @param string value Value to be deserialized
|
199
|
+
# @return [Object] Deserialized data
|
200
|
+
def _deserialize(type, value)
|
201
|
+
case type.to_sym
|
202
|
+
when :Time
|
203
|
+
Time.parse(value)
|
204
|
+
when :Date
|
205
|
+
Date.parse(value)
|
206
|
+
when :String
|
207
|
+
value.to_s
|
208
|
+
when :Integer
|
209
|
+
value.to_i
|
210
|
+
when :Float
|
211
|
+
value.to_f
|
212
|
+
when :Boolean
|
213
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
214
|
+
true
|
215
|
+
else
|
216
|
+
false
|
217
|
+
end
|
218
|
+
when :Object
|
219
|
+
# generic object (usually a Hash), return directly
|
220
|
+
value
|
221
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
222
|
+
inner_type = Regexp.last_match[:inner_type]
|
223
|
+
value.map { |v| _deserialize(inner_type, v) }
|
224
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
225
|
+
k_type = Regexp.last_match[:k_type]
|
226
|
+
v_type = Regexp.last_match[:v_type]
|
227
|
+
{}.tap do |hash|
|
228
|
+
value.each do |k, v|
|
229
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
else # model
|
233
|
+
# models (e.g. Pet) or oneOf
|
234
|
+
klass = SnapTrade.const_get(type)
|
235
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
# Returns the string representation of the object
|
240
|
+
# @return [String] String presentation of the object
|
241
|
+
def to_s
|
242
|
+
to_hash.to_s
|
243
|
+
end
|
244
|
+
|
245
|
+
# to_body is an alias to to_hash (backward compatibility)
|
246
|
+
# @return [Hash] Returns the object in the form of hash
|
247
|
+
def to_body
|
248
|
+
to_hash
|
249
|
+
end
|
250
|
+
|
251
|
+
# Returns the object in the form of hash
|
252
|
+
# @return [Hash] Returns the object in the form of hash
|
253
|
+
def to_hash
|
254
|
+
hash = {}
|
255
|
+
self.class.attribute_map.each_pair do |attr, param|
|
256
|
+
value = self.send(attr)
|
257
|
+
if value.nil?
|
258
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
259
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
260
|
+
end
|
261
|
+
|
262
|
+
hash[param] = _to_hash(value)
|
263
|
+
end
|
264
|
+
hash
|
265
|
+
end
|
266
|
+
|
267
|
+
# Outputs non-array value in the form of hash
|
268
|
+
# For object, use to_hash. Otherwise, just return the value
|
269
|
+
# @param [Object] value Any valid value
|
270
|
+
# @return [Hash] Returns the value in the form of hash
|
271
|
+
def _to_hash(value)
|
272
|
+
if value.is_a?(Array)
|
273
|
+
value.compact.map { |v| _to_hash(v) }
|
274
|
+
elsif value.is_a?(Hash)
|
275
|
+
{}.tap do |hash|
|
276
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
277
|
+
end
|
278
|
+
elsif value.respond_to? :to_hash
|
279
|
+
value.to_hash
|
280
|
+
else
|
281
|
+
value
|
282
|
+
end
|
283
|
+
end
|
284
|
+
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|