security_analytics.get_cashflows
********************************

spice.security_analytics.get_cashflows(cashflow_requests: list[dict]) -> dict[str, list[dict]]

   Gets the cashflows schedule of securities with per-security
   parameters.

   Parameters:
      **cashflow_requests** (*list**[**dict**]*) --

      List of cashflow requests. Each dict contains:

      * isin (str): ISIN of the security (e.g., "INE040A08AK2")

      * as_of_date (str, optional): Date in YYYY-MM-DD format.
        Defaults to today's date if not provided. If complete cashflow
        schedule (including those in the past) is required, provide
        the start date of the security. Example: "2024-03-15"

      * quantum (float, optional): Quantum value for cashflow
        calculations

   Returns:
      Dictionary mapping ISIN to its cashflow schedule after
      as_of_date.
         Each cashflow list contains dictionaries with the following
         fields:

            {
                "record_date": "Cut-off date for cashflow recipient",
                "payment_date": "Date on which cashflow is paid",
                "coupon": "Amount of coupon payment transaction",
                "principal": "Amount of principal payment transaction",
            }

         Example return value:

            {
                "INE040A08AK2": [
                    {
                        "record_date": "2026-03-05",
                        "payment_date": "2026-03-20",
                        "coupon": 7650.00,
                        "principal": 0.00,
                    },
                    {
                        "record_date": "2027-03-05",
                        "payment_date": "2027-03-20",
                        "coupon": 7650.00,
                        "principal": 0.00,
                    },
                ],
                "INE001A08AA1": [
                    {
                        "record_date": "2024-06-15",
                        "payment_date": "2024-06-20",
                        "coupon": 5000.00,
                        "principal": 0.00,
                    }
                ]
            }

         If an ISIN fails, it will have an "error" key instead:

            {
                "INE040A08AK2": [{"record_date": "2026-03-05", ...}],
                "INE999A99XX9": {"error": "Error message"}
            }

   Return type:
      dict[str, list[dict]]

   Note:

     * Cashflow amounts are in the security's currency units

   -[ Example ]-

   >>> import spice.security_analytics as sa
   >>> requests = [
   ...     {"isin": "INE001A08AA1", "as_of_date": "2024-01-15"},
   ...     {"isin": "INE040A08AK2", "as_of_date": "2024-01-15", "quantum": 1000}
   ... ]
   >>> cf = sa.get_cashflows(requests)
   >>> print(cf["INE001A08AA1"][0])
   {'record_date': '2024-06-15', 'payment_date': '2024-06-20', 'coupon': 5000.0, 'principal': 0.0}
