Skip to content

OPDATA-7807: Add support for min/max operations#5115

Draft
yasssuzcll wants to merge 2 commits into
mainfrom
yasssuz/feature/calculate-price-min-max
Draft

OPDATA-7807: Add support for min/max operations#5115
yasssuzcll wants to merge 2 commits into
mainfrom
yasssuz/feature/calculate-price-min-max

Conversation

@yasssuzcll

@yasssuzcll yasssuzcll commented Jun 19, 2026

Copy link
Copy Markdown

OPDATA-7807

Description

Adds min and max as supported operations to the calculated-price composite adapter's computedPrice endpoint.

Previously the operation parameter only accepted divide and multiply. With this change, min returns the smaller of the two operand medians and max returns the larger.

Changes

  • Extended operation input parameter options to include min and max
  • Implemented Decimal.min() / Decimal.max() logic in ComputedPriceTransport
  • Added integration tests for both new operations
  • Updated README to reflect the new options

Steps to Test

curl -X POST http://localhost:8080 \
  -H 'Content-Type: application/json' \
  -d '{
    "data": {
      "operand1Sources": ["ncfx"],
      "operand1Input": "{\"from\":\"LINK\",\"to\":\"USD\"}",
      "operand2Sources": ["tiingo"],
      "operand2Input": "{\"from\":\"ETH\",\"to\":\"USD\"}",
      "operation": "min"
    }
  }'

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.

@yasssuzcll yasssuzcll self-assigned this Jun 19, 2026
@changeset-bot

changeset-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 108e282

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

This PR includes changesets to release 1 package
Name Type
@chainlink/calculated-price-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

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.

1 participant