Class Holdings
java.lang.Object
org.drip.portfolioconstruction.core.Block
org.drip.portfolioconstruction.composite.Holdings
public class Holdings extends Block
Holdings is a Portfolio of Holdings in the specified Set of Assets.
- Module = Portfolio Core Module
- Library = Asset Allocation Analytics
- Project = Portfolio Construction under Allocation Constraints
- Package = Portfolio Construction Component Groups Suite
- Author:
- Lakshmi Krishnamurthy
-
Constructor Summary
Constructors Constructor Description Holdings(java.lang.String name, java.lang.String id, java.lang.String description, java.lang.String currency)
Holdings Constructor -
Method Summary
Modifier and Type Method Description boolean
add(java.lang.String assetID, double quantity)
Add an Asset/Amount Pairjava.util.Set<java.lang.String>
assetIDSet()
Retrieve the Set of Asset IDsdouble
cash()
Retrieves the Cash Holdingsdouble[]
constrict(Holdings holdingsOther)
Constrict "This" Holdings to those of the Assets in the "Other" Holdingsboolean
contains(java.lang.String assetID)
Indicates if an Asset exists in the Holdingsjava.lang.String
currency()
Retrieve the Currencydouble
quantity(java.lang.String assetID)
Retrieves the Holdings Quantity for the Asset (if it exists)java.util.Map<java.lang.String,java.lang.Double>
quantityMap()
Retrieve the Map of Holdings Amountdouble[]
toArray()
Retrieve the Array Form of the Holdings QuantityMethods inherited from class org.drip.portfolioconstruction.core.Block
description, hashCode, id, name, Standard, timeStamp
Methods inherited from class java.lang.Object
equals, getClass, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Holdings
public Holdings(java.lang.String name, java.lang.String id, java.lang.String description, java.lang.String currency) throws java.lang.ExceptionHoldings Constructor- Parameters:
name
- The Asset Nameid
- The Asset IDdescription
- The Asset Descriptioncurrency
- The Account Currency- Throws:
java.lang.Exception
- Thrown if the Inputs are Invalid
-
-
Method Details
-
assetIDSet
public java.util.Set<java.lang.String> assetIDSet()Retrieve the Set of Asset IDs- Returns:
- The Set of Asset IDs
-
quantityMap
public java.util.Map<java.lang.String,java.lang.Double> quantityMap()Retrieve the Map of Holdings Amount- Returns:
- The Map of Holdings Amount
-
add
public boolean add(java.lang.String assetID, double quantity)Add an Asset/Amount Pair- Parameters:
assetID
- The Asset IDquantity
- The Amount in the Portfolio- Returns:
- TRUE - The Asset/Amount has been successfully added
-
contains
public boolean contains(java.lang.String assetID)Indicates if an Asset exists in the Holdings- Parameters:
assetID
- The Asset ID- Returns:
- TRUE - The Asset is Part of the Holdings (may have Zero Value though)
-
quantity
public double quantity(java.lang.String assetID) throws java.lang.ExceptionRetrieves the Holdings Quantity for the Asset (if it exists)- Parameters:
assetID
- The Asset ID- Returns:
- The Holdings Quantity for the Asset (if it exists)
- Throws:
java.lang.Exception
- Thrown if the Inputs are Invalid
-
currency
public java.lang.String currency()Retrieve the Currency- Returns:
- The Currency
-
cash
public double cash()Retrieves the Cash Holdings- Returns:
- The Cash Holdings
-
toArray
public double[] toArray()Retrieve the Array Form of the Holdings Quantity- Returns:
- Array Form of the Holdings Quantity
-
constrict
Constrict "This" Holdings to those of the Assets in the "Other" Holdings- Parameters:
holdingsOther
- The Other Holdings Instance- Returns:
- Constriction of "This" Holdings
-