snaptrade 2.0.32 → 2.0.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +26 -21
- data/lib/snaptrade/api/account_information_api.rb +70 -52
- data/lib/snaptrade/api/options_api.rb +16 -12
- data/lib/snaptrade/models/account.rb +13 -3
- data/lib/snaptrade/models/account_balance_total.rb +1 -8
- data/lib/snaptrade/models/account_holdings_account.rb +2 -2
- data/lib/snaptrade/models/account_order_record.rb +22 -18
- data/lib/snaptrade/models/{snap_trade_holdings_account_account_id_balance.rb → account_order_record_option_symbol.rb} +102 -12
- data/lib/snaptrade/models/{snap_trade_holdings_account_account_id.rb → account_order_record_universal_symbol.rb} +106 -73
- data/lib/snaptrade/models/account_sync_status.rb +1 -1
- data/lib/snaptrade/models/balance.rb +1 -1
- data/lib/snaptrade/models/{cash_restriction.rb → balance_currency.rb} +27 -35
- data/lib/snaptrade/models/brokerage_authorization_type_read_only.rb +1 -1
- data/lib/snaptrade/models/holdings_status.rb +4 -4
- data/lib/snaptrade/models/monthly_dividends.rb +1 -1
- data/lib/snaptrade/models/net_contributions.rb +1 -1
- data/lib/snaptrade/models/order_type_strict.rb +2 -2
- data/lib/snaptrade/models/past_value.rb +1 -1
- data/lib/snaptrade/models/strategy_order_record.rb +1 -1
- data/lib/snaptrade/models/sub_period_return_rate.rb +2 -2
- data/lib/snaptrade/models/transactions_status.rb +4 -5
- data/lib/snaptrade/models/type.rb +3 -3
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +3 -5
- data/spec/api/account_information_api_spec.rb +12 -12
- data/spec/api/options_api_spec.rb +3 -3
- data/spec/models/{cash_restriction_spec.rb → account_order_record_option_symbol_spec.rb} +22 -10
- data/spec/models/{snap_trade_holdings_account_account_id_spec.rb → account_order_record_universal_symbol_spec.rb} +15 -15
- data/spec/models/balance_currency_spec.rb +41 -0
- metadata +11 -17
- data/lib/snaptrade/models/amount.rb +0 -228
- data/lib/snaptrade/models/brokerage_authorization_type_read_only_type.rb +0 -37
- data/spec/models/amount_spec.rb +0 -35
- data/spec/models/brokerage_authorization_type_read_only_type_spec.rb +0 -23
- data/spec/models/snap_trade_holdings_account_account_id_balance_spec.rb +0 -29
@@ -11,24 +11,33 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
#
|
14
|
+
# A single brokerage account at a financial institution.
|
15
15
|
class Account
|
16
|
+
# Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade. This ID should not change for as long as the connection stays active. If the connection is deleted and re-added, a new account ID will be generated. If you want a stable identifier for the account, use the `number` field.
|
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
|
|
34
|
+
# 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.
|
28
35
|
attr_accessor :created_date
|
29
36
|
|
37
|
+
# 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
38
|
attr_accessor :meta
|
31
39
|
|
40
|
+
# This field is deprecated.
|
32
41
|
attr_accessor :cash_restrictions
|
33
42
|
|
34
43
|
attr_accessor :sync_status
|
@@ -66,9 +75,9 @@ module SnapTrade
|
|
66
75
|
:'name' => :'String',
|
67
76
|
:'number' => :'String',
|
68
77
|
:'institution_name' => :'String',
|
69
|
-
:'created_date' => :'
|
78
|
+
:'created_date' => :'Time',
|
70
79
|
:'meta' => :'Hash<String, Object>',
|
71
|
-
:'cash_restrictions' => :'Array<
|
80
|
+
:'cash_restrictions' => :'Array<String>',
|
72
81
|
:'sync_status' => :'AccountSyncStatus',
|
73
82
|
:'balance' => :'AccountBalance'
|
74
83
|
}
|
@@ -77,6 +86,7 @@ module SnapTrade
|
|
77
86
|
# List of attributes with nullable: true
|
78
87
|
def self.openapi_nullable
|
79
88
|
Set.new([
|
89
|
+
:'name',
|
80
90
|
])
|
81
91
|
end
|
82
92
|
|
@@ -11,7 +11,7 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
# Total value of this account (includes cash, equity, fixed income, etc)
|
14
|
+
# Total market value of this account (includes cash, equity, fixed income, etc). This value is directly obtained from the brokerage and should reflect the most accurate value of the account.
|
15
15
|
class AccountBalanceTotal
|
16
16
|
# Total value denominated in the currency of the `currency` field.
|
17
17
|
attr_accessor :amount
|
@@ -46,13 +46,6 @@ module SnapTrade
|
|
46
46
|
])
|
47
47
|
end
|
48
48
|
|
49
|
-
# List of class defined in allOf (OpenAPI v3)
|
50
|
-
def self.openapi_all_of
|
51
|
-
[
|
52
|
-
:'Amount'
|
53
|
-
]
|
54
|
-
end
|
55
|
-
|
56
49
|
# Initializes the object
|
57
50
|
# @param [Hash] attributes Model attributes in the form of hash
|
58
51
|
def initialize(attributes = {})
|
@@ -24,7 +24,7 @@ module SnapTrade
|
|
24
24
|
# List of option positions in the account.
|
25
25
|
attr_accessor :option_positions
|
26
26
|
|
27
|
-
# List of recent orders in the account, including both pending and executed orders.
|
27
|
+
# List of recent orders in the account, including both pending and executed orders. Note that option orders are included in this list. Option orders will have a null `universal_symbol` field and a non-null `option_symbol` field.
|
28
28
|
attr_accessor :orders
|
29
29
|
|
30
30
|
attr_accessor :total_value
|
@@ -49,7 +49,7 @@ module SnapTrade
|
|
49
49
|
# Attribute type mapping.
|
50
50
|
def self.openapi_types
|
51
51
|
{
|
52
|
-
:'account' => :'
|
52
|
+
:'account' => :'Account',
|
53
53
|
:'balances' => :'Array<Balance>',
|
54
54
|
:'positions' => :'Array<Position>',
|
55
55
|
:'option_positions' => :'Array<OptionsPosition>',
|
@@ -11,7 +11,7 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
# Describes a single recent order in an account.
|
14
|
+
# Describes a single recent order in an account. Each record here represents a single order leg. For multi-leg orders, there will be multiple records.
|
15
15
|
class AccountOrderRecord
|
16
16
|
# Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
|
17
17
|
attr_accessor :brokerage_order_id
|
@@ -26,43 +26,46 @@ module SnapTrade
|
|
26
26
|
|
27
27
|
attr_accessor :option_symbol
|
28
28
|
|
29
|
-
#
|
29
|
+
# The action describes the intent or side of a trade. This is usually `BUY` or `SELL` but can include other potential values like the following depending on the specific brokerage. - BUY - SELL - BUY_COVER - SELL_SHORT - BUY_OPEN - BUY_CLOSE - SELL_OPEN - SELL_CLOSE
|
30
30
|
attr_accessor :action
|
31
31
|
|
32
|
+
# The total number of shares or contracts of the order. This should be the sum of the filled, canceled, and open quantities. Can be a decimal number for fractional shares.
|
32
33
|
attr_accessor :total_quantity
|
33
34
|
|
34
|
-
#
|
35
|
+
# The number of shares or contracts that are still open (waiting for execution). Can be a decimal number for fractional shares.
|
35
36
|
attr_accessor :open_quantity
|
36
37
|
|
37
|
-
#
|
38
|
+
# The number of shares or contracts that have been canceled. Can be a decimal number for fractional shares.
|
38
39
|
attr_accessor :canceled_quantity
|
39
40
|
|
40
|
-
#
|
41
|
+
# The number of shares or contracts that have been filled. Can be a decimal number for fractional shares.
|
41
42
|
attr_accessor :filled_quantity
|
42
43
|
|
43
|
-
#
|
44
|
+
# The price at which the order was executed.
|
44
45
|
attr_accessor :execution_price
|
45
46
|
|
46
|
-
#
|
47
|
+
# The limit price is maximum price one is willing to pay for a buy order or the minimum price one is willing to accept for a sell order. Should only apply to `Limit` and `StopLimit` orders.
|
47
48
|
attr_accessor :limit_price
|
48
49
|
|
49
|
-
#
|
50
|
+
# The stop price is the price at which a stop order is triggered. Should only apply to `Stop` and `StopLimit` orders.
|
50
51
|
attr_accessor :stop_price
|
51
52
|
|
52
|
-
#
|
53
|
+
# The type of order placed. The most common values are `Market`, `Limit`, `Stop`, and `StopLimit`. We try our best to map brokerage order types to these values. When mapping fails, we will return the brokerage's order type value.
|
53
54
|
attr_accessor :order_type
|
54
55
|
|
55
|
-
#
|
56
|
+
# The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. We try our best to map brokerage time in force values to the following. When mapping fails, we will return the brokerage's time in force value. - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
|
56
57
|
attr_accessor :time_in_force
|
57
58
|
|
58
|
-
#
|
59
|
+
# The time the order was placed. This is the time the order was submitted to the brokerage.
|
59
60
|
attr_accessor :time_placed
|
60
61
|
|
62
|
+
# The time the order was last updated in the brokerage system. This value is not always available from the brokerage.
|
61
63
|
attr_accessor :time_updated
|
62
64
|
|
65
|
+
# The time the order was executed in the brokerage system. This value is not always available from the brokerage.
|
63
66
|
attr_accessor :time_executed
|
64
67
|
|
65
|
-
#
|
68
|
+
# The time the order expires. This value is not always available from the brokerage.
|
66
69
|
attr_accessor :expiry_date
|
67
70
|
|
68
71
|
# Attribute mapping from ruby-style variable name to JSON key.
|
@@ -101,8 +104,8 @@ module SnapTrade
|
|
101
104
|
:'brokerage_order_id' => :'String',
|
102
105
|
:'status' => :'AccountOrderRecordStatus',
|
103
106
|
:'symbol' => :'String',
|
104
|
-
:'universal_symbol' => :'
|
105
|
-
:'option_symbol' => :'
|
107
|
+
:'universal_symbol' => :'AccountOrderRecordUniversalSymbol',
|
108
|
+
:'option_symbol' => :'AccountOrderRecordOptionSymbol',
|
106
109
|
:'action' => :'String',
|
107
110
|
:'total_quantity' => :'Float',
|
108
111
|
:'open_quantity' => :'Float',
|
@@ -113,10 +116,10 @@ module SnapTrade
|
|
113
116
|
:'stop_price' => :'Float',
|
114
117
|
:'order_type' => :'String',
|
115
118
|
:'time_in_force' => :'String',
|
116
|
-
:'time_placed' => :'
|
117
|
-
:'time_updated' => :'
|
118
|
-
:'time_executed' => :'
|
119
|
-
:'expiry_date' => :'
|
119
|
+
:'time_placed' => :'Time',
|
120
|
+
:'time_updated' => :'Time',
|
121
|
+
:'time_executed' => :'Time',
|
122
|
+
:'expiry_date' => :'Time'
|
120
123
|
}
|
121
124
|
end
|
122
125
|
|
@@ -133,6 +136,7 @@ module SnapTrade
|
|
133
136
|
:'order_type',
|
134
137
|
:'time_updated',
|
135
138
|
:'time_executed',
|
139
|
+
:'expiry_date'
|
136
140
|
])
|
137
141
|
end
|
138
142
|
|
@@ -11,13 +11,38 @@ require 'date'
|
|
11
11
|
require 'time'
|
12
12
|
|
13
13
|
module SnapTrade
|
14
|
-
|
15
|
-
|
14
|
+
# Contains information about the option contract that the order is for. This field is only present for option orders. For stock/ETF/crypto/mutual fund orders, this field will be null and the `universal_symbol` field will be populated.
|
15
|
+
class AccountOrderRecordOptionSymbol
|
16
|
+
# Unique identifier for the option symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
|
17
|
+
attr_accessor :id
|
18
|
+
|
19
|
+
# The [OCC symbol](https://en.wikipedia.org/wiki/Option_symbol) for the option.
|
20
|
+
attr_accessor :ticker
|
21
|
+
|
22
|
+
# The type of option. Either \"CALL\" or \"PUT\".
|
23
|
+
attr_accessor :option_type
|
24
|
+
|
25
|
+
# The option strike price.
|
26
|
+
attr_accessor :strike_price
|
27
|
+
|
28
|
+
# The option expiration date.
|
29
|
+
attr_accessor :expiration_date
|
30
|
+
|
31
|
+
# Whether the option is a mini option. Mini options have 10 underlying shares per contract instead of the standard 100.
|
32
|
+
attr_accessor :is_mini_option
|
33
|
+
|
34
|
+
attr_accessor :underlying_symbol
|
16
35
|
|
17
36
|
# Attribute mapping from ruby-style variable name to JSON key.
|
18
37
|
def self.attribute_map
|
19
38
|
{
|
20
|
-
:'
|
39
|
+
:'id' => :'id',
|
40
|
+
:'ticker' => :'ticker',
|
41
|
+
:'option_type' => :'option_type',
|
42
|
+
:'strike_price' => :'strike_price',
|
43
|
+
:'expiration_date' => :'expiration_date',
|
44
|
+
:'is_mini_option' => :'is_mini_option',
|
45
|
+
:'underlying_symbol' => :'underlying_symbol'
|
21
46
|
}
|
22
47
|
end
|
23
48
|
|
@@ -29,21 +54,26 @@ module SnapTrade
|
|
29
54
|
# Attribute type mapping.
|
30
55
|
def self.openapi_types
|
31
56
|
{
|
32
|
-
:'
|
57
|
+
:'id' => :'String',
|
58
|
+
:'ticker' => :'String',
|
59
|
+
:'option_type' => :'OptionType',
|
60
|
+
:'strike_price' => :'Float',
|
61
|
+
:'expiration_date' => :'Date',
|
62
|
+
:'is_mini_option' => :'Boolean',
|
63
|
+
:'underlying_symbol' => :'UnderlyingSymbol'
|
33
64
|
}
|
34
65
|
end
|
35
66
|
|
36
67
|
# List of attributes with nullable: true
|
37
68
|
def self.openapi_nullable
|
38
69
|
Set.new([
|
39
|
-
:'total'
|
40
70
|
])
|
41
71
|
end
|
42
72
|
|
43
73
|
# List of class defined in allOf (OpenAPI v3)
|
44
74
|
def self.openapi_all_of
|
45
75
|
[
|
46
|
-
:'
|
76
|
+
:'OptionsSymbol'
|
47
77
|
]
|
48
78
|
end
|
49
79
|
|
@@ -51,19 +81,43 @@ module SnapTrade
|
|
51
81
|
# @param [Hash] attributes Model attributes in the form of hash
|
52
82
|
def initialize(attributes = {})
|
53
83
|
if (!attributes.is_a?(Hash))
|
54
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::
|
84
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::AccountOrderRecordOptionSymbol` initialize method"
|
55
85
|
end
|
56
86
|
|
57
87
|
# check to see if the attribute exists and convert string to symbol for hash key
|
58
88
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
89
|
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::AccountOrderRecordOptionSymbol`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
61
91
|
end
|
62
92
|
h[k.to_sym] = v
|
63
93
|
}
|
64
94
|
|
65
|
-
if attributes.key?(:'
|
66
|
-
self.
|
95
|
+
if attributes.key?(:'id')
|
96
|
+
self.id = attributes[:'id']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'ticker')
|
100
|
+
self.ticker = attributes[:'ticker']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:'option_type')
|
104
|
+
self.option_type = attributes[:'option_type']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:'strike_price')
|
108
|
+
self.strike_price = attributes[:'strike_price']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'expiration_date')
|
112
|
+
self.expiration_date = attributes[:'expiration_date']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'is_mini_option')
|
116
|
+
self.is_mini_option = attributes[:'is_mini_option']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'underlying_symbol')
|
120
|
+
self.underlying_symbol = attributes[:'underlying_symbol']
|
67
121
|
end
|
68
122
|
end
|
69
123
|
|
@@ -71,12 +125,42 @@ module SnapTrade
|
|
71
125
|
# @return Array for valid properties with the reasons
|
72
126
|
def list_invalid_properties
|
73
127
|
invalid_properties = Array.new
|
128
|
+
if @id.nil?
|
129
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
130
|
+
end
|
131
|
+
|
132
|
+
if @ticker.nil?
|
133
|
+
invalid_properties.push('invalid value for "ticker", ticker cannot be nil.')
|
134
|
+
end
|
135
|
+
|
136
|
+
if @option_type.nil?
|
137
|
+
invalid_properties.push('invalid value for "option_type", option_type cannot be nil.')
|
138
|
+
end
|
139
|
+
|
140
|
+
if @strike_price.nil?
|
141
|
+
invalid_properties.push('invalid value for "strike_price", strike_price cannot be nil.')
|
142
|
+
end
|
143
|
+
|
144
|
+
if @expiration_date.nil?
|
145
|
+
invalid_properties.push('invalid value for "expiration_date", expiration_date cannot be nil.')
|
146
|
+
end
|
147
|
+
|
148
|
+
if @underlying_symbol.nil?
|
149
|
+
invalid_properties.push('invalid value for "underlying_symbol", underlying_symbol cannot be nil.')
|
150
|
+
end
|
151
|
+
|
74
152
|
invalid_properties
|
75
153
|
end
|
76
154
|
|
77
155
|
# Check to see if the all the properties in the model are valid
|
78
156
|
# @return true if the model is valid
|
79
157
|
def valid?
|
158
|
+
return false if @id.nil?
|
159
|
+
return false if @ticker.nil?
|
160
|
+
return false if @option_type.nil?
|
161
|
+
return false if @strike_price.nil?
|
162
|
+
return false if @expiration_date.nil?
|
163
|
+
return false if @underlying_symbol.nil?
|
80
164
|
true
|
81
165
|
end
|
82
166
|
|
@@ -85,7 +169,13 @@ module SnapTrade
|
|
85
169
|
def ==(o)
|
86
170
|
return true if self.equal?(o)
|
87
171
|
self.class == o.class &&
|
88
|
-
|
172
|
+
id == o.id &&
|
173
|
+
ticker == o.ticker &&
|
174
|
+
option_type == o.option_type &&
|
175
|
+
strike_price == o.strike_price &&
|
176
|
+
expiration_date == o.expiration_date &&
|
177
|
+
is_mini_option == o.is_mini_option &&
|
178
|
+
underlying_symbol == o.underlying_symbol
|
89
179
|
end
|
90
180
|
|
91
181
|
# @see the `==` method
|
@@ -97,7 +187,7 @@ module SnapTrade
|
|
97
187
|
# Calculates hash code according to all attributes.
|
98
188
|
# @return [Integer] Hash code
|
99
189
|
def hash
|
100
|
-
[
|
190
|
+
[id, ticker, option_type, strike_price, expiration_date, is_mini_option, underlying_symbol].hash
|
101
191
|
end
|
102
192
|
|
103
193
|
# Builds the object from hash
|