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

Add spot price after swap to schema #25

Merged
merged 3 commits into from
Sep 9, 2024
Merged

Conversation

GarrettPetersen
Copy link
Collaborator

Proposal to add spot price after swap to the DEX swap schema. I want this so I can tell which liquidity is in range at any given time.

I don't know if this is feasible for all DEX types. Maybe we should have a separate table for v3 swaps that includes the tick after the swap (which I believe is standard in Uniswap v3 DEXs).

@GarrettPetersen
Copy link
Collaborator Author

Maybe make it optional for all but v3s?

@@ -246,6 +246,10 @@
"description": "The amount of the output token, decimal normalized.",
"type": "number"
},
"spot_price_after_swap": {
"description": "The spot price in the pool after the swap is complete.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be in USD? Or is there another denomination across all dexs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep it not optional, if a protocol doesn't have this available, they can mark it null or 0

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's a ratio between the two tokens. v3 DEXs show the tick after the swap, which tells us the price ratio.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add something about this to the description?

@@ -246,6 +246,10 @@
"description": "The amount of the output token, decimal normalized.",
"type": "number"
},
"spot_price_after_swap": {
"description": "The spot price in the pool after the swap is complete.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep it not optional, if a protocol doesn't have this available, they can mark it null or 0

schemas/dex/schema.json Show resolved Hide resolved
Copy link
Contributor

@melotik melotik left a comment

Choose a reason for hiding this comment

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

Lgtm, thanks! I think we should just add a little more color to the description

@GarrettPetersen GarrettPetersen merged commit 2b9aa0f into main Sep 9, 2024
1 check passed
@GarrettPetersen GarrettPetersen deleted the add-price-after-swap branch September 9, 2024 23:37
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