Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripted trade does not generate past cashflows when value date is strictly after the last settlement date #253

Open
quantthingy opened this issue Jul 8, 2024 · 12 comments
Assignees

Comments

@quantthingy
Copy link

true

how to reproduce:

  • change value date to any date strictly after after the last settlement date

result:

  • cashflow table is empty

expected result:

  • return the past cash flows

I can provide an example if needed.

@pcaspers
Copy link
Collaborator

pcaspers commented Jul 8, 2024

Hi! Just to be sure - are you setting

  • includePastCashflows to true in the cashflow analytic settings (in ore.xml) and
  • IncludePastCashflows to true in the EngineParameters of the scripted trade engine configuration

Both is necessary to get past cashflows in the report. The first flag controls the general filter on past cashflows and the second flag enables past cashflow info generation for scripted trades.

If you are using both flags already, could you kindly post an example to reproduce the issue? Thanks!

@quantthingy
Copy link
Author

Both flags are included.
Provided an example based on Example 52 from the release, using 1.8.12.1 version

Input and Output files are included.

Thanks for looking into it.

Archive.zip

@pcaspers
Copy link
Collaborator

pcaspers commented Jul 9, 2024

The trade is considered "expired" in this case and therefore excluded from all reports.

I'll change the behavior so that the trade never expires if IncludePastCashflows is active for scripted trades. This change should appear on the master branch soon.

Please note that this change won't change the behavior of non-scripted trades which will still be excluded from the reporting if they are expired.

@pcaspers
Copy link
Collaborator

pcaspers commented Jul 9, 2024

A few more notes:

There is a typo in the parameter name in ore.xml, it should be

    <Analytic type="cashflow">
...
      <Parameter name="includePastCashflows">true</Parameter>
    </Analytic>

The example script does not produce a cashflow. I changed

        <Number>
          <Name>GuaranteedFixings</Name>
          <Value>0</Value>
        </Number>

to get a flow for testing.

@quantthingy
Copy link
Author

Thanks for the change.

Some brainstorming:

  • the current behavior is inconsistent as Autocallable are generating Cashflow information between an early knock-out and the last potential settlement date. Maybe the script language could be enhanced with an "Expired" Keyword?
  • there is a business case for a cashflows report including expired trades, targeted to back-office reconciliation (checking the counterparty settled the correct amount for derivatives trades)

@pcaspers
Copy link
Collaborator

  • Autocallabe: It should not. Can you give an example?
  • Use case reconciliation: yes, agreed.

@quantthingy
Copy link
Author

. Autocallable: I was referring to any Scripted trade with a Knock-out barrier. From a financial point of view, the expiry date is the Knock-Out date and not the the last potential Settlement date. This is the same logic for any barrier instrument.

in ored/portfolio/autocallable_01.hpp , the Trade Autocallable_01 is such an example

@pcaspers
Copy link
Collaborator

pcaspers commented Jul 10, 2024 via email

@quantthingy
Copy link
Author

quantthingy commented Jul 10, 2024

Agree. To be precise:

Assuming an autocallable with 3 autocall observation dates: 1 Jan 2023, 1 Feb 2022, 1 March 2022
If the autocall happened on 1 Feb 2022 (and therefore no cashflow on 1 March 2022), then I got the following in my test:

case 1: Value date on 15 Feb 2022: historical cashflow table generated at the instrument level
case 2: Value date on 15 Mach 2022: no historical cashflow table generated at the instrument level

Your solution will solve this inconsistency.

(apology dont have an example to share, as all the test were in c++)

@pcaspers
Copy link
Collaborator

ok sounds good, we'll try to push out an update on master so that you can test the fix

@pcaspers pcaspers self-assigned this Jul 21, 2024
@quantthingy
Copy link
Author

Hi, Any update on this request?

@pcaspers
Copy link
Collaborator

apologies - we did the code changes internally, but they are not yet published on github, this might take until the next full release (planned for March 2025)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants