galatea-associates / fuse-test-data-gen

Repository for the Galatea internal data generator tool, used for generating domain data for POCs
0 stars 0 forks source link

Cash Flow Factory #217

Closed WilfGala closed 4 years ago

WilfGala commented 4 years ago

Issue Description

As mentioned in the 1-pager, Cash Flow is a required MVP domain object. The attributes of this need to be researched and defined, and the codebase needs to be updated to include a CashFlowFactory class for generating Cash Flow records, as well as a test file for validation the Cash Flow records produced.

'Cash Flow' is an ambiguous term as it can be taken to refer to any virtual or physical transfer of cash or cash-equivalents, but is more commonly used in corporate accounting (eg free cash flow), or to describe payment streams associated with an instrument (eg coupon/dividend/swap payments).

In our case, we are taking a single Cash Flow record as representing a single dividend payment in cash into a 'Client' or 'Firm' account as a result of that account holding a long position in a certain instrument. Dividends are chosen as currently the Instrument domain model is only representative of equity securities.

Design

The Cash Flow data model should be researched and defined, and a new file cash_flow_factory.py in the domainobjectfactories folder should be written to create these records. Both config.json and dev_config.json should be updated to incorporate the new domain object, and a cash_flow_test.py file should be written in the test_domain_objects folder to validate the attributes of the created records.

Cash Flow object is dependant on a 'Client' or 'Firm' Account object.

Data Model table:

Attribute Implementation
account_id reference to the account_id attribute of an Account object where account_type is 'Client' or 'Firm'
corporate_action_id identifier representing the corporate action that set the value of the dividend payment
quantity amount of cash being transferred, randomly generated float to 2 decimal places
currency currency from 'USD', 'CAD', 'EUR', 'GBP', 'CHF', 'JPY', 'SGD'
payment_status 'Actual' or 'Contractual'
payment_type 'Dividend'
payment_date date payment was made in UTC, for now we will use the current date

Documentation Changes

Module and function docstrings should be added/amended as appropriate.

Test Evidence

Newly written test should pass. Cash Flow output files from running the app should be as expected.

Validation in Develop

Running python src/app.py should produce valid output