forked from RoboVault/web3-backtest
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Simulate the Balancer Y2K pool (80% Y2K | 20% WETH):
- add Balancer datasource
subgraph:
https://thegraph.com/hosted-service/subgraph/balancer-labs/balancer-arbitrum-v2
Y2K-WETH pair: 0x569061e2d807881f4a33e1cbe1063bc614cb75a4
https://arbiscan.io/address/0x569061e2d807881f4a33e1cbe1063bc614cb75a4
poolId (for subgraph queries): 0x569061e2d807881f4a33e1cbe1063bc614cb75a40002000000000000000002bb
- Query all swaps for a given time period (start small - past couple of days)
- Create back-test that will reconstruct the Y2K price for the time period:
- starting price (query
tokenPricesfor filtering for approx timestamp) - starting liquidity (query
poolSnapshots) - for each swap, use the spotPrice formula from here: https://docs.balancer.fi/reference/math/weighted-math.html#invariant to update price (can ignore fees for now)
- output a single graph of price
- bonus plot against actual price (again using
tokenPrices)
reference queries:
{
pool(id: "0x569061e2d807881f4a33e1cbe1063bc614cb75a40002000000000000000002bb") {
address
}
swaps(first: 5, where:{poolId:"0x569061e2d807881f4a33e1cbe1063bc614cb75a40002000000000000000002bb"}) {
id
tokenIn
tokenIn
tokenAmountIn
tokenAmountOut
timestamp
poolId {
id
}
}
tokenPrices(first: 10, where:{poolId: "0x569061e2d807881f4a33e1cbe1063bc614cb75a40002000000000000000002bb"}){
price
asset
timestamp
}
poolSnapshots(first: 10, where:{pool: "0x569061e2d807881f4a33e1cbe1063bc614cb75a40002000000000000000002bb"}){
amounts
timestamp
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels