Skip to content
Rizwan Saeed edited this page Aug 10, 2020 · 1 revision

Cash in LUSID

Currencies are handled explicitly as their own instrument type and come pre-loaded into a LUSID account, for example a GBP currency should be uploaded with the identifier_mapping {"Currency": "Currency_code"} as shown below.

Note: The utility function identify_cash_items() can be used to generate the column containing the currency code and update the mapping accordingly for datasets that do not contain a dedicated column for currency code.

inst_name portfolio Currency_code FIGI Price Currency amount units effective_date settle_date Broker Name
Apple tech_001 None BBG0013T5HY0 51 USD 255 500 18/11/2019 20/11/2019 B1
MICROSOFT CORP tech_001 None BBG007F5XJZ0 65 USD 245 250 18/11/2019 18/11/2019 B2
UBER Tech tech_002 None BBG00NW4HSM1 49 USD 448 700 18/11/2019 24/11/2019 B1
USD_cash tech_002 USD 1 USD 500 100 18/11/2019 24/11/2019 B1
mapping["holdings"]:{
    "required":{
        "code": "Portfolio",
        "effective_at": "effective_date",
        "tax_lots.units": "units"
    },
    "identifier_mapping": {       
        "Figi": "FIGI",
        "Currency": "Currency_code"
    },
    "optional": {
        "tax_lots.cost.amount": "amount",
        "tax_lot.cost.currency": "Currency",
        "tax_lots.price": "Price"
    }
}
result = lpt.load_from_data_frame(
    api_factory=api_factory,
    scope=holdings_scope,
    data_frame=seg_df,
    mapping_required=mapping["holdings"]["required"],
    mapping_optional=mapping["holdings"]["optional"],
    identifier_mapping=holdings_mapping["holdings"]["identifier_mapping"],
    file_type="holdings"
)