Skip to content

nav-fund-services: Only limit queried date range to FundOfficialAccountingLastAvailableDate when requested - #5496

Merged
mohamed-mehany merged 2 commits into
mainfrom
fix/nav-fund-services-opt-in-official-date-cap
Oct 6, 2026
Merged

mohamed-mehany merged 2 commits into
mainfrom
fix/nav-fund-services-opt-in-official-date-cap

Conversation

@mohamed-mehany

@mohamed-mehany mohamed-mehany commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Closes INCIDENT-2735

Related: OPDATA-8508, OPDATA-8507

Description

#5392 (released in 1.3.2) limited the toDate of every NAV query to FundOfficialAccountingLastAvailableDate from GetFundList. This was needed for fund 257726 (Syntetika), where the provider rejects later dates with a 423.

For SWEEP (220980), FundOfficialAccountingLastAvailableDate trails the latest published NAV by 1–2 business days, and the provider accepts later dates for that fund. Because the limit applied to all funds, the SWEEP stream reported a NAV 1–2 business days old, which led to INCIDENT-2735. NOPs were rolled back to 1.3.0, which in turn blocks the Syntetika feed.

This PR makes the limit opt-in. By default the EA behaves like 1.3.0 again. Feeds that need the limit (Syntetika) set limitToOfficialAccountingDate: true.

Known limitation: for 257726, FundOfficialAccountingLastAvailableDate (09-15) is also earlier than what the provider actually allows. The 423 error says "Data is consistent until 09/30/2026", and a query up to 09-30 returns a 09-30 row. So with the flag on, the Syntetika value can lag the newest data the provider allows. A follow-up could cap at the date from the 423 response instead.

Changes

  • Add a limitToOfficialAccountingDate input parameter to the nav endpoint (boolean, default false).
  • Only call GetFundList and limit toDate to FundOfficialAccountingLastAvailableDate when limitToOfficialAccountingDate is true. By default the EA queries up to GetAccountingDataDates.ToDate with 2 provider calls per cycle, as in 1.3.0.
  • Log a warning when the limit actually lowers toDate.
  • Handle a null FundOfficialAccountingLastAvailableDate (previously typed as string, which would have thrown on new Date("nullZ")): don't limit, and log a warning.
  • Unit and integration tests for the default (unlimited) path, the opt-in path, and the null case.
  • Minor changeset, since this changes the default behaviour compared to 1.3.2 and adds an input parameter.

Steps to Test

  1. yarn test packages/sources/nav-fund-services
  2. Run the EA locally with credentials for SWEEP (220980), cEPIC (265693) and Syntetika (257726).
  3. Send requests. Results below were captured on 2026-10-06 at ~16:10–16:20 UTC.

SWEEP (220980)

Default. This returns the latest published NAV (10-06), the same as 1.3.0:

curl -s -X POST localhost:18080 -H 'Content-Type: application/json' \
  -d '{"data":{"globalFundID":220980}}' | jq
{
  "statusCode": 200,
  "result": 1.01359972,
  "data": {
    "globalFundID": 220980,
    "navPerShare": 1.01359972,
    "nextNavPerShare": 1.01369498,
    "navDate": "10-06-2026",
    "endingBalance": 158481760.0627141,
    "navDateTimestampMs": 1791270000000
  },
  "timestamps": {
    "providerDataRequestedUnixMs": 1791292227168,
    "providerDataReceivedUnixMs": 1791292230173,
    "providerIndicatedTimeUnixMs": 1791244800000
  }
}

limitToOfficialAccountingDate: true. This is limited to FundOfficialAccountingLastAvailableDate (10-05), which is the 1.3.2 behaviour:

curl -s -X POST localhost:18080 -H 'Content-Type: application/json' \
  -d '{"data":{"globalFundID":220980,"limitToOfficialAccountingDate":true}}' | jq
{
  "statusCode": 200,
  "result": 1.01350446,
  "data": {
    "globalFundID": 220980,
    "navPerShare": 1.01350446,
    "nextNavPerShare": 1.01359859,
    "navDate": "10-05-2026",
    "endingBalance": 158466866.00150877,
    "navDateTimestampMs": 1791183600000
  },
  "timestamps": {
    "providerDataRequestedUnixMs": 1791292290186,
    "providerDataReceivedUnixMs": 1791292293839,
    "providerIndicatedTimeUnixMs": 1791158400000
  }
}

