-
Notifications
You must be signed in to change notification settings - Fork 1
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
Ekubo ETH/wstETH investment analysis #2
Conversation
@ManvithaMolakala please use proper PR titles |
@@ -0,0 +1,1405 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect file name. Its wstETH, not wETH
" event_data = events_response_positions_updated.events[event_no].data\n", | ||
" \n", | ||
" # Check for the first condition\n", | ||
" if (hex(event_data[2]) == \"0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7\" and \\\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not hardcode address values. Please initiate constants in an appropriate cell above, and use them here.
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def bool_to_sign(x):\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functions like this are generic and since are meant to be utility, they are to be added in utils file.
" 'block_number': combined_events_response_swap[event_no_swap].block_number,\n", | ||
" 'transaction_hash': combined_events_response_swap[event_no_swap].transaction_hash,\n", | ||
" 'price': 1.000001**(-combined_events_response_swap[event_no_swap].data[18] * bool_to_sign(combined_events_response_swap[event_no].data[19])),\n", | ||
" 'tick_id': -combined_events_response_swap[event_no_swap].data[18] * bool_to_sign(combined_events_response_swap[event_no].data[19]),\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is there a negative sign?
"# Step 2: Convert the collected data into a pandas DataFrame\n", | ||
"df = pd.DataFrame(block_price_data)\n", | ||
"\n", | ||
"# Step 3: Group by block number and calculate the median price for each block\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could have just done on ticks directly (i.e. median tick value, instead of price) bcz finally for storing liquidity, u need tick range.
" \n", | ||
" # Distribute liquidity to the relevant ticks in the cumulative state\n", | ||
" for tick in tick_array:\n", | ||
" if tick_lower <= tick <= tick_upper:\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it has to be tick < tick_upper (as per uniswap v3 math, ekubo could be different. u need to check(
"# Align both dataframes by the same date index (merge them on the 'Date' column)\n", | ||
"data = pd.DataFrame({\n", | ||
" 'ETH Price': eth_data['Close'],\n", | ||
" 'wETH Price': weth_data['Close']\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are unfinished. Before finishing tests, writing strategy doesnt make sense as u will never know if u r doing right or wrong math.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above strategy code will be reviewed after finishing tests. Look at pytest and configure tests for the project.
Resolves #1