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

Fix TWAP and Limit Order Status Display #5305

Merged
merged 14 commits into from
Jan 23, 2025

Conversation

fairlighteth
Copy link
Contributor

@fairlighteth fairlighteth commented Jan 16, 2025

Fix TWAP and Limit Order Status Display

This PR improves how order statuses are displayed in the "fills at" column for both TWAP parent orders and limit orders.

Changes

TWAP Parent Orders

  • Added status display for when all child orders are expired
  • Fixed status display logic to show:
    • "Order filled" when all child orders are 100% filled
    • "Order partially filled" when all child orders have some fills
    • "Order cancelled" when all child orders are cancelled
    • "Order expired" when all child orders are expired

Limit Orders

  • Fixed status precedence in the "fills at" column and status box:
    1. CANCELLED (takes precedence as final state)
    2. EXPIRED (final state)
    3. FILLED/PARTIALLY FILLED (execution state)
  • A cancelled order will now always show:
    • "Order cancelled" in both the "fills at" column and status box
    • The fill percentage bar still shows how much was filled before cancellation for historical context

Testing

Verified display for various order states:

  • TWAP parent orders with all children expired
  • TWAP parent orders with mixed child states
  • Limit orders cancelled after partial fills
  • Limit orders with various fill percentages

Visual Examples

  • A cancelled limit order with 89.85% fills shows:
    • "Order cancelled" in both the "fills at" column and status box
    • 89.85% in the progress bar to show historical fill amount
Screenshot 2025-01-16 at 17 41 32 Screenshot 2025-01-16 at 17 13 22 Screenshot 2025-01-16 at 17 11 45 Screenshot 2025-01-16 at 17 46 26

Copy link

vercel bot commented Jan 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
cowfi ✅ Ready (Inspect) Visit Preview Jan 21, 2025 0:23am
explorer-dev ✅ Ready (Inspect) Visit Preview Jan 21, 2025 0:23am
swap-dev ✅ Ready (Inspect) Visit Preview Jan 21, 2025 0:23am
3 Skipped Deployments
Name Status Preview Updated (UTC)
cosmos ⬜️ Ignored (Inspect) Visit Preview Jan 21, 2025 0:23am
sdk-tools ⬜️ Ignored (Inspect) Visit Preview Jan 21, 2025 0:23am
widget-configurator ⬜️ Ignored (Inspect) Visit Preview Jan 21, 2025 0:23am

@fairlighteth fairlighteth requested review from a team January 16, 2025 17:46
Copy link
Contributor

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

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

Hey @fairlighteth , great, but there are still some issues;

  1. Partially filled TWAP parent order does not show this message in the Fills at column
    st
  2. No status is displayed for a parent TWAP order when it is cancelled+expired:
    image
  3. 'Order filled' is displayed for a 'Signing' state Fixed in Enhance iOS UI, Unify Styling, and Disable Global USD Mode #5309
    signing filled
  4. (nitpick) I've found an order where a percentage looks glued to the Status column Fixed in Enhance iOS UI, Unify Styling, and Disable Global USD Mode #5309
    nitpick
  5. "Order cancelled" is not displayed at "fills at" column for a partially filled limit order
    canelled

Thanks!

…col/cowswap into feat/limit-ui-upgrade-15

