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

No currency exchange rate #183

Merged
merged 5 commits into from
Jan 8, 2024

Conversation

arkanoider
Copy link
Collaborator

Hi @grunch @bilthon ,

did some refactoring for error messages on Yadio request, should be better now:

  • If 4 retries are over we get:
MostroError::NoAPIResponse => write!(f, "Price API not answered - retry")
  • No currency exchange on Yadio list:
MostroError::NoCurrency => write!(f, "Currency requested is not present in the exchange list, please specify a fixed rate"),
  • Malformed answer from Yadio
MostroError::MalformedAPIRes => write!(f, "Malformed answer from exchange quoting request")

@arkanoider
Copy link
Collaborator Author

Added a check to use fixed amount rate specified by user when new order is created.

Example:
mostro-cli neworder -k sell -a 20000 -c XMR -f 10 -m SEPA

Now takes 20000 sats as the amout the user want to exchange for 20 XMR, before we asked to Yadio api anyway causing wrong quote or no quote imo.

Let me know

@arkanoider
Copy link
Collaborator Author

Added an extra check in order.rs to avoid negative amount ( with fixed or calculated ), don't know if it's necessary, but could be an extra safety check.

Feel free to merge it or no...easy to remove!

Copy link
Member

@grunch grunch left a comment

Choose a reason for hiding this comment

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

LGTM

@grunch grunch merged commit b16cb5e into MostroP2P:main Jan 8, 2024
1 check passed
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