snaptrade 3.0.6 → 3.0.8
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 +7 -7
- data/lib/snaptrade/api/experimental_endpoints_api.rb +21 -21
- data/lib/snaptrade/models/account_order_record_v2.rb +24 -43
- data/lib/snaptrade/models/account_order_record_v2_order_role.rb +38 -0
- data/lib/snaptrade/models/connection_account_sync_status.rb +1 -1
- data/lib/snaptrade/models/deposit_account.rb +16 -16
- data/lib/snaptrade/models/{deposit_account_balance.rb → deposit_account_net_value.rb} +4 -4
- data/lib/snaptrade/models/deposit_account_sync_status.rb +228 -0
- data/lib/snaptrade/models/investment_account.rb +27 -27
- data/lib/snaptrade/models/{investment_account_market_value.rb → investment_account_net_value.rb} +4 -4
- data/lib/snaptrade/models/price_effect.rb +39 -0
- data/lib/snaptrade/version.rb +1 -1
- data/lib/snaptrade.rb +5 -2
- data/spec/api/experimental_endpoints_api_spec.rb +2 -2
- data/spec/models/account_order_record_v2_order_role_spec.rb +23 -0
- data/spec/models/account_order_record_v2_spec.rb +7 -5
- data/spec/models/{deposit_account_balance_spec.rb → deposit_account_net_value_spec.rb} +6 -6
- data/spec/models/deposit_account_spec.rb +1 -1
- data/spec/models/deposit_account_sync_status_spec.rb +35 -0
- data/spec/models/{investment_account_market_value_spec.rb → investment_account_net_value_spec.rb} +6 -6
- data/spec/models/investment_account_spec.rb +4 -4
- data/spec/models/price_effect_spec.rb +23 -0
- metadata +225 -216
|
@@ -0,0 +1,228 @@
|
|
|
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
|
+
# Contains status updates for the account sync process between SnapTrade and the institution, used by `DepositAccount` in `Connections_listConnectionAccounts`. Each property is optional -- an institution may not report sync status for every data type. Deposit accounts don't place orders or hold positions, so unlike `ConnectionAccountSyncStatus` this type has no `orders` or `positions` field. `balances` is the timestamp of the last successful sync of that data type (null if never synced).
|
|
15
|
+
class DepositAccountSyncStatus
|
|
16
|
+
attr_accessor :transactions
|
|
17
|
+
|
|
18
|
+
# The last time balances were successfully synced by SnapTrade.
|
|
19
|
+
attr_accessor :balances
|
|
20
|
+
|
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
22
|
+
def self.attribute_map
|
|
23
|
+
{
|
|
24
|
+
:'transactions' => :'transactions',
|
|
25
|
+
:'balances' => :'balances'
|
|
26
|
+
}
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Returns all the JSON keys this model knows about
|
|
30
|
+
def self.acceptable_attributes
|
|
31
|
+
attribute_map.values
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Attribute type mapping.
|
|
35
|
+
def self.openapi_types
|
|
36
|
+
{
|
|
37
|
+
:'transactions' => :'TransactionsStatus',
|
|
38
|
+
:'balances' => :'Time'
|
|
39
|
+
}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# List of attributes with nullable: true
|
|
43
|
+
def self.openapi_nullable
|
|
44
|
+
Set.new([
|
|
45
|
+
:'balances'
|
|
46
|
+
])
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Initializes the object
|
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
51
|
+
def initialize(attributes = {})
|
|
52
|
+
if (!attributes.is_a?(Hash))
|
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::DepositAccountSyncStatus` initialize method"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::DepositAccountSyncStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
60
|
+
end
|
|
61
|
+
h[k.to_sym] = v
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if attributes.key?(:'transactions')
|
|
65
|
+
self.transactions = attributes[:'transactions']
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
if attributes.key?(:'balances')
|
|
69
|
+
self.balances = attributes[:'balances']
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
74
|
+
# @return Array for valid properties with the reasons
|
|
75
|
+
def list_invalid_properties
|
|
76
|
+
invalid_properties = Array.new
|
|
77
|
+
invalid_properties
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Check to see if the all the properties in the model are valid
|
|
81
|
+
# @return true if the model is valid
|
|
82
|
+
def valid?
|
|
83
|
+
true
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Checks equality by comparing each attribute.
|
|
87
|
+
# @param [Object] Object to be compared
|
|
88
|
+
def ==(o)
|
|
89
|
+
return true if self.equal?(o)
|
|
90
|
+
self.class == o.class &&
|
|
91
|
+
transactions == o.transactions &&
|
|
92
|
+
balances == o.balances
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# @see the `==` method
|
|
96
|
+
# @param [Object] Object to be compared
|
|
97
|
+
def eql?(o)
|
|
98
|
+
self == o
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Calculates hash code according to all attributes.
|
|
102
|
+
# @return [Integer] Hash code
|
|
103
|
+
def hash
|
|
104
|
+
[transactions, balances].hash
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Builds the object from hash
|
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
109
|
+
# @return [Object] Returns the model itself
|
|
110
|
+
def self.build_from_hash(attributes)
|
|
111
|
+
new.build_from_hash(attributes)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Builds the object from hash
|
|
115
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
116
|
+
# @return [Object] Returns the model itself
|
|
117
|
+
def build_from_hash(attributes)
|
|
118
|
+
return nil unless attributes.is_a?(Hash)
|
|
119
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
120
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
121
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
122
|
+
self.send("#{key}=", nil)
|
|
123
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
124
|
+
# check to ensure the input is an array given that the attribute
|
|
125
|
+
# is documented as an array but the input is not
|
|
126
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
127
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
128
|
+
end
|
|
129
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
130
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
self
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Deserializes the data based on type
|
|
138
|
+
# @param string type Data type
|
|
139
|
+
# @param string value Value to be deserialized
|
|
140
|
+
# @return [Object] Deserialized data
|
|
141
|
+
def _deserialize(type, value)
|
|
142
|
+
case type.to_sym
|
|
143
|
+
when :Time
|
|
144
|
+
Time.parse(value)
|
|
145
|
+
when :Date
|
|
146
|
+
Date.parse(value)
|
|
147
|
+
when :String
|
|
148
|
+
value.to_s
|
|
149
|
+
when :Integer
|
|
150
|
+
value.to_i
|
|
151
|
+
when :Float
|
|
152
|
+
value.to_f
|
|
153
|
+
when :Boolean
|
|
154
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
155
|
+
true
|
|
156
|
+
else
|
|
157
|
+
false
|
|
158
|
+
end
|
|
159
|
+
when :Object
|
|
160
|
+
# generic object (usually a Hash), return directly
|
|
161
|
+
value
|
|
162
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
163
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
164
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
165
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
166
|
+
k_type = Regexp.last_match[:k_type]
|
|
167
|
+
v_type = Regexp.last_match[:v_type]
|
|
168
|
+
{}.tap do |hash|
|
|
169
|
+
value.each do |k, v|
|
|
170
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
else # model
|
|
174
|
+
# models (e.g. Pet) or oneOf
|
|
175
|
+
klass = SnapTrade.const_get(type)
|
|
176
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Returns the string representation of the object
|
|
181
|
+
# @return [String] String presentation of the object
|
|
182
|
+
def to_s
|
|
183
|
+
to_hash.to_s
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
|
188
|
+
def to_body
|
|
189
|
+
to_hash
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# Returns the object in the form of hash
|
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
|
194
|
+
def to_hash
|
|
195
|
+
hash = {}
|
|
196
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
197
|
+
value = self.send(attr)
|
|
198
|
+
if value.nil?
|
|
199
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
200
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
hash[param] = _to_hash(value)
|
|
204
|
+
end
|
|
205
|
+
hash
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Outputs non-array value in the form of hash
|
|
209
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
210
|
+
# @param [Object] value Any valid value
|
|
211
|
+
# @return [Hash] Returns the value in the form of hash
|
|
212
|
+
def _to_hash(value)
|
|
213
|
+
if value.is_a?(Array)
|
|
214
|
+
value.compact.map { |v| _to_hash(v) }
|
|
215
|
+
elsif value.is_a?(Hash)
|
|
216
|
+
{}.tap do |hash|
|
|
217
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
218
|
+
end
|
|
219
|
+
elsif value.respond_to? :to_hash
|
|
220
|
+
value.to_hash
|
|
221
|
+
else
|
|
222
|
+
value
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
end
|
|
@@ -11,44 +11,44 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module SnapTrade
|
|
14
|
-
# An investment
|
|
14
|
+
# An investment account under a connection. `opening_date`, `funding_date`, and `net_value` are real-time or cached depending on the caller's plan -- see `Connections_listConnectionAccounts`.
|
|
15
15
|
class InvestmentAccount
|
|
16
16
|
# Discriminator for the account kind.
|
|
17
17
|
attr_accessor :kind
|
|
18
18
|
|
|
19
|
-
# Unique identifier for the connected
|
|
19
|
+
# Unique identifier for the connected institution account. This is the UUID used to reference the account in SnapTrade.
|
|
20
20
|
attr_accessor :id
|
|
21
21
|
|
|
22
22
|
# Unique identifier for the connection (brokerage_authorization_id). This is the UUID used to reference the connection in SnapTrade.
|
|
23
23
|
attr_accessor :connection_id
|
|
24
24
|
|
|
25
|
-
# A display name for the account. Either assigned by the user or by the
|
|
25
|
+
# A display name for the account. Either assigned by the user or by the institution itself.
|
|
26
26
|
attr_accessor :display_name
|
|
27
27
|
|
|
28
|
-
# The account number assigned by the
|
|
28
|
+
# The account number assigned by the institution, masked to the last 4 characters (e.g. `****8443`).
|
|
29
29
|
attr_accessor :number
|
|
30
30
|
|
|
31
|
-
# A stable and unique account identifier provided by the institution. Will be set to null if not provided. When present, can be used to check if a user has connected the same
|
|
31
|
+
# A stable and unique account identifier provided by the institution. Will be set to null if not provided. When present, can be used to check if a user has connected the same institution account across multiple connections.
|
|
32
32
|
attr_accessor :institution_account_id
|
|
33
33
|
|
|
34
|
-
# Unique identifier for the institution
|
|
34
|
+
# Unique identifier for the institution that holds the account.
|
|
35
35
|
attr_accessor :institution_id
|
|
36
36
|
|
|
37
|
-
# Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was opened at the
|
|
37
|
+
# Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was opened at the institution. Only populated for institutions that expose this data; `null` for all other institutions. See [supported institutions](https://support.snaptrade.com/brokerages) for the full list.
|
|
38
38
|
attr_accessor :opening_date
|
|
39
39
|
|
|
40
|
+
# Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was funded. Only populated for institutions that expose this data; `null` for all other institutions. See [supported institutions](https://support.snaptrade.com/brokerages) for the full list.
|
|
41
|
+
attr_accessor :funding_date
|
|
42
|
+
|
|
40
43
|
attr_accessor :sync_status
|
|
41
44
|
|
|
42
|
-
# The account type as provided by the
|
|
45
|
+
# The account type as provided by the institution.
|
|
43
46
|
attr_accessor :raw_type
|
|
44
47
|
|
|
45
|
-
# Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was funded. Only populated for brokerages that expose this data (Tastytrade, eToro, moomoo, Public, and Unlok); `null` for all other brokerages.
|
|
46
|
-
attr_accessor :funding_date
|
|
47
|
-
|
|
48
48
|
# Indicates whether the account is a paper (simulated) trading account.
|
|
49
49
|
attr_accessor :is_paper
|
|
50
50
|
|
|
51
|
-
attr_accessor :
|
|
51
|
+
attr_accessor :net_value
|
|
52
52
|
|
|
53
53
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
54
54
|
def self.attribute_map
|
|
@@ -61,11 +61,11 @@ module SnapTrade
|
|
|
61
61
|
:'institution_account_id' => :'institution_account_id',
|
|
62
62
|
:'institution_id' => :'institution_id',
|
|
63
63
|
:'opening_date' => :'opening_date',
|
|
64
|
+
:'funding_date' => :'funding_date',
|
|
64
65
|
:'sync_status' => :'sync_status',
|
|
65
66
|
:'raw_type' => :'raw_type',
|
|
66
|
-
:'funding_date' => :'funding_date',
|
|
67
67
|
:'is_paper' => :'is_paper',
|
|
68
|
-
:'
|
|
68
|
+
:'net_value' => :'net_value'
|
|
69
69
|
}
|
|
70
70
|
end
|
|
71
71
|
|
|
@@ -85,11 +85,11 @@ module SnapTrade
|
|
|
85
85
|
:'institution_account_id' => :'String',
|
|
86
86
|
:'institution_id' => :'String',
|
|
87
87
|
:'opening_date' => :'Time',
|
|
88
|
+
:'funding_date' => :'Time',
|
|
88
89
|
:'sync_status' => :'ConnectionAccountSyncStatus',
|
|
89
90
|
:'raw_type' => :'String',
|
|
90
|
-
:'funding_date' => :'Time',
|
|
91
91
|
:'is_paper' => :'Boolean',
|
|
92
|
-
:'
|
|
92
|
+
:'net_value' => :'InvestmentAccountNetValue'
|
|
93
93
|
}
|
|
94
94
|
end
|
|
95
95
|
|
|
@@ -99,9 +99,9 @@ module SnapTrade
|
|
|
99
99
|
:'display_name',
|
|
100
100
|
:'institution_account_id',
|
|
101
101
|
:'opening_date',
|
|
102
|
-
:'raw_type',
|
|
103
102
|
:'funding_date',
|
|
104
|
-
:'
|
|
103
|
+
:'raw_type',
|
|
104
|
+
:'net_value'
|
|
105
105
|
])
|
|
106
106
|
end
|
|
107
107
|
|
|
@@ -152,6 +152,10 @@ module SnapTrade
|
|
|
152
152
|
self.opening_date = attributes[:'opening_date']
|
|
153
153
|
end
|
|
154
154
|
|
|
155
|
+
if attributes.key?(:'funding_date')
|
|
156
|
+
self.funding_date = attributes[:'funding_date']
|
|
157
|
+
end
|
|
158
|
+
|
|
155
159
|
if attributes.key?(:'sync_status')
|
|
156
160
|
self.sync_status = attributes[:'sync_status']
|
|
157
161
|
end
|
|
@@ -160,16 +164,12 @@ module SnapTrade
|
|
|
160
164
|
self.raw_type = attributes[:'raw_type']
|
|
161
165
|
end
|
|
162
166
|
|
|
163
|
-
if attributes.key?(:'funding_date')
|
|
164
|
-
self.funding_date = attributes[:'funding_date']
|
|
165
|
-
end
|
|
166
|
-
|
|
167
167
|
if attributes.key?(:'is_paper')
|
|
168
168
|
self.is_paper = attributes[:'is_paper']
|
|
169
169
|
end
|
|
170
170
|
|
|
171
|
-
if attributes.key?(:'
|
|
172
|
-
self.
|
|
171
|
+
if attributes.key?(:'net_value')
|
|
172
|
+
self.net_value = attributes[:'net_value']
|
|
173
173
|
end
|
|
174
174
|
end
|
|
175
175
|
|
|
@@ -229,11 +229,11 @@ module SnapTrade
|
|
|
229
229
|
institution_account_id == o.institution_account_id &&
|
|
230
230
|
institution_id == o.institution_id &&
|
|
231
231
|
opening_date == o.opening_date &&
|
|
232
|
+
funding_date == o.funding_date &&
|
|
232
233
|
sync_status == o.sync_status &&
|
|
233
234
|
raw_type == o.raw_type &&
|
|
234
|
-
funding_date == o.funding_date &&
|
|
235
235
|
is_paper == o.is_paper &&
|
|
236
|
-
|
|
236
|
+
net_value == o.net_value
|
|
237
237
|
end
|
|
238
238
|
|
|
239
239
|
# @see the `==` method
|
|
@@ -245,7 +245,7 @@ module SnapTrade
|
|
|
245
245
|
# Calculates hash code according to all attributes.
|
|
246
246
|
# @return [Integer] Hash code
|
|
247
247
|
def hash
|
|
248
|
-
[kind, id, connection_id, display_name, number, institution_account_id, institution_id, opening_date, sync_status, raw_type,
|
|
248
|
+
[kind, id, connection_id, display_name, number, institution_account_id, institution_id, opening_date, funding_date, sync_status, raw_type, is_paper, net_value].hash
|
|
249
249
|
end
|
|
250
250
|
|
|
251
251
|
# Builds the object from hash
|
data/lib/snaptrade/models/{investment_account_market_value.rb → investment_account_net_value.rb}
RENAMED
|
@@ -11,8 +11,8 @@ require 'date'
|
|
|
11
11
|
require 'time'
|
|
12
12
|
|
|
13
13
|
module SnapTrade
|
|
14
|
-
#
|
|
15
|
-
class
|
|
14
|
+
# Net value of the account -- total market value for investment accounts. Shared across all account kinds so that, e.g., a future `line_of_credit` account can report a negative net value here. Null when unknown (e.g. a real-time fetch failed and no cached value exists).
|
|
15
|
+
class InvestmentAccountNetValue
|
|
16
16
|
attr_accessor :amount
|
|
17
17
|
|
|
18
18
|
attr_accessor :currency
|
|
@@ -50,13 +50,13 @@ module SnapTrade
|
|
|
50
50
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
51
51
|
def initialize(attributes = {})
|
|
52
52
|
if (!attributes.is_a?(Hash))
|
|
53
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::
|
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SnapTrade::InvestmentAccountNetValue` initialize method"
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
57
57
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
58
58
|
if (!self.class.attribute_map.key?(k.to_sym))
|
|
59
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::
|
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SnapTrade::InvestmentAccountNetValue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
60
60
|
end
|
|
61
61
|
h[k.to_sym] = v
|
|
62
62
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 PriceEffect
|
|
15
|
+
CREDIT = "CREDIT".freeze
|
|
16
|
+
DEBIT = "DEBIT".freeze
|
|
17
|
+
EVEN = "EVEN".freeze
|
|
18
|
+
UNKNOWN = "UNKNOWN".freeze
|
|
19
|
+
|
|
20
|
+
def self.all_vars
|
|
21
|
+
@all_vars ||= [CREDIT, DEBIT, EVEN, UNKNOWN].freeze
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Builds the enum from string
|
|
25
|
+
# @param [String] The enum value in the form of the string
|
|
26
|
+
# @return [String] The enum value
|
|
27
|
+
def self.build_from_hash(value)
|
|
28
|
+
new.build_from_hash(value)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Builds the enum from string
|
|
32
|
+
# @param [String] The enum value in the form of the string
|
|
33
|
+
# @return [String] The enum value
|
|
34
|
+
def build_from_hash(value)
|
|
35
|
+
return value if PriceEffect.all_vars.include?(value)
|
|
36
|
+
raise "Invalid ENUM value #{value} for class #PriceEffect"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
data/lib/snaptrade/version.rb
CHANGED
data/lib/snaptrade.rb
CHANGED
|
@@ -35,6 +35,7 @@ require 'snaptrade/models/account_order_record_status_v2'
|
|
|
35
35
|
require 'snaptrade/models/account_order_record_trailing_stop'
|
|
36
36
|
require 'snaptrade/models/account_order_record_universal_symbol'
|
|
37
37
|
require 'snaptrade/models/account_order_record_v2'
|
|
38
|
+
require 'snaptrade/models/account_order_record_v2_order_role'
|
|
38
39
|
require 'snaptrade/models/account_orders_v2_response'
|
|
39
40
|
require 'snaptrade/models/account_position'
|
|
40
41
|
require 'snaptrade/models/account_simple'
|
|
@@ -99,8 +100,9 @@ require 'snaptrade/models/currency'
|
|
|
99
100
|
require 'snaptrade/models/delete_connection_confirmation'
|
|
100
101
|
require 'snaptrade/models/delete_user_response'
|
|
101
102
|
require 'snaptrade/models/deposit_account'
|
|
102
|
-
require 'snaptrade/models/deposit_account_balance'
|
|
103
103
|
require 'snaptrade/models/deposit_account_kind'
|
|
104
|
+
require 'snaptrade/models/deposit_account_net_value'
|
|
105
|
+
require 'snaptrade/models/deposit_account_sync_status'
|
|
104
106
|
require 'snaptrade/models/dividend_at_date'
|
|
105
107
|
require 'snaptrade/models/encrypted_response'
|
|
106
108
|
require 'snaptrade/models/encrypted_response_encrypted_message_data'
|
|
@@ -114,7 +116,7 @@ require 'snaptrade/models/future_instrument_kind'
|
|
|
114
116
|
require 'snaptrade/models/holdings_status'
|
|
115
117
|
require 'snaptrade/models/instrument'
|
|
116
118
|
require 'snaptrade/models/investment_account'
|
|
117
|
-
require 'snaptrade/models/
|
|
119
|
+
require 'snaptrade/models/investment_account_net_value'
|
|
118
120
|
require 'snaptrade/models/kind'
|
|
119
121
|
require 'snaptrade/models/login_redirect_uri'
|
|
120
122
|
require 'snaptrade/models/manual_trade'
|
|
@@ -189,6 +191,7 @@ require 'snaptrade/models/performance_custom'
|
|
|
189
191
|
require 'snaptrade/models/position'
|
|
190
192
|
require 'snaptrade/models/position_currency'
|
|
191
193
|
require 'snaptrade/models/position_symbol'
|
|
194
|
+
require 'snaptrade/models/price_effect'
|
|
192
195
|
require 'snaptrade/models/rate_of_return_object'
|
|
193
196
|
require 'snaptrade/models/rate_of_return_response'
|
|
194
197
|
require 'snaptrade/models/recent_orders_response'
|
|
@@ -101,8 +101,8 @@ describe 'ExperimentalEndpointsApi' do
|
|
|
101
101
|
|
|
102
102
|
# unit tests for list_connection_accounts
|
|
103
103
|
# List accounts for a connection (discriminated union)
|
|
104
|
-
# Experimental and subject to change without notice. Returns the accounts that belong to the specified connection for the authenticated user, using the `kind`-discriminated account shape. Each item in the response carries a `kind` field (currently `investment` and `deposit` are implemented) that determines which additional fields are present -- see the `ConnectionAccount` schema. On Pay as you Go / Real-time, this endpoint refreshes each account's opening date and total
|
|
105
|
-
# @param
|
|
104
|
+
# Experimental and subject to change without notice. Returns the accounts that belong to the specified connection for the authenticated user, using the `kind`-discriminated account shape. Each item in the response carries a `kind` field (currently `investment` and `deposit` are implemented) that determines which additional fields are present -- see the `ConnectionAccount` schema. On Pay as you Go / Real-time, this endpoint refreshes each account's opening date and total net value (`net_value`) live from the institution on each call, along with funding date for `investment` accounts. On Pay as you Go / Daily, this endpoint returns Daily data. Daily data is cached and refreshed once a day. Exact refresh timing may vary by institution. To force a refresh, use the [manual refresh endpoint](/reference/Connections/Connections_refreshBrokerageAuthorization). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see whether your plan includes real-time data.
|
|
105
|
+
# @param connection_id
|
|
106
106
|
# @param user_id
|
|
107
107
|
# @param user_secret
|
|
108
108
|
# @param [Hash] opts the optional parameters
|
|
@@ -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::AccountOrderRecordV2OrderRole
|
|
15
|
+
describe SnapTrade::AccountOrderRecordV2OrderRole do
|
|
16
|
+
let(:instance) { SnapTrade::AccountOrderRecordV2OrderRole.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of AccountOrderRecordV2OrderRole' do
|
|
19
|
+
it 'should create an instance of AccountOrderRecordV2OrderRole' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::AccountOrderRecordV2OrderRole)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -35,10 +35,6 @@ describe SnapTrade::AccountOrderRecordV2 do
|
|
|
35
35
|
describe 'test attribute "order_role"' do
|
|
36
36
|
it 'should work' do
|
|
37
37
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
38
|
-
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["TRIGGER", "CONDITIONAL", "PEER"])
|
|
39
|
-
# validator.allowable_values.each do |value|
|
|
40
|
-
# expect { instance.order_role = value }.not_to raise_error
|
|
41
|
-
# end
|
|
42
38
|
end
|
|
43
39
|
end
|
|
44
40
|
|
|
@@ -72,7 +68,13 @@ describe SnapTrade::AccountOrderRecordV2 do
|
|
|
72
68
|
end
|
|
73
69
|
end
|
|
74
70
|
|
|
75
|
-
describe 'test attribute "
|
|
71
|
+
describe 'test attribute "price_currency"' do
|
|
72
|
+
it 'should work' do
|
|
73
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
describe 'test attribute "price_effect"' do
|
|
76
78
|
it 'should work' do
|
|
77
79
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
78
80
|
end
|
|
@@ -11,13 +11,13 @@ require 'spec_helper'
|
|
|
11
11
|
require 'json'
|
|
12
12
|
require 'date'
|
|
13
13
|
|
|
14
|
-
# Unit tests for SnapTrade::
|
|
15
|
-
describe SnapTrade::
|
|
16
|
-
let(:instance) { SnapTrade::
|
|
14
|
+
# Unit tests for SnapTrade::DepositAccountNetValue
|
|
15
|
+
describe SnapTrade::DepositAccountNetValue do
|
|
16
|
+
let(:instance) { SnapTrade::DepositAccountNetValue.new }
|
|
17
17
|
|
|
18
|
-
describe 'test an instance of
|
|
19
|
-
it 'should create an instance of
|
|
20
|
-
expect(instance).to be_instance_of(SnapTrade::
|
|
18
|
+
describe 'test an instance of DepositAccountNetValue' do
|
|
19
|
+
it 'should create an instance of DepositAccountNetValue' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::DepositAccountNetValue)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
describe 'test attribute "amount"' do
|
|
@@ -80,7 +80,7 @@ describe SnapTrade::DepositAccount do
|
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
-
describe 'test attribute "
|
|
83
|
+
describe 'test attribute "net_value"' do
|
|
84
84
|
it 'should work' do
|
|
85
85
|
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
86
86
|
end
|
|
@@ -0,0 +1,35 @@
|
|
|
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::DepositAccountSyncStatus
|
|
15
|
+
describe SnapTrade::DepositAccountSyncStatus do
|
|
16
|
+
let(:instance) { SnapTrade::DepositAccountSyncStatus.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of DepositAccountSyncStatus' do
|
|
19
|
+
it 'should create an instance of DepositAccountSyncStatus' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::DepositAccountSyncStatus)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
describe 'test attribute "transactions"' 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 "balances"' 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
|
+
end
|
data/spec/models/{investment_account_market_value_spec.rb → investment_account_net_value_spec.rb}
RENAMED
|
@@ -11,13 +11,13 @@ require 'spec_helper'
|
|
|
11
11
|
require 'json'
|
|
12
12
|
require 'date'
|
|
13
13
|
|
|
14
|
-
# Unit tests for SnapTrade::
|
|
15
|
-
describe SnapTrade::
|
|
16
|
-
let(:instance) { SnapTrade::
|
|
14
|
+
# Unit tests for SnapTrade::InvestmentAccountNetValue
|
|
15
|
+
describe SnapTrade::InvestmentAccountNetValue do
|
|
16
|
+
let(:instance) { SnapTrade::InvestmentAccountNetValue.new }
|
|
17
17
|
|
|
18
|
-
describe 'test an instance of
|
|
19
|
-
it 'should create an instance of
|
|
20
|
-
expect(instance).to be_instance_of(SnapTrade::
|
|
18
|
+
describe 'test an instance of InvestmentAccountNetValue' do
|
|
19
|
+
it 'should create an instance of InvestmentAccountNetValue' do
|
|
20
|
+
expect(instance).to be_instance_of(SnapTrade::InvestmentAccountNetValue)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
describe 'test attribute "amount"' do
|