# Conflicts:
#	apps/cowswap-frontend/src/common/updaters/orders/SpotPricesUpdater.ts
<>
{getIsFinalizedOrder(order) ? (
order.executionData.partiallyFilled || order.status === OrderStatus.FULFILLED ? (
const renderFillsAt = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It must be a separate component

Copy link
Collaborator

@shoom3301 shoom3301 left a comment

Choose a reason for hiding this comment

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

The whole OrderRow component needs to be decomposed into small pure components.
Please, try to keep component files up to ~200 lines of code.

@anxolin
Copy link
Contributor

anxolin commented Jan 20, 2025

The whole OrderRow component needs to be decomposed into small pure components.
Please, try to keep component files up to ~200 lines of code.

This is the problem of prototype mode is we end up with this situation. If we need, let's take a moment to cleanup now (if it doesn't impact the date) or right after to keep the tech debt in line

@shoom3301
Copy link
Collaborator

The whole OrderRow component needs to be decomposed into small pure components.
Please, try to keep component files up to ~200 lines of code.

This is the problem of prototype mode is we end up with this situation. If we need, let's take a moment to cleanup now (if it doesn't impact the date) or right after to keep the tech debt in line

@anxolin yes, I just realised that.
I've addressed the most of issues here and will refactor OrderRow once we have all PRs merged in order to avoid merge conflicts.

Base automatically changed from feat/limit-ui-upgrade-2 to feat/limit-ui-upgrade January 20, 2025 15:21
…l/cowswap into feat/limit-ui-upgrade-15

# Conflicts:
#	apps/cowswap-frontend/src/common/updaters/orders/SpotPricesUpdater.ts
@fairlighteth
Copy link
Contributor Author

Hey @fairlighteth , great, but there are still some issues;

1. Partially filled TWAP parent order does not show this message in the Fills at column
   ![st](https://private-user-images.githubusercontent.com/70885163/404673998-0a7064d2-002a-41c5-a731-2e0104c5a9d4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzc0NjIyMzgsIm5iZiI6MTczNzQ2MTkzOCwicGF0aCI6Ii83MDg4NTE2My80MDQ2NzM5OTgtMGE3MDY0ZDItMDAyYS00MWM1LWE3MzEtMmUwMTA0YzVhOWQ0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAxMjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMTIxVDEyMTg1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRhZDBlNGYyZGVjNzI2MDQ5NTZkYjJiODY5N2U3YjAyODhhZmNiN2Q0YmQ4ZDJhNWE4OTQ1YTNmNjM5MzBiNzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.FcfSLNOJNxwBlk845E0y5b0ne2T-9HkFmtqW6Av7UFU)

2. No status is displayed for a parent TWAP order when it is cancelled+expired:
   ![image](https://private-user-images.githubusercontent.com/70885163/404674022-f64dc698-8e17-46b5-b59a-35e5a3bbbfaa.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzc0NjIyMzgsIm5iZiI6MTczNzQ2MTkzOCwicGF0aCI6Ii83MDg4NTE2My80MDQ2NzQwMjItZjY0ZGM2OTgtOGUxNy00NmI1LWI1OWEtMzVlNWEzYmJiZmFhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAxMjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMTIxVDEyMTg1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYzOWRmYzkyOTE5YjZlOGQyZjdjNTQ1YjE5ZTExNTMzMjgxZDBjODBkNTc3YmY2YzkxYmJkZjgwYWNhZWZkYmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.kzLM4tw3cGx3wbaxkVytxW58YOIPSoF9joTtJbp7n-o)

3. ~'Order filled' is displayed for a 'Signing' state~ Fixed in [Enhance iOS UI, Unify Styling, and Disable Global USD Mode #5309](https://github.com/cowprotocol/cowswap/pull/5309)
   ![signing filled](https://private-user-images.githubusercontent.com/70885163/404674061-8db529af-0e77-435e-aa66-04c41ddff6b2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzc0NjIyMzgsIm5iZiI6MTczNzQ2MTkzOCwicGF0aCI6Ii83MDg4NTE2My80MDQ2NzQwNjEtOGRiNTI5YWYtMGU3Ny00MzVlLWFhNjYtMDRjNDFkZGZmNmIyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAxMjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMTIxVDEyMTg1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUyMWNjODliNDA5NGEzNDkzYzYwNzg1MzY0ZjljODUwZDNlOTE0NGI2YmYyNWQ1NWYwMGM4MjdmYjYxNTUwZmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.qBhkjUenKJhkmc9_r9IG5kFUBjgEy70yZAUDscOZ59Q)

4. ~(nitpick) I've found an order where a percentage looks glued to the Status column~ Fixed in [Enhance iOS UI, Unify Styling, and Disable Global USD Mode #5309](https://github.com/cowprotocol/cowswap/pull/5309)
   ![nitpick](https://private-user-images.githubusercontent.com/70885163/404674144-e2993b2f-40db-43c9-95c2-26abcbf96d31.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzc0NjIyMzgsIm5iZiI6MTczNzQ2MTkzOCwicGF0aCI6Ii83MDg4NTE2My80MDQ2NzQxNDQtZTI5OTNiMmYtNDBkYi00M2M5LTk1YzItMjZhYmNiZjk2ZDMxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAxMjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMTIxVDEyMTg1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM4MzQzZjAxYTYwZTU4YzJkNzc4ZGVhNjI3YjUyZDJmNmY1OGNiYTgyNjQwNTE3MmFmYTNjOWIwOTQ4NDQzZGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.ZMxWXqdkuwdPktuvNsb9E86kQj9cH1mSqCnoDeMwpFk)

5. "Order cancelled" is not displayed at "fills at" column for a partially filled limit order
   ![canelled](https://private-user-images.githubusercontent.com/70885163/404674234-afac2ca9-757a-4bd5-88f3-493ba96f25ed.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzc0NjIyMzgsIm5iZiI6MTczNzQ2MTkzOCwicGF0aCI6Ii83MDg4NTE2My80MDQ2NzQyMzQtYWZhYzJjYTktNzU3YS00YmQ1LTg4ZjMtNDkzYmE5NmYyNWVkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAxMjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMTIxVDEyMTg1OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMxOTNiZDEyMzg2N2FiODJkNjQzZTg4NmY3MTgwOWUwOTg5ODFiYmEwZWZiYWMxZWQ0YWI1OTM3NzZhNDVhMzQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Kb3PQdrNFlRqPYrW-SXZt0ck3gfe1TwGpH0-_hbgamY)

Thanks!

Addressed comments in #5320

Copy link
Contributor

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

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

Approving as all cases are fixed in #5320 PR

As for this case

Order cancelled" is not displayed at "fills at" column for a partially filled limit order

it looks good to me in the current implementation.

Thanks

@shoom3301 shoom3301 merged commit c276efd into feat/limit-ui-upgrade Jan 23, 2025
12 of 13 checks passed
@shoom3301 shoom3301 deleted the feat/limit-ui-upgrade-15 branch January 23, 2025 07:34
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants