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

Web server orders routes #1841

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Web server orders routes #1841

wants to merge 4 commits into from

Conversation

azarovh
Copy link
Member

@azarovh azarovh commented Nov 19, 2024

3 routes were added:

  • get order by id
  • get all orders
  • get all orders for trading pair

SELECT order_id, initially_asked, ask_balance, ask_currency, initially_given, give_balance, give_currency, conclude_destination, next_nonce, creation_block_height, block_height, ROW_NUMBER() OVER(PARTITION BY order_id ORDER BY block_height DESC) as newest
FROM ml.orders
) AS sub
WHERE newest = 1 AND ((ask_currency = $1 AND give_currency = $2) OR (ask_currency = $2 AND give_currency = $1))
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure on the OR if it is useful or not, if someone is searching to buy currency X it might not be very useful to give return results that both buy or sell X. Probably a question for the UI guys what they need.

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea was to provide a function to build order book as it displays both sell and buy prices. I think thats more common use case similar to exchanges.

Will ask Sergey for an opinion anyway.

api-server/storage-test-suite/src/basic.rs Show resolved Hide resolved
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