Source code for sdk.lusid.models.fund_cash_statement_local_currency

# coding: utf-8

"""
    LUSID API

    FINBOURNE Technology  # noqa: E501

    Contact: info@finbourne.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


from __future__ import annotations
import pprint
import re  # noqa: F401
import json


from typing import List, Dict, Optional, Any, Union, TYPE_CHECKING
from typing_extensions import Annotated
from pydantic.v1 import BaseModel, StrictStr, StrictInt, StrictBool, StrictFloat, StrictBytes, Field, validator, ValidationError, conlist, constr
from datetime import datetime
from lusid.models.currency_and_amount import CurrencyAndAmount
from lusid.models.link import Link
from lusid.models.model_property import ModelProperty
from lusid.models.perpetual_property import PerpetualProperty
from lusid.models.resource_id import ResourceId

[docs] class FundCashStatementLocalCurrency(BaseModel): """ A single row in the local-currency Fund Cash Statement report. Each row is a settled cash movement with a running balance in local currency only; base-currency columns are out of scope for this variant and are not returned. # noqa: E501 """ group_by_id: Optional[StrictInt] = Field(default=None, description="The groupBy subHoldings and currency.", alias="groupById") sequence_number: Optional[StrictInt] = Field(default=None, description="Sequence number determining the order of the cash flow records.", alias="sequenceNumber") sub_holding_keys: Optional[Dict[str, PerpetualProperty]] = Field(default=None, description="The sub-holding properties which identify the holding. Each property will be from the 'Transaction' domain. These are configured on a transaction portfolio.", alias="subHoldingKeys") source_id: Optional[StrictStr] = Field(None,alias="sourceId", description="The transaction ID that sourced this cash movement.") cash_statement_action_type: Optional[StrictStr] = Field(None,alias="cashStatementActionType", description="The action type: Default, Reversal, TrueUp, SystemCorrection, Opening, or Closing.") entry_type: Optional[StrictStr] = Field(None,alias="entryType", description="What drove the row: SystemGenerated (accounting-engine housekeeping such as a reversal/true-up around a backdated transaction) or UserEntered (a real cash movement booked by a user, e.g. a late trade or amendment).") accounting_date: Optional[datetime] = Field(default=None, description="The accounting date of the cash movement.", alias="accountingDate") activity_date: Optional[datetime] = Field(default=None, description="The activity date (trade/settlement date) of the cash movement.", alias="activityDate") movement_name: Optional[StrictStr] = Field(None,alias="movementName", description="The movement type (e.g. Receivable_Cash_Trade, Payable_Cash_Trade).") portfolio_id: Optional[ResourceId] = Field(default=None, alias="portfolioId") instruction_type: Optional[StrictStr] = Field(None,alias="instructionType", description="The settlement instruction type: Automatic, Instructed_Complete, Instructed - Cancel Automatic.") diary_entry_code: Optional[StrictStr] = Field(None,alias="diaryEntryCode", description="The diary entry code of the valuation point this row belongs to.") origin_diary_entry_code: Optional[StrictStr] = Field(None,alias="originDiaryEntryCode", description="For Reversal/TrueUp rows: the diary entry code of the period the original row belonged to.") cashflow_local: Optional[CurrencyAndAmount] = Field(default=None, alias="cashflowLocal") balance_local: Optional[CurrencyAndAmount] = Field(default=None, alias="balanceLocal") properties: Optional[Dict[str, ModelProperty]] = Field(default=None, description="The requested properties decorated onto the cash statement row.") links: Optional[List[Link]] = None __properties = ["groupById", "sequenceNumber", "subHoldingKeys", "sourceId", "cashStatementActionType", "entryType", "accountingDate", "activityDate", "movementName", "portfolioId", "instructionType", "diaryEntryCode", "originDiaryEntryCode", "cashflowLocal", "balanceLocal", "properties", "links"]
[docs] class Config: """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True
def __str__(self): """For `print` and `pprint`""" return pprint.pformat(self.dict(by_alias=False)) def __repr__(self): """For `print` and `pprint`""" return self.to_str()
[docs] def to_str(self) -> str: """Returns the string representation of the model using alias""" return pprint.pformat(self.dict(by_alias=True))
[docs] def to_json(self) -> str: """Returns the JSON representation of the model using alias""" return json.dumps(self.to_dict())
[docs] @classmethod def from_json(cls, json_str: str) -> FundCashStatementLocalCurrency: """Create an instance of FundCashStatementLocalCurrency from a JSON string""" return cls.from_dict(json.loads(json_str))
[docs] def to_dict(self): """Returns the dictionary representation of the model using alias""" _dict = self.dict(by_alias=True, exclude={ }, exclude_none=True) # override the default output from pydantic by calling `to_dict()` of each value in sub_holding_keys (dict) _field_dict = {} if self.sub_holding_keys: for _key in self.sub_holding_keys: if self.sub_holding_keys[_key]: _field_dict[_key] = self.sub_holding_keys[_key].to_dict() _dict['subHoldingKeys'] = _field_dict # override the default output from pydantic by calling `to_dict()` of portfolio_id if self.portfolio_id: _dict['portfolioId'] = self.portfolio_id.to_dict() # override the default output from pydantic by calling `to_dict()` of cashflow_local if self.cashflow_local: _dict['cashflowLocal'] = self.cashflow_local.to_dict() # override the default output from pydantic by calling `to_dict()` of balance_local if self.balance_local: _dict['balanceLocal'] = self.balance_local.to_dict() # override the default output from pydantic by calling `to_dict()` of each value in properties (dict) _field_dict = {} if self.properties: for _key in self.properties: if self.properties[_key]: _field_dict[_key] = self.properties[_key].to_dict() _dict['properties'] = _field_dict # override the default output from pydantic by calling `to_dict()` of each item in links (list) _items = [] if self.links: for _item in self.links: if _item: _items.append(_item.to_dict()) _dict['links'] = _items # set to None if sub_holding_keys (nullable) is None # and __fields_set__ contains the field if self.sub_holding_keys is None and "sub_holding_keys" in self.__fields_set__: _dict['subHoldingKeys'] = None # set to None if source_id (nullable) is None # and __fields_set__ contains the field if self.source_id is None and "source_id" in self.__fields_set__: _dict['sourceId'] = None # set to None if cash_statement_action_type (nullable) is None # and __fields_set__ contains the field if self.cash_statement_action_type is None and "cash_statement_action_type" in self.__fields_set__: _dict['cashStatementActionType'] = None # set to None if entry_type (nullable) is None # and __fields_set__ contains the field if self.entry_type is None and "entry_type" in self.__fields_set__: _dict['entryType'] = None # set to None if movement_name (nullable) is None # and __fields_set__ contains the field if self.movement_name is None and "movement_name" in self.__fields_set__: _dict['movementName'] = None # set to None if instruction_type (nullable) is None # and __fields_set__ contains the field if self.instruction_type is None and "instruction_type" in self.__fields_set__: _dict['instructionType'] = None # set to None if diary_entry_code (nullable) is None # and __fields_set__ contains the field if self.diary_entry_code is None and "diary_entry_code" in self.__fields_set__: _dict['diaryEntryCode'] = None # set to None if origin_diary_entry_code (nullable) is None # and __fields_set__ contains the field if self.origin_diary_entry_code is None and "origin_diary_entry_code" in self.__fields_set__: _dict['originDiaryEntryCode'] = None # set to None if properties (nullable) is None # and __fields_set__ contains the field if self.properties is None and "properties" in self.__fields_set__: _dict['properties'] = None # set to None if links (nullable) is None # and __fields_set__ contains the field if self.links is None and "links" in self.__fields_set__: _dict['links'] = None return _dict
[docs] @classmethod def from_dict(cls, obj: dict) -> FundCashStatementLocalCurrency: """Create an instance of FundCashStatementLocalCurrency from a dict""" if obj is None: return None if not isinstance(obj, dict): return FundCashStatementLocalCurrency.parse_obj(obj) _obj = FundCashStatementLocalCurrency.parse_obj({ "group_by_id": obj.get("groupById"), "sequence_number": obj.get("sequenceNumber"), "sub_holding_keys": dict( (_k, PerpetualProperty.from_dict(_v)) for _k, _v in obj.get("subHoldingKeys").items() ) if obj.get("subHoldingKeys") is not None else None, "source_id": obj.get("sourceId"), "cash_statement_action_type": obj.get("cashStatementActionType"), "entry_type": obj.get("entryType"), "accounting_date": obj.get("accountingDate"), "activity_date": obj.get("activityDate"), "movement_name": obj.get("movementName"), "portfolio_id": ResourceId.from_dict(obj.get("portfolioId")) if obj.get("portfolioId") is not None else None, "instruction_type": obj.get("instructionType"), "diary_entry_code": obj.get("diaryEntryCode"), "origin_diary_entry_code": obj.get("originDiaryEntryCode"), "cashflow_local": CurrencyAndAmount.from_dict(obj.get("cashflowLocal")) if obj.get("cashflowLocal") is not None else None, "balance_local": CurrencyAndAmount.from_dict(obj.get("balanceLocal")) if obj.get("balanceLocal") is not None else None, "properties": dict( (_k, ModelProperty.from_dict(_v)) for _k, _v in obj.get("properties").items() ) if obj.get("properties") is not None else None, "links": [Link.from_dict(_item) for _item in obj.get("links")] if obj.get("links") is not None else None }) return _obj
FundCashStatementLocalCurrency.update_forward_refs()