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

Ekubo ETH/wstETH investment analysis #2

Closed
wants to merge 3 commits into from
Closed

Ekubo ETH/wstETH investment analysis #2

wants to merge 3 commits into from

Conversation

ManvithaMolakala
Copy link
Contributor

@ManvithaMolakala ManvithaMolakala commented Aug 31, 2024

Resolves #1

@akiraonstarknet
Copy link
Contributor

akiraonstarknet commented Sep 1, 2024

@ManvithaMolakala please use proper PR titles

@akiraonstarknet akiraonstarknet changed the title Main Ekubo ETH/wstETH investment analysis Sep 1, 2024
@@ -0,0 +1,1405 @@
{
Copy link
Contributor

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",
Copy link
Contributor

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",
Copy link
Contributor

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",
Copy link
Contributor

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",
Copy link
Contributor

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",
Copy link
Contributor

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",
Copy link
Contributor

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.

Copy link
Contributor

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.

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.

Analyse Ekubo ETH/wstETH pool and suggest optimum LP range strategy
2 participants