From 886e4eb88c42e92cbbda4132cafe4192f70dc339 Mon Sep 17 00:00:00 2001
From: "Carlos R. Mercado" <107061601+charlieflipside@users.noreply.github.com>
Date: Wed, 30 Nov 2022 18:11:27 -0500
Subject: [PATCH] Revert "Markdown Compliant Table"
This reverts commit 6ec83311c4b8466556fe6fd5b16b75f34332ac61.
---
eth_usdc_retroactive.Rmd | 6 +--
eth_usdc_retroactive.md | 85 ++++++++++++++++++----------------------
2 files changed, 42 insertions(+), 49 deletions(-)
diff --git a/eth_usdc_retroactive.Rmd b/eth_usdc_retroactive.Rmd
index c44249c..d0fca86 100644
--- a/eth_usdc_retroactive.Rmd
+++ b/eth_usdc_retroactive.Rmd
@@ -123,7 +123,6 @@ saveRDS(unique(all_eth_prices), "eth_prices.rds")
```{r, message = FALSE, warning = FALSE}
library(gmp) # large numbers
library(reactable) # clean tables
-library(pixiedust) # markdown compliant tables
library(plotly) # graphs
library(dplyr) # data manipulation
options(scipen = 10)
@@ -272,8 +271,9 @@ bobs_allocation <- price_all_tokens(x = bob_balance[['usdc']],
pa = 1000,
yx = FALSE) # These prices are in X per Y, function can handle it.
-dust(as.data.frame(bobs_allocation) %>% round(., 2)) %>%
-sprinkle_print_method(print_method = 'markdown')
+reactable(
+ as.data.frame(bobs_allocation) %>% round(., 2)
+)
```
To get all 100000 of his USDC (x, i.e., Token 0) and 100 ETH (y, i.e., Token 1) at the current price
diff --git a/eth_usdc_retroactive.md b/eth_usdc_retroactive.md
index 561519d..9a650e6 100644
--- a/eth_usdc_retroactive.md
+++ b/eth_usdc_retroactive.md
@@ -123,7 +123,6 @@ saveRDS(unique(all_eth_prices), "eth_prices.rds")
```r
library(gmp) # large numbers
library(reactable) # clean tables
-library(pixiedust) # markdown compliant tables
library(plotly) # graphs
library(dplyr) # data manipulation
options(scipen = 10)
@@ -274,21 +273,15 @@ bobs_allocation <- price_all_tokens(x = bob_balance[['usdc']],
pa = 1000,
yx = FALSE) # These prices are in X per Y, function can handle it.
-dust(as.data.frame(bobs_allocation) %>% round(., 2)) %>%
-sprinkle_print_method(print_method = 'markdown')
+reactable(
+ as.data.frame(bobs_allocation) %>% round(., 2)
+)
```
-
-
-| amount_x| amount_y| current_price| min_price| max_price|
-|--------:|--------:|-------------:|---------:|---------:|
-| 100000| 100| 1200| 1000| 1496.59|
-
-
-
-
-
-
+```{=html}
+
+
+```
To get all 100000 of his USDC (x, i.e., Token 0) and 100 ETH (y, i.e., Token 1) at the current price
1200 and minimum price 1000 requires he set his max price to roughly 1496.59 USDC per ETH.
@@ -313,8 +306,8 @@ reactable(
```
```{=html}
-
-
+
+
```
For a variety of reasons, Uniswap makes optimizations that can look unintuitive. Here, this
@@ -344,8 +337,8 @@ reactable(
```
```{=html}
-
-
+
+
```
As long as the number of ETH sold to the pool is less than this amount, bob's liquidity
@@ -377,8 +370,8 @@ reactable(
```
```{=html}
-
-
+
+
```
Is Bob better or worse off for having done this trade?
@@ -406,8 +399,8 @@ reactable(
```
```{=html}
-
-
+
+
```
```r
@@ -423,8 +416,8 @@ reactable(
```
```{=html}
-
-
+
+
```
Whether Bob is better or worse off technically depends on perspective. In ETH terms he is up
@@ -456,8 +449,8 @@ reactable(
```
```{=html}
-
-
+
+
```
It is important to not overfocus on this small example as indicative of a liquidity provider's experience on Uniswap v3. In the real world, Bob's liquidity would be part of one of the largest pools in Uniswap; 5 ETH would have minimal price impact; and he would only have his balance of tokens change (and fees accumulated) proportional to the liquidity he provides. In addition, numerous trades in both directions would acumulate fees while negating price movements that increase divergent loss.
@@ -494,8 +487,8 @@ reactable(
```
```{=html}
-
-
+
+
```
At a given BLOCK_NUMBER and BLOCK_TIMESTAMP, there was a specific TX_HASH. In this transaction,
@@ -723,8 +716,8 @@ reactable(
```
```{=html}
-
-
+
+
```
The 3 rows of fees with a matching transaction in liquidity pool actions all have this
@@ -739,8 +732,8 @@ reactable(fee_tx_adjust)
```
```{=html}
-
-
+
+
```
```r
@@ -748,8 +741,8 @@ reactable(withdraws_of_interest)
```
```{=html}
-
-
+
+
```
Adjusting for this would make the fee table look like this instead:
@@ -807,8 +800,8 @@ reactable(f96877)
```
```{=html}
-
-
+
+
```
## Accounting Table
@@ -867,8 +860,8 @@ reactable(
```
```{=html}
-
-
+
+
```
What should be clear is this position had a large net change from ETH to USDC.
@@ -901,8 +894,8 @@ reactable(pnl_96877)
```
```{=html}
-
-
+
+
```
```r
@@ -945,8 +938,8 @@ hodl_reference(a96877)
```
```{=html}
-
-
+
+
```
## Resulting Value (Strategy Reference Value)
@@ -975,8 +968,8 @@ reactable(
```
```{=html}
-
-
+
+
```
For this position, while the PnL was positive in USD terms, ETH's price growth over the time period
@@ -997,8 +990,8 @@ strategy_reference(a96877) - hodl_reference(a96877)
```
```{=html}
-
-
+
+
```
# Parallelize for all Positions