Class: FdxV660Api::HoldingEntity

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/holding_entity.rb

Overview

A holding in an investment account

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(holding_id: SKIP, security_ids: SKIP, holding_name: SKIP, holding_type: SKIP, holding_sub_type: SKIP, position_type: SKIP, held_in_account: SKIP, description: SKIP, symbol: SKIP, original_purchase_date: SKIP, purchased_price: SKIP, current_amortization_factor: 1, current_unit_price: SKIP, change_in_price: SKIP, current_unit_price_date: SKIP, units: SKIP, market_value: SKIP, face_value: SKIP, average_cost: SKIP, cash_account: SKIP, rate: SKIP, expiration_date: SKIP, inv401k_source: SKIP, currency: SKIP, asset_classes: SKIP, fi_asset_classes: SKIP, tax_lots: SKIP, digital_units: SKIP, security: SKIP, fi_attributes: SKIP, additional_properties: nil) ⇒ HoldingEntity

Returns a new instance of HoldingEntity.



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
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 217

def initialize(holding_id: SKIP, security_ids: SKIP, holding_name: SKIP,
               holding_type: SKIP, holding_sub_type: SKIP,
               position_type: SKIP, held_in_account: SKIP,
               description: SKIP, symbol: SKIP,
               original_purchase_date: SKIP, purchased_price: SKIP,
               current_amortization_factor: 1, current_unit_price: SKIP,
               change_in_price: SKIP, current_unit_price_date: SKIP,
               units: SKIP, market_value: SKIP, face_value: SKIP,
               average_cost: SKIP, cash_account: SKIP, rate: SKIP,
               expiration_date: SKIP, inv401k_source: SKIP, currency: SKIP,
               asset_classes: SKIP, fi_asset_classes: SKIP, tax_lots: SKIP,
               digital_units: SKIP, security: SKIP, fi_attributes: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @holding_id = holding_id unless holding_id == SKIP
  @security_ids = security_ids unless security_ids == SKIP
  @holding_name = holding_name unless holding_name == SKIP
  @holding_type = holding_type unless holding_type == SKIP
  @holding_sub_type = holding_sub_type unless holding_sub_type == SKIP
  @position_type = position_type unless position_type == SKIP
  @held_in_account =  unless  == SKIP
  @description = description unless description == SKIP
  @symbol = symbol unless symbol == SKIP
  @original_purchase_date = original_purchase_date unless original_purchase_date == SKIP
  @purchased_price = purchased_price unless purchased_price == SKIP
  unless current_amortization_factor == SKIP
    @current_amortization_factor =
      current_amortization_factor
  end
  @current_unit_price = current_unit_price unless current_unit_price == SKIP
  @change_in_price = change_in_price unless change_in_price == SKIP
  @current_unit_price_date = current_unit_price_date unless current_unit_price_date == SKIP
  @units = units unless units == SKIP
  @market_value = market_value unless market_value == SKIP
  @face_value = face_value unless face_value == SKIP
  @average_cost = average_cost unless average_cost == SKIP
  @cash_account =  unless  == SKIP
  @rate = rate unless rate == SKIP
  @expiration_date = expiration_date unless expiration_date == SKIP
  @inv401k_source = inv401k_source unless inv401k_source == SKIP
  @currency = currency unless currency == SKIP
  @asset_classes = asset_classes unless asset_classes == SKIP
  @fi_asset_classes = fi_asset_classes unless fi_asset_classes == SKIP
  @tax_lots = tax_lots unless tax_lots == SKIP
  @digital_units = digital_units unless digital_units == SKIP
  @security = security unless security == SKIP
  @fi_attributes = fi_attributes unless fi_attributes == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#asset_classesArray[PortionEntity]

Percent breakdown by asset class

Returns:



115
116
117
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 115

def asset_classes
  @asset_classes
end

#average_costTrueClass | FalseClass

Cost is average of all purchases for holding

Returns:

  • (TrueClass | FalseClass)


89
90
91
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 89

def average_cost
  @average_cost
end

#cash_accountTrueClass | FalseClass

If true, indicates that this holding is used to maintain proceeds from sales, dividends, and other cash postings to the investment account

Returns:

  • (TrueClass | FalseClass)


94
95
96
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 94

def 
  @cash_account
end

#change_in_priceFloat

Change in current price compared to previous day's close

Returns:

  • (Float)


69
70
71
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 69

def change_in_price
  @change_in_price
end

#currencyCurrencyEntity1

Currency information if it is different from Account entity

Returns:



111
112
113
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 111

def currency
  @currency
end

#current_amortization_factorFloat

Ranges from 0.0 - 1.0 indicates the adjustment to the calculation of the market value. 'currentUnitPrice * quantity * currentAmortizationFactor = marketValue'

Returns:

  • (Float)


61
62
63
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 61

def current_amortization_factor
  @current_amortization_factor
end

#current_unit_priceFloat

Current unit price

Returns:

  • (Float)


65
66
67
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 65

def current_unit_price
  @current_unit_price
end

#current_unit_price_dateDate

Current unit price as of date

Returns:

  • (Date)


73
74
75
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 73

def current_unit_price_date
  @current_unit_price_date
end

#descriptionString

The description of the holding

Returns:

  • (String)


43
44
45
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 43

def description
  @description
end

#digital_unitsString

Specify units to full precision with unlimited digits after decimal point

Returns:

  • (String)


127
128
129
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 127

def digital_units
  @digital_units
end

#expiration_dateDate

For CDs, bonds, and other time-based holdings

Returns:

  • (Date)


102
103
104
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 102

def expiration_date
  @expiration_date
end

#face_valueFloat

Required for bonds. Face value at the time of data retrieved

Returns:

  • (Float)


85
86
87
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 85

def face_value
  @face_value
end

#fi_asset_classesArray[FiPortionEntity]

Percent breakdown by FI-specific asset class percentage breakdown

Returns:



119
120
121
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 119

def fi_asset_classes
  @fi_asset_classes
end

#fi_attributesArray[FiAttributeEntity]

Array of FI-specific attributes

Returns:



138
139
140
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 138

def fi_attributes
  @fi_attributes
end

#held_in_accountHeldInAccount2

Sub-account CASH, MARGIN, SHORT, OTHER

Returns:



39
40
41
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 39

def 
  @held_in_account
end

#holding_idString

Long term persistent identity of the holding

Returns:

  • (String)


14
15
16
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 14

def holding_id
  @holding_id
end

#holding_nameString

Holding name or security name

Returns:

  • (String)


22
23
24
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 22

def holding_name
  @holding_name
end

#holding_sub_typeHoldingSubType2

MONEYMARKET, CASH

Returns:



31
32
33
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 31

def holding_sub_type
  @holding_sub_type
end

#holding_typeInvestmentAssetType3

The type of investment account asset in this holding. ANNUITY, BOND, CD, DEBT, DIGITALASSET, MUTUALFUND, OPTION, OTHER, STOCK, SWEEP



27
28
29
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 27

def holding_type
  @holding_type
end

#inv401k_sourceInvestment401KSourceType4

Source for money for this security. One of PRETAX, AFTERTAX, MATCH, PROFITSHARING, ROLLOVER, OTHERVEST, OTHERNONVEST



107
108
109
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 107

def inv401k_source
  @inv401k_source
end

#market_valueFloat

Market value at the time of data retrieved

Returns:

  • (Float)


81
82
83
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 81

def market_value
  @market_value
end

#original_purchase_dateDate

Date of original purchase

Returns:

  • (Date)


51
52
53
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 51

def original_purchase_date
  @original_purchase_date
end

#position_typePositionType1

LONG, SHORT

Returns:



35
36
37
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 35

def position_type
  @position_type
end

#purchased_priceFloat

Price of holding at the time of purchase

Returns:

  • (Float)


55
56
57
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 55

def purchased_price
  @purchased_price
end

#rateFloat

For CDs, bonds, and other rate based holdings

Returns:

  • (Float)


98
99
100
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 98

def rate
  @rate
end

#securityObject

The security of the Holding; one of AnnuitySecurity, BondSecurity, CertificateOfDepositSecurity, DebtSecurity, MutualFundSecurity, DigitalAssetSecurity, OptionSecurity, OtherSecurity, StockSecurity or SweepSecurity

Returns:

  • (Object)


134
135
136
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 134

def security
  @security
end

#security_idsArray[SecurityIdEntity]

Unique identifiers for the security

Returns:



18
19
20
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 18

def security_ids
  @security_ids
end

#symbolString

Ticker / Market symbol

Returns:

  • (String)


47
48
49
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 47

def symbol
  @symbol
end

#tax_lotsArray[TaxLotEntity]

Breakdown by tax lot

Returns:



123
124
125
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 123

def tax_lots
  @tax_lots
end

#unitsFloat

Required for stock, mutual funds. Number of shares (with decimals)

Returns:

  • (Float)


77
78
79
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 77

def units
  @units
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 270

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  holding_id = hash.key?('holdingId') ? hash['holdingId'] : SKIP
  # Parameter is an array, so we need to iterate through it
  security_ids = nil
  unless hash['securityIds'].nil?
    security_ids = []
    hash['securityIds'].each do |structure|
      security_ids << (SecurityIdEntity.from_hash(structure) if structure)
    end
  end

  security_ids = SKIP unless hash.key?('securityIds')
  holding_name = hash.key?('holdingName') ? hash['holdingName'] : SKIP
  holding_type = hash.key?('holdingType') ? hash['holdingType'] : SKIP
  holding_sub_type =
    hash.key?('holdingSubType') ? hash['holdingSubType'] : SKIP
  position_type = hash.key?('positionType') ? hash['positionType'] : SKIP
   =
    hash.key?('heldInAccount') ? hash['heldInAccount'] : SKIP
  description = hash.key?('description') ? hash['description'] : SKIP
  symbol = hash.key?('symbol') ? hash['symbol'] : SKIP
  original_purchase_date =
    hash.key?('originalPurchaseDate') ? hash['originalPurchaseDate'] : SKIP
  purchased_price =
    hash.key?('purchasedPrice') ? hash['purchasedPrice'] : SKIP
  current_amortization_factor = hash['currentAmortizationFactor'] ||= 1
  current_unit_price =
    hash.key?('currentUnitPrice') ? hash['currentUnitPrice'] : SKIP
  change_in_price =
    hash.key?('changeInPrice') ? hash['changeInPrice'] : SKIP
  current_unit_price_date =
    hash.key?('currentUnitPriceDate') ? hash['currentUnitPriceDate'] : SKIP
  units = hash.key?('units') ? hash['units'] : SKIP
  market_value = hash.key?('marketValue') ? hash['marketValue'] : SKIP
  face_value = hash.key?('faceValue') ? hash['faceValue'] : SKIP
  average_cost = hash.key?('averageCost') ? hash['averageCost'] : SKIP
   = hash.key?('cashAccount') ? hash['cashAccount'] : SKIP
  rate = hash.key?('rate') ? hash['rate'] : SKIP
  expiration_date =
    hash.key?('expirationDate') ? hash['expirationDate'] : SKIP
  inv401k_source = hash.key?('inv401kSource') ? hash['inv401kSource'] : SKIP
  currency = CurrencyEntity1.from_hash(hash['currency']) if hash['currency']
  # Parameter is an array, so we need to iterate through it
  asset_classes = nil
  unless hash['assetClasses'].nil?
    asset_classes = []
    hash['assetClasses'].each do |structure|
      asset_classes << (PortionEntity.from_hash(structure) if structure)
    end
  end

  asset_classes = SKIP unless hash.key?('assetClasses')
  # Parameter is an array, so we need to iterate through it
  fi_asset_classes = nil
  unless hash['fiAssetClasses'].nil?
    fi_asset_classes = []
    hash['fiAssetClasses'].each do |structure|
      fi_asset_classes << (FiPortionEntity.from_hash(structure) if structure)
    end
  end

  fi_asset_classes = SKIP unless hash.key?('fiAssetClasses')
  # Parameter is an array, so we need to iterate through it
  tax_lots = nil
  unless hash['taxLots'].nil?
    tax_lots = []
    hash['taxLots'].each do |structure|
      tax_lots << (TaxLotEntity.from_hash(structure) if structure)
    end
  end

  tax_lots = SKIP unless hash.key?('taxLots')
  digital_units = hash.key?('digitalUnits') ? hash['digitalUnits'] : SKIP
  security = hash.key?('security') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:HoldingEntitySecurity), hash['security']
  ) : SKIP
  # Parameter is an array, so we need to iterate through it
  fi_attributes = nil
  unless hash['fiAttributes'].nil?
    fi_attributes = []
    hash['fiAttributes'].each do |structure|
      fi_attributes << (FiAttributeEntity.from_hash(structure) if structure)
    end
  end

  fi_attributes = SKIP unless hash.key?('fiAttributes')

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  HoldingEntity.new(holding_id: holding_id,
                    security_ids: security_ids,
                    holding_name: holding_name,
                    holding_type: holding_type,
                    holding_sub_type: holding_sub_type,
                    position_type: position_type,
                    held_in_account: ,
                    description: description,
                    symbol: symbol,
                    original_purchase_date: original_purchase_date,
                    purchased_price: purchased_price,
                    current_amortization_factor: current_amortization_factor,
                    current_unit_price: current_unit_price,
                    change_in_price: change_in_price,
                    current_unit_price_date: current_unit_price_date,
                    units: units,
                    market_value: market_value,
                    face_value: face_value,
                    average_cost: average_cost,
                    cash_account: ,
                    rate: rate,
                    expiration_date: expiration_date,
                    inv401k_source: inv401k_source,
                    currency: currency,
                    asset_classes: asset_classes,
                    fi_asset_classes: fi_asset_classes,
                    tax_lots: tax_lots,
                    digital_units: digital_units,
                    security: security,
                    fi_attributes: fi_attributes,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 141

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['holding_id'] = 'holdingId'
  @_hash['security_ids'] = 'securityIds'
  @_hash['holding_name'] = 'holdingName'
  @_hash['holding_type'] = 'holdingType'
  @_hash['holding_sub_type'] = 'holdingSubType'
  @_hash['position_type'] = 'positionType'
  @_hash['held_in_account'] = 'heldInAccount'
  @_hash['description'] = 'description'
  @_hash['symbol'] = 'symbol'
  @_hash['original_purchase_date'] = 'originalPurchaseDate'
  @_hash['purchased_price'] = 'purchasedPrice'
  @_hash['current_amortization_factor'] = 'currentAmortizationFactor'
  @_hash['current_unit_price'] = 'currentUnitPrice'
  @_hash['change_in_price'] = 'changeInPrice'
  @_hash['current_unit_price_date'] = 'currentUnitPriceDate'
  @_hash['units'] = 'units'
  @_hash['market_value'] = 'marketValue'
  @_hash['face_value'] = 'faceValue'
  @_hash['average_cost'] = 'averageCost'
  @_hash['cash_account'] = 'cashAccount'
  @_hash['rate'] = 'rate'
  @_hash['expiration_date'] = 'expirationDate'
  @_hash['inv401k_source'] = 'inv401kSource'
  @_hash['currency'] = 'currency'
  @_hash['asset_classes'] = 'assetClasses'
  @_hash['fi_asset_classes'] = 'fiAssetClasses'
  @_hash['tax_lots'] = 'taxLots'
  @_hash['digital_units'] = 'digitalUnits'
  @_hash['security'] = 'security'
  @_hash['fi_attributes'] = 'fiAttributes'
  @_hash
end

.nullablesObject

An array for nullable fields



213
214
215
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 213

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 177

def self.optionals
  %w[
    holding_id
    security_ids
    holding_name
    holding_type
    holding_sub_type
    position_type
    held_in_account
    description
    symbol
    original_purchase_date
    purchased_price
    current_amortization_factor
    current_unit_price
    change_in_price
    current_unit_price_date
    units
    market_value
    face_value
    average_cost
    cash_account
    rate
    expiration_date
    inv401k_source
    currency
    asset_classes
    fi_asset_classes
    tax_lots
    digital_units
    security
    fi_attributes
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (HoldingEntity | Hash)

    value against the validation is performed.



403
404
405
406
407
408
409
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 403

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 431

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} holding_id: #{@holding_id.inspect}, security_ids: #{@security_ids.inspect},"\
  " holding_name: #{@holding_name.inspect}, holding_type: #{@holding_type.inspect},"\
  " holding_sub_type: #{@holding_sub_type.inspect}, position_type: #{@position_type.inspect},"\
  " held_in_account: #{@held_in_account.inspect}, description: #{@description.inspect},"\
  " symbol: #{@symbol.inspect}, original_purchase_date: #{@original_purchase_date.inspect},"\
  " purchased_price: #{@purchased_price.inspect}, current_amortization_factor:"\
  " #{@current_amortization_factor.inspect}, current_unit_price:"\
  " #{@current_unit_price.inspect}, change_in_price: #{@change_in_price.inspect},"\
  " current_unit_price_date: #{@current_unit_price_date.inspect}, units: #{@units.inspect},"\
  " market_value: #{@market_value.inspect}, face_value: #{@face_value.inspect}, average_cost:"\
  " #{@average_cost.inspect}, cash_account: #{@cash_account.inspect}, rate: #{@rate.inspect},"\
  " expiration_date: #{@expiration_date.inspect}, inv401k_source: #{@inv401k_source.inspect},"\
  " currency: #{@currency.inspect}, asset_classes: #{@asset_classes.inspect},"\
  " fi_asset_classes: #{@fi_asset_classes.inspect}, tax_lots: #{@tax_lots.inspect},"\
  " digital_units: #{@digital_units.inspect}, security: #{@security.inspect}, fi_attributes:"\
  " #{@fi_attributes.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/fdx_v660_api/models/holding_entity.rb', line 412

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} holding_id: #{@holding_id}, security_ids: #{@security_ids}, holding_name:"\
  " #{@holding_name}, holding_type: #{@holding_type}, holding_sub_type: #{@holding_sub_type},"\
  " position_type: #{@position_type}, held_in_account: #{@held_in_account}, description:"\
  " #{@description}, symbol: #{@symbol}, original_purchase_date: #{@original_purchase_date},"\
  " purchased_price: #{@purchased_price}, current_amortization_factor:"\
  " #{@current_amortization_factor}, current_unit_price: #{@current_unit_price},"\
  " change_in_price: #{@change_in_price}, current_unit_price_date:"\
  " #{@current_unit_price_date}, units: #{@units}, market_value: #{@market_value}, face_value:"\
  " #{@face_value}, average_cost: #{@average_cost}, cash_account: #{@cash_account}, rate:"\
  " #{@rate}, expiration_date: #{@expiration_date}, inv401k_source: #{@inv401k_source},"\
  " currency: #{@currency}, asset_classes: #{@asset_classes}, fi_asset_classes:"\
  " #{@fi_asset_classes}, tax_lots: #{@tax_lots}, digital_units: #{@digital_units}, security:"\
  " #{@security}, fi_attributes: #{@fi_attributes}, additional_properties:"\
  " #{@additional_properties}>"
end