|
309 | 309 | "- D1.2 Token Balances (individual balances, over time)\n", |
310 | 310 | "\n", |
311 | 311 | "**b) Pool Characteristics:** \n", |
312 | | - "- D1.3 Source of Pool Power Growth (Pool Shares (BPT) vs. Fees collected, over time)\n", |
313 | | - "- D1.4 Token Ratio (over time)\n", |
314 | | - "- D1.5 Action Types (per timestep)" |
| 312 | + "- D1.3 Source of Pool Growth (Total Growth vs. Fees collected)\n", |
| 313 | + "- D1.4 Token Ratio\n", |
| 314 | + "- D1.5 Action Types" |
315 | 315 | ] |
316 | 316 | }, |
317 | 317 | { |
|
462 | 462 | "fee_p_df = p_df[['timestep','generated_fees_dai','token_dai_price','generated_fees_weth','token_weth_price']]\n", |
463 | 463 | "fig.add_trace(go.Scatter(x=p_df['timestep'], y=p_df['generated_fees_weth'], line=dict(color='#015B99'), name='fees generated WETH'), row=1, col=1)\n", |
464 | 464 | "fig.add_trace(go.Scatter(x=p_df['timestep'], y=p_df['generated_fees_dai'], line=dict(color='#5CB1EC'), name='fees generated DAI'), row=2, col=1)\n", |
465 | | - "fig.update_layout(height=400, width=1000, title_text=\"<b>Fees Generated</b>\")" |
| 465 | + "fig.update_layout(height=400, width=1000, title_text=\"<b>Fees Generated over time</b>\")" |
| 466 | + ] |
| 467 | + }, |
| 468 | + { |
| 469 | + "cell_type": "code", |
| 470 | + "execution_count": null, |
| 471 | + "metadata": {}, |
| 472 | + "outputs": [], |
| 473 | + "source": [ |
| 474 | + "p_df.info()" |
| 475 | + ] |
| 476 | + }, |
| 477 | + { |
| 478 | + "cell_type": "code", |
| 479 | + "execution_count": null, |
| 480 | + "metadata": {}, |
| 481 | + "outputs": [], |
| 482 | + "source": [ |
| 483 | + "# TODO: use generated_fees instead of price\n", |
| 484 | + "# TODO: loop over tokens in a list\n", |
| 485 | + "\n", |
| 486 | + "#balance growth (total observation period)\n", |
| 487 | + "daib_df = (p_df.iloc[-1][['token_dai_balance']])-(p_df.iloc[0][['token_dai_balance']]).copy()\n", |
| 488 | + "daib_df = daib_df.reset_index()\n", |
| 489 | + "daib_df.columns =['source', 'growth']\n", |
| 490 | + "wethb_df = (p_df.iloc[-1][['token_weth_balance']])-(p_df.iloc[0][['token_weth_balance']]).copy()\n", |
| 491 | + "wethb_df = wethb_df.reset_index()\n", |
| 492 | + "wethb_df.columns =['source', 'growth']\n", |
| 493 | + "\n", |
| 494 | + "#fee growth ACHTUNG add \"generated_fees_k\", is currently an object, this is why I use price atm\n", |
| 495 | + "daif_df = p_df.groupby('action_type').sum()['token_dai_price'].drop(['exit', 'exit_swap', 'external_price_update','pool_creation']).reset_index()\n", |
| 496 | + "daif_df.columns =['source', 'growth'] \n", |
| 497 | + "wethf_df = p_df.groupby('action_type').sum()['token_weth_price'].drop(['exit', 'exit_swap', 'external_price_update','pool_creation']).reset_index()\n", |
| 498 | + "wethf_df.columns =['source', 'growth'] \n", |
| 499 | + "\n", |
| 500 | + "#merge\n", |
| 501 | + "dai_df= pd.concat([daib_df, daif_df], ignore_index=True)\n", |
| 502 | + "dai_df\n", |
| 503 | + "weth_df= pd.concat([wethb_df, wethf_df], ignore_index=True)\n", |
| 504 | + "weth_df\n", |
| 505 | + "\n", |
| 506 | + "#plot chart\n", |
| 507 | + "k = 2 #define number of tokens in your pool\n", |
| 508 | + "fig = make_subplots(rows=1, cols=k, subplot_titles=(\"DAI Growth\", \"WETH Growth\"))\n", |
| 509 | + "fig.add_trace(go.Bar(name=\"DAI Growth\", y=dai_df['growth'], x=dai_df['source'], marker_color=px.colors.sequential.Turbo), row=1, col=1)\n", |
| 510 | + "fig.add_trace(go.Bar(name=\"WETH Growth\", y=weth_df['growth'], x=weth_df['source'], marker_color=px.colors.sequential.Turbo), row=1, col=2)\n", |
| 511 | + "fig.update_layout(height=400, width=1000, title_text=\"<b>Growth & Sources of Growth</b>\", showlegend=False)\n", |
| 512 | + "\n", |
| 513 | + "fig.show()" |
466 | 514 | ] |
467 | 515 | }, |
468 | 516 | { |
|
472 | 520 | "outputs": [], |
473 | 521 | "source": [ |
474 | 522 | "# Compare USD value of fees collected ETH/DAI\n", |
475 | | - "# Compare accumulated fees to token_balance\n", |
476 | 523 | "# Compare % of USD value total fees collected via DAI vs. ETH" |
477 | 524 | ] |
478 | 525 | }, |
479 | 526 | { |
480 | 527 | "cell_type": "markdown", |
481 | 528 | "metadata": {}, |
482 | 529 | "source": [ |
483 | | - "### C1.4 Token Ratio (over time)" |
| 530 | + "### C1.4 Token Ratio" |
484 | 531 | ] |
485 | 532 | }, |
486 | 533 | { |
|
489 | 536 | "metadata": {}, |
490 | 537 | "outputs": [], |
491 | 538 | "source": [ |
492 | | - "# to be added" |
| 539 | + "# TODO: create subplots\n", |
| 540 | + "# TODO: alternatively consider line chart showing changes across particular events\n", |
| 541 | + "\n", |
| 542 | + "events = [0, -1]\n", |
| 543 | + "r_p_df = p_df.iloc[events][['token_dai_balance','token_weth_balance']].transpose(copy=True).reset_index()\n", |
| 544 | + "r_p_df\n", |
| 545 | + "\n", |
| 546 | + "fig1 = px.pie(r_p_df, values=0, names='index', color_discrete_sequence=px.colors.sequential.Turbo)\n", |
| 547 | + "fig2 = px.pie(r_p_df, values=25601, names='index', color_discrete_sequence=px.colors.sequential.Turbo)\n", |
| 548 | + "fig1.update_layout(height=300, width=1000, title_text=\"<b>Token Ratio</b>\")\n", |
| 549 | + "fig2.update_layout(height=300, width=1000, title_text=\"<b>Token Ratio</b>\")\n", |
| 550 | + "\n", |
| 551 | + "fig1.show()\n", |
| 552 | + "fig2.show()" |
493 | 553 | ] |
494 | 554 | }, |
495 | 555 | { |
|
0 commit comments