cEPIC (265693)

Default. The latest NAV is 10-05, and the provider has no 10-06 data for this fund yet:

curl -s -X POST localhost:18080 -H 'Content-Type: application/json' \
  -d '{"data":{"globalFundID":265693}}' | jq
{
  "statusCode": 200,
  "result": 1648.18,
  "data": {
    "globalFundID": 265693,
    "navPerShare": 1648.18,
    "nextNavPerShare": null,
    "navDate": "10-05-2026",
    "endingBalance": 1648.18,
    "navDateTimestampMs": 1791183600000
  },
  "timestamps": {
    "providerDataRequestedUnixMs": 1791292290187,
    "providerDataReceivedUnixMs": 1791292293059,
    "providerIndicatedTimeUnixMs": 1791158400000
  }
}

limitToOfficialAccountingDate: true. This returns the same date, because cEPIC's ToDate already equals its official accounting date:

curl -s -X POST localhost:18080 -H 'Content-Type: application/json' \
  -d '{"data":{"globalFundID":265693,"limitToOfficialAccountingDate":true}}' | jq
{
  "statusCode": 200,
  "result": 1648.18,
  "data": {
    "globalFundID": 265693,
    "navPerShare": 1648.18,
    "nextNavPerShare": null,
    "navDate": "10-05-2026",
    "endingBalance": 1648.18,
    "navDateTimestampMs": 1791183600000
  },
  "timestamps": {
    "providerDataRequestedUnixMs": 1791292766281,
    "providerDataReceivedUnixMs": 1791292771551,
    "providerIndicatedTimeUnixMs": 1791158400000
  }
}

Syntetika (257726)

limitToOfficialAccountingDate: true with resultField: endingBalance. This is the request for the Syntetika feed:

curl -s -X POST localhost:18080 -H 'Content-Type: application/json' \
  -d '{"data":{"globalFundID":257726,"resultField":"endingBalance","limitToOfficialAccountingDate":true}}' | jq
{
  "statusCode": 200,
  "result": 186.45354297,
  "data": {
    "globalFundID": 257726,
    "navPerShare": 0,
    "nextNavPerShare": null,
    "navDate": "09-15-2026",
    "endingBalance": 186.45354297,
    "navDateTimestampMs": 1789455600000
  },
  "timestamps": {
    "providerDataRequestedUnixMs": 1791292702626,
    "providerDataReceivedUnixMs": 1791292706256,
    "providerIndicatedTimeUnixMs": 1789430400000
  }
}

Default. Without the limit, the provider rejects the date range (423), which is why this fund needs the flag:

curl -s -X POST localhost:18080 -H 'Content-Type: application/json' \
  -d '{"data":{"globalFundID":257726,"resultField":"endingBalance"}}' | jq
{
  "statusCode": 502,
  "errorMessage": "Request failed with status code 423",
  "timestamps": {
    "providerDataRequestedUnixMs": 0,
    "providerDataReceivedUnixMs": 0
  }
}

Quality Assurance

  • If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant infra-k8s configuration file.
  • If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant adapter-secrets configuration file.
  • If a new adapter was made, or a new endpoint was added, update the test-payload.json file with relevant requests.
  • The branch naming follows git flow (feature/x, chore/x, release/x, hotfix/x, fix/x) or is created from Jira.
  • This is related to a maximum of one Jira story or GitHub issue.
  • Types are safe (avoid TypeScript/TSLint features like any and disable, instead use more specific types).
  • All code changes have 100% unit and integration test coverage. If testing is not applicable or too difficult to justify doing, the reasoning should be documented explicitly in the PR.

@changeset-bot

changeset-bot Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a36d5e8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@chainlink/nav-fund-services-adapter Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread packages/sources/nav-fund-services/src/transport/nav.ts Outdated
@mohamed-mehany
mohamed-mehany merged commit 507f2e6 into main Oct 6, 2026
23 checks passed
@mohamed-mehany
mohamed-mehany deleted the fix/nav-fund-services-opt-in-official-date-cap branch October 6, 2026 14:39
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

Successfully merging this pull request may close these issues.

2 participants