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

external-api: external_match: add get_quote_amount helper #862

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

sehyunc
Copy link
Contributor

@sehyunc sehyunc commented Dec 16, 2024

Purpose

This PR adds a get_quote_amount helper to precisely calculate the implied quote amount given a decimal corrected price.

Testing

  • Tested locally
  • Tested in testnet

@sehyunc sehyunc changed the title external-api: external_match: add helper external-api: external_match: add get_quote_amount helper Dec 16, 2024
@sehyunc sehyunc requested a review from joeykraut December 16, 2024 23:02
///
/// The price here is expected to be decimal corrected; i.e. multiplied by
/// the decimal diff for the two tokens
pub fn get_quote_amount(&self, price: FixedPoint) -> Amount {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will you move this to be co-located with get_base_amount above, and make get_base_amount public?

@sehyunc sehyunc force-pushed the sehyun/add-get-quote-amount branch from 4e1e32d to 209450c Compare December 16, 2024 23:19
@sehyunc sehyunc merged commit 58b3211 into main Dec 16, 2024
2 of 3 checks passed
@sehyunc sehyunc deleted the sehyun/add-get-quote-amount branch December 16, 2024 23:20
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