-
Notifications
You must be signed in to change notification settings - Fork 88
/
model_holding.go
552 lines (471 loc) · 17.7 KB
/
model_holding.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
/*
* The Plaid API
*
* The Plaid REST API. Please see https://plaid.com/docs/api for more details.
*
* API version: 2020-09-14_1.508.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package plaid
import (
"encoding/json"
"time"
)
// Holding A securities holding at an institution.
type Holding struct {
// The Plaid `account_id` associated with the holding.
AccountId string `json:"account_id"`
// The Plaid `security_id` associated with the holding. Security data is not specific to a user's account; any user who held the same security at the same financial institution at the same time would have identical security data. The `security_id` for the same security will typically be the same across different institutions, but this is not guaranteed. The `security_id` does not typically change, but may change if inherent details of the security change due to a corporate action, for example, in the event of a ticker symbol change or CUSIP change.
SecurityId string `json:"security_id"`
// The last price given by the institution for this security.
InstitutionPrice float64 `json:"institution_price"`
// The date at which `institution_price` was current.
InstitutionPriceAsOf NullableString `json:"institution_price_as_of,omitempty"`
// Date and time at which `institution_price` was current, in ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ). This field is returned for select financial institutions and comes as provided by the institution. It may contain default time values (such as 00:00:00).
InstitutionPriceDatetime NullableTime `json:"institution_price_datetime,omitempty"`
// The value of the holding, as reported by the institution.
InstitutionValue float64 `json:"institution_value"`
// The total cost basis of the holding (e.g., the total amount spent to acquire all assets currently in the holding).
CostBasis NullableFloat64 `json:"cost_basis"`
// The total quantity of the asset held, as reported by the financial institution. If the security is an option, `quantity` will reflect the total number of options (typically the number of contracts multiplied by 100), not the number of contracts.
Quantity float64 `json:"quantity"`
// The ISO-4217 currency code of the holding. Always `null` if `unofficial_currency_code` is non-`null`.
IsoCurrencyCode NullableString `json:"iso_currency_code"`
// The unofficial currency code associated with the holding. Always `null` if `iso_currency_code` is non-`null`. Unofficial currency codes are used for currencies that do not have official ISO currency codes, such as cryptocurrencies and the currencies of certain countries. See the [currency code schema](https://plaid.com/docs/api/accounts#currency-code-schema) for a full listing of supported `iso_currency_code`s.
UnofficialCurrencyCode NullableString `json:"unofficial_currency_code"`
// The total quantity of vested assets held, as reported by the financial institution. Vested assets are only associated with [equities](https://plaid.com/docs/api/products/investments/#investments-holdings-get-response-securities-type).
VestedQuantity NullableFloat64 `json:"vested_quantity,omitempty"`
// The value of the vested holdings as reported by the institution.
VestedValue NullableFloat64 `json:"vested_value,omitempty"`
AdditionalProperties map[string]interface{}
}
type _Holding Holding
// NewHolding instantiates a new Holding object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewHolding(accountId string, securityId string, institutionPrice float64, institutionValue float64, costBasis NullableFloat64, quantity float64, isoCurrencyCode NullableString, unofficialCurrencyCode NullableString) *Holding {
this := Holding{}
this.AccountId = accountId
this.SecurityId = securityId
this.InstitutionPrice = institutionPrice
this.InstitutionValue = institutionValue
this.CostBasis = costBasis
this.Quantity = quantity
this.IsoCurrencyCode = isoCurrencyCode
this.UnofficialCurrencyCode = unofficialCurrencyCode
return &this
}
// NewHoldingWithDefaults instantiates a new Holding object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewHoldingWithDefaults() *Holding {
this := Holding{}
return &this
}
// GetAccountId returns the AccountId field value
func (o *Holding) GetAccountId() string {
if o == nil {
var ret string
return ret
}
return o.AccountId
}
// GetAccountIdOk returns a tuple with the AccountId field value
// and a boolean to check if the value has been set.
func (o *Holding) GetAccountIdOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.AccountId, true
}
// SetAccountId sets field value
func (o *Holding) SetAccountId(v string) {
o.AccountId = v
}
// GetSecurityId returns the SecurityId field value
func (o *Holding) GetSecurityId() string {
if o == nil {
var ret string
return ret
}
return o.SecurityId
}
// GetSecurityIdOk returns a tuple with the SecurityId field value
// and a boolean to check if the value has been set.
func (o *Holding) GetSecurityIdOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.SecurityId, true
}
// SetSecurityId sets field value
func (o *Holding) SetSecurityId(v string) {
o.SecurityId = v
}
// GetInstitutionPrice returns the InstitutionPrice field value
func (o *Holding) GetInstitutionPrice() float64 {
if o == nil {
var ret float64
return ret
}
return o.InstitutionPrice
}
// GetInstitutionPriceOk returns a tuple with the InstitutionPrice field value
// and a boolean to check if the value has been set.
func (o *Holding) GetInstitutionPriceOk() (*float64, bool) {
if o == nil {
return nil, false
}
return &o.InstitutionPrice, true
}
// SetInstitutionPrice sets field value
func (o *Holding) SetInstitutionPrice(v float64) {
o.InstitutionPrice = v
}
// GetInstitutionPriceAsOf returns the InstitutionPriceAsOf field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Holding) GetInstitutionPriceAsOf() string {
if o == nil || o.InstitutionPriceAsOf.Get() == nil {
var ret string
return ret
}
return *o.InstitutionPriceAsOf.Get()
}
// GetInstitutionPriceAsOfOk returns a tuple with the InstitutionPriceAsOf field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Holding) GetInstitutionPriceAsOfOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.InstitutionPriceAsOf.Get(), o.InstitutionPriceAsOf.IsSet()
}
// HasInstitutionPriceAsOf returns a boolean if a field has been set.
func (o *Holding) HasInstitutionPriceAsOf() bool {
if o != nil && o.InstitutionPriceAsOf.IsSet() {
return true
}
return false
}
// SetInstitutionPriceAsOf gets a reference to the given NullableString and assigns it to the InstitutionPriceAsOf field.
func (o *Holding) SetInstitutionPriceAsOf(v string) {
o.InstitutionPriceAsOf.Set(&v)
}
// SetInstitutionPriceAsOfNil sets the value for InstitutionPriceAsOf to be an explicit nil
func (o *Holding) SetInstitutionPriceAsOfNil() {
o.InstitutionPriceAsOf.Set(nil)
}
// UnsetInstitutionPriceAsOf ensures that no value is present for InstitutionPriceAsOf, not even an explicit nil
func (o *Holding) UnsetInstitutionPriceAsOf() {
o.InstitutionPriceAsOf.Unset()
}
// GetInstitutionPriceDatetime returns the InstitutionPriceDatetime field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Holding) GetInstitutionPriceDatetime() time.Time {
if o == nil || o.InstitutionPriceDatetime.Get() == nil {
var ret time.Time
return ret
}
return *o.InstitutionPriceDatetime.Get()
}
// GetInstitutionPriceDatetimeOk returns a tuple with the InstitutionPriceDatetime field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Holding) GetInstitutionPriceDatetimeOk() (*time.Time, bool) {
if o == nil {
return nil, false
}
return o.InstitutionPriceDatetime.Get(), o.InstitutionPriceDatetime.IsSet()
}
// HasInstitutionPriceDatetime returns a boolean if a field has been set.
func (o *Holding) HasInstitutionPriceDatetime() bool {
if o != nil && o.InstitutionPriceDatetime.IsSet() {
return true
}
return false
}
// SetInstitutionPriceDatetime gets a reference to the given NullableTime and assigns it to the InstitutionPriceDatetime field.
func (o *Holding) SetInstitutionPriceDatetime(v time.Time) {
o.InstitutionPriceDatetime.Set(&v)
}
// SetInstitutionPriceDatetimeNil sets the value for InstitutionPriceDatetime to be an explicit nil
func (o *Holding) SetInstitutionPriceDatetimeNil() {
o.InstitutionPriceDatetime.Set(nil)
}
// UnsetInstitutionPriceDatetime ensures that no value is present for InstitutionPriceDatetime, not even an explicit nil
func (o *Holding) UnsetInstitutionPriceDatetime() {
o.InstitutionPriceDatetime.Unset()
}
// GetInstitutionValue returns the InstitutionValue field value
func (o *Holding) GetInstitutionValue() float64 {
if o == nil {
var ret float64
return ret
}
return o.InstitutionValue
}
// GetInstitutionValueOk returns a tuple with the InstitutionValue field value
// and a boolean to check if the value has been set.
func (o *Holding) GetInstitutionValueOk() (*float64, bool) {
if o == nil {
return nil, false
}
return &o.InstitutionValue, true
}
// SetInstitutionValue sets field value
func (o *Holding) SetInstitutionValue(v float64) {
o.InstitutionValue = v
}
// GetCostBasis returns the CostBasis field value
// If the value is explicit nil, the zero value for float64 will be returned
func (o *Holding) GetCostBasis() float64 {
if o == nil || o.CostBasis.Get() == nil {
var ret float64
return ret
}
return *o.CostBasis.Get()
}
// GetCostBasisOk returns a tuple with the CostBasis field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Holding) GetCostBasisOk() (*float64, bool) {
if o == nil {
return nil, false
}
return o.CostBasis.Get(), o.CostBasis.IsSet()
}
// SetCostBasis sets field value
func (o *Holding) SetCostBasis(v float64) {
o.CostBasis.Set(&v)
}
// GetQuantity returns the Quantity field value
func (o *Holding) GetQuantity() float64 {
if o == nil {
var ret float64
return ret
}
return o.Quantity
}
// GetQuantityOk returns a tuple with the Quantity field value
// and a boolean to check if the value has been set.
func (o *Holding) GetQuantityOk() (*float64, bool) {
if o == nil {
return nil, false
}
return &o.Quantity, true
}
// SetQuantity sets field value
func (o *Holding) SetQuantity(v float64) {
o.Quantity = v
}
// GetIsoCurrencyCode returns the IsoCurrencyCode field value
// If the value is explicit nil, the zero value for string will be returned
func (o *Holding) GetIsoCurrencyCode() string {
if o == nil || o.IsoCurrencyCode.Get() == nil {
var ret string
return ret
}
return *o.IsoCurrencyCode.Get()
}
// GetIsoCurrencyCodeOk returns a tuple with the IsoCurrencyCode field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Holding) GetIsoCurrencyCodeOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.IsoCurrencyCode.Get(), o.IsoCurrencyCode.IsSet()
}
// SetIsoCurrencyCode sets field value
func (o *Holding) SetIsoCurrencyCode(v string) {
o.IsoCurrencyCode.Set(&v)
}
// GetUnofficialCurrencyCode returns the UnofficialCurrencyCode field value
// If the value is explicit nil, the zero value for string will be returned
func (o *Holding) GetUnofficialCurrencyCode() string {
if o == nil || o.UnofficialCurrencyCode.Get() == nil {
var ret string
return ret
}
return *o.UnofficialCurrencyCode.Get()
}
// GetUnofficialCurrencyCodeOk returns a tuple with the UnofficialCurrencyCode field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Holding) GetUnofficialCurrencyCodeOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.UnofficialCurrencyCode.Get(), o.UnofficialCurrencyCode.IsSet()
}
// SetUnofficialCurrencyCode sets field value
func (o *Holding) SetUnofficialCurrencyCode(v string) {
o.UnofficialCurrencyCode.Set(&v)
}
// GetVestedQuantity returns the VestedQuantity field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Holding) GetVestedQuantity() float64 {
if o == nil || o.VestedQuantity.Get() == nil {
var ret float64
return ret
}
return *o.VestedQuantity.Get()
}
// GetVestedQuantityOk returns a tuple with the VestedQuantity field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Holding) GetVestedQuantityOk() (*float64, bool) {
if o == nil {
return nil, false
}
return o.VestedQuantity.Get(), o.VestedQuantity.IsSet()
}
// HasVestedQuantity returns a boolean if a field has been set.
func (o *Holding) HasVestedQuantity() bool {
if o != nil && o.VestedQuantity.IsSet() {
return true
}
return false
}
// SetVestedQuantity gets a reference to the given NullableFloat64 and assigns it to the VestedQuantity field.
func (o *Holding) SetVestedQuantity(v float64) {
o.VestedQuantity.Set(&v)
}
// SetVestedQuantityNil sets the value for VestedQuantity to be an explicit nil
func (o *Holding) SetVestedQuantityNil() {
o.VestedQuantity.Set(nil)
}
// UnsetVestedQuantity ensures that no value is present for VestedQuantity, not even an explicit nil
func (o *Holding) UnsetVestedQuantity() {
o.VestedQuantity.Unset()
}
// GetVestedValue returns the VestedValue field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Holding) GetVestedValue() float64 {
if o == nil || o.VestedValue.Get() == nil {
var ret float64
return ret
}
return *o.VestedValue.Get()
}
// GetVestedValueOk returns a tuple with the VestedValue field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Holding) GetVestedValueOk() (*float64, bool) {
if o == nil {
return nil, false
}
return o.VestedValue.Get(), o.VestedValue.IsSet()
}
// HasVestedValue returns a boolean if a field has been set.
func (o *Holding) HasVestedValue() bool {
if o != nil && o.VestedValue.IsSet() {
return true
}
return false
}
// SetVestedValue gets a reference to the given NullableFloat64 and assigns it to the VestedValue field.
func (o *Holding) SetVestedValue(v float64) {
o.VestedValue.Set(&v)
}
// SetVestedValueNil sets the value for VestedValue to be an explicit nil
func (o *Holding) SetVestedValueNil() {
o.VestedValue.Set(nil)
}
// UnsetVestedValue ensures that no value is present for VestedValue, not even an explicit nil
func (o *Holding) UnsetVestedValue() {
o.VestedValue.Unset()
}
func (o Holding) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if true {
toSerialize["account_id"] = o.AccountId
}
if true {
toSerialize["security_id"] = o.SecurityId
}
if true {
toSerialize["institution_price"] = o.InstitutionPrice
}
if o.InstitutionPriceAsOf.IsSet() {
toSerialize["institution_price_as_of"] = o.InstitutionPriceAsOf.Get()
}
if o.InstitutionPriceDatetime.IsSet() {
toSerialize["institution_price_datetime"] = o.InstitutionPriceDatetime.Get()
}
if true {
toSerialize["institution_value"] = o.InstitutionValue
}
if true {
toSerialize["cost_basis"] = o.CostBasis.Get()
}
if true {
toSerialize["quantity"] = o.Quantity
}
if true {
toSerialize["iso_currency_code"] = o.IsoCurrencyCode.Get()
}
if true {
toSerialize["unofficial_currency_code"] = o.UnofficialCurrencyCode.Get()
}
if o.VestedQuantity.IsSet() {
toSerialize["vested_quantity"] = o.VestedQuantity.Get()
}
if o.VestedValue.IsSet() {
toSerialize["vested_value"] = o.VestedValue.Get()
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return json.Marshal(toSerialize)
}
func (o *Holding) UnmarshalJSON(bytes []byte) (err error) {
varHolding := _Holding{}
if err = json.Unmarshal(bytes, &varHolding); err == nil {
*o = Holding(varHolding)
} else {
return err
}
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
delete(additionalProperties, "account_id")
delete(additionalProperties, "security_id")
delete(additionalProperties, "institution_price")
delete(additionalProperties, "institution_price_as_of")
delete(additionalProperties, "institution_price_datetime")
delete(additionalProperties, "institution_value")
delete(additionalProperties, "cost_basis")
delete(additionalProperties, "quantity")
delete(additionalProperties, "iso_currency_code")
delete(additionalProperties, "unofficial_currency_code")
delete(additionalProperties, "vested_quantity")
delete(additionalProperties, "vested_value")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableHolding struct {
value *Holding
isSet bool
}
func (v NullableHolding) Get() *Holding {
return v.value
}
func (v *NullableHolding) Set(val *Holding) {
v.value = val
v.isSet = true
}
func (v NullableHolding) IsSet() bool {
return v.isSet
}
func (v *NullableHolding) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableHolding(val *Holding) *NullableHolding {
return &NullableHolding{value: val, isSet: true}
}
func (v NullableHolding) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableHolding) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}