Skip to content

Commit

Permalink
Merge pull request #35 from Snedashkovsky/recalculate
Browse files Browse the repository at this point in the history
Add new assets
  • Loading branch information
Snedashkovsky authored Dec 3, 2023
2 parents a4380dc + 2081984 commit f0a0cb3
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 85 deletions.
8 changes: 7 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@
{
'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2': 'uatom in osmosis',
'ibc/FE2CD1E6828EC0FAB8AF39BAC45BC25B965BA67CCBC50C13A14BD610B0D1E2C4': 'boot in osmosis',
'ibc/4F3B0EC2FE2D370D10C3671A1B7B06D2A964C721470C305CBB846ED60E6CAA20': 'hydrogen in osmosis',
'ibc/BCDB35B7390806F35E716D275E1E017999F8281A81B6F128F087EF34D1DFA761': 'tocyb in osmosis',
'ibc/46B44899322F3CD854D2D46DEEF881958467CDD4B3B10086DA49296BBED94BED': 'ujuno in osmosis',
'ibc/EA4C0A9F72E2CEDF10D0E7A9A6A22954DB3444910DB5BE980DF59B05A46DAD1C': 'udsm in osmosis',
'ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5': 'weth in osmosis',
'ibc/65381C5F3FD21442283D56925E62EA524DED8B6927F0FF94E21E0020954C40B5': 'weth.grv in osmosis',
'ibc/3FF92D26B407FD61AE95D975712A7C319CDE28DE4D80BDC9978D935932B991D7': 'dot in osmosis',
'ibc/75345531D87BD90BF108BE7240BD721CB2CB0A1F16D4EBA71B09EC3C43E15C8F': 'btc in osmosis',
'ibc/1E43D59E565D41FB4E54CA639B838FFD5BCFC20003D330A56CB1396231AA1CBA': 'sol in osmosis',
'ibc/D79E7D83AB399BFFF93433E54FAA480C191248FC556924A2A8351AE2638B3877': 'utia in osmosis',
'ibc/E610B83FD5544E00A8A1967A2EB3BEF25F1A8CFE8650FE247A8BD4ECA9DC9222': 'reth in osmosis',

'ibc/15E9C5CF5969080539DB395FA7D9C0868265217EFC528433671AAF9B1912D159': 'uatom in bostrom',
'ibc/BA313C4A19DFBF943586C0387E6B11286F9E416B4DD27574E6909CABE0E342FA': 'deprecated uatom in bostrom',
Expand Down Expand Up @@ -69,7 +75,7 @@

OSMOSIS_NODE_RPC_URL = 'https://rpc.osmosis-1.bronbro.io:443'
OSMOSIS_NODE_LCD_URL = 'https://lcd.osmosis-1.bronbro.io'
OSMOSIS_POOLS_API_URL = f'{OSMOSIS_NODE_LCD_URL}/osmosis/gamm/v1beta1/pools?pagination.limit=1000'
OSMOSIS_POOLS_API_URL = f'{OSMOSIS_NODE_LCD_URL}/osmosis/gamm/v1beta1/pools?pagination.limit=10000'
OSMOSIS_CHAIN_ID = 'osmosis-1'
OSMOSIS_LCD_CLIENT = LCDClient(chain_id=OSMOSIS_CHAIN_ID, url=OSMOSIS_NODE_LCD_URL, prefix='osmo')
OSMOSIS_BASH_PRECOMMAND = dotenv_values(".env")['BASH_PRECOMMAND']
Expand Down
62 changes: 33 additions & 29 deletions pools_liquidity_in_gh.ipynb

Large diffs are not rendered by default.

98 changes: 49 additions & 49 deletions revenue_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-21T04:37:57.370501Z",
"start_time": "2023-11-21T04:37:56.859591Z"
"end_time": "2023-11-29T03:07:09.076543Z",
"start_time": "2023-11-29T03:07:07.887014Z"
}
}
},
Expand Down Expand Up @@ -87,8 +87,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-21T04:37:57.378625Z",
"start_time": "2023-11-21T04:37:57.371411Z"
"end_time": "2023-11-29T03:07:09.084176Z",
"start_time": "2023-11-29T03:07:09.081183Z"
}
}
},
Expand Down Expand Up @@ -130,8 +130,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-21T04:37:57.382819Z",
"start_time": "2023-11-21T04:37:57.379521Z"
"end_time": "2023-11-29T03:07:09.092290Z",
"start_time": "2023-11-29T03:07:09.084405Z"
}
}
},
Expand Down Expand Up @@ -175,8 +175,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-21T04:37:57.386477Z",
"start_time": "2023-11-21T04:37:57.383957Z"
"end_time": "2023-11-29T03:07:09.092595Z",
"start_time": "2023-11-29T03:07:09.087333Z"
}
}
},
Expand Down Expand Up @@ -209,8 +209,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-21T04:37:57.390308Z",
"start_time": "2023-11-21T04:37:57.388214Z"
"end_time": "2023-11-29T03:07:09.099989Z",
"start_time": "2023-11-29T03:07:09.092211Z"
}
}
},
Expand Down Expand Up @@ -315,8 +315,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-21T04:37:57.406355Z",
"start_time": "2023-11-21T04:37:57.395630Z"
"end_time": "2023-11-29T03:07:09.104594Z",
"start_time": "2023-11-29T03:07:09.099508Z"
}
}
},
Expand All @@ -336,12 +336,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
"BOOT Supply 1,172,855,573,947,433\n",
"BOOT Staked 274,987,648,414,027\n",
"BOOT Supply 1,173,990,334,362,472\n",
"BOOT Staked 243,298,244,916,187\n",
"BOOT Inflation 5.46%\n",
"BOOT Inflation Community Tax 10.00%\n",
"BOOT Staking Revenue without restake 19.91%\n",
"BOOT Staking Revenue with restake 22.02%\n"
"BOOT Staking Revenue without restake 22.53%\n",
"BOOT Staking Revenue with restake 25.26%\n"
]
},
{
Expand All @@ -356,7 +356,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Degen revenue actual 28.2%\n",
"Degen revenue actual 31.9%\n",
"Degen revenue optimal 35.0%\n"
]
},
Expand All @@ -372,7 +372,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Staking + Investminting revenue actual 30.7%\n",
"Staking + Investminting revenue actual 34.8%\n",
"Staking + Investminting revenue optimal 40.0%\n"
]
},
Expand All @@ -388,7 +388,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Investminting revenue actual 38.0%\n",
"Investminting revenue actual 44.0%\n",
"Investminting revenue optimal 40.0%\n"
]
},
Expand All @@ -404,16 +404,16 @@
"name": "stdout",
"output_type": "stream",
"text": [
"AMPERE price actual 3,200,358 H optimal 3,287,671, AMPERE can decrease by 0.97 times\n",
"VOLT price actual 30,411,144 H optimal 32,876,712, VOLT can decrease by 0.93 times\n",
"H price actual 0.229 BOOT optimal 0.5, H can increase by 2.18 times\n",
"AMPERE price actual 3,663,001 H optimal 3,287,671, AMPERE can decrease by 1.11 times\n",
"VOLT price actual 35,660,144 H optimal 32,876,712, VOLT can decrease by 1.08 times\n",
"H price actual 0.217 BOOT optimal 0.5, H can increase by 2.30 times\n",
"\n",
"OSMO price\n",
"\t- in bostrom 130,572,970 H\n",
"\t- in osmosis 130,101,537 H\n",
"\t- in bostrom 125,542,228 H\n",
"\t- in osmosis 126,553,501 H\n",
"ATOM price\n",
"\t- in bostrom 1,837,938,341 H\n",
"\t- in osmosis 1,805,576,959 H\n"
"\t- in bostrom 1,805,192,073 H\n",
"\t- in osmosis 1,794,453,246 H\n"
]
}
],
Expand All @@ -423,8 +423,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-21T04:38:25.932914Z",
"start_time": "2023-11-21T04:37:57.402855Z"
"end_time": "2023-11-29T03:07:24.638322Z",
"start_time": "2023-11-29T03:07:09.106290Z"
}
}
},
Expand All @@ -444,12 +444,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
"PUSSY Supply 1,028,778,569,656,454,305\n",
"PUSSY Staked 25,668,458,175,641,378\n",
"PUSSY Supply 1,029,358,595,644,607,956\n",
"PUSSY Staked 22,126,500,490,670,938\n",
"PUSSY Inflation 3.00%\n",
"PUSSY Inflation Community Tax 20.00%\n",
"PUSSY Staking Revenue without restake 91.38%\n",
"PUSSY Staking Revenue with restake 149.10%\n"
"PUSSY Staking Revenue without restake 106.07%\n",
"PUSSY Staking Revenue with restake 188.39%\n"
]
},
{
Expand All @@ -464,7 +464,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Degen revenue actual 216.3%\n",
"Degen revenue actual 269.2%\n",
"Degen revenue optimal 35.0%\n"
]
},
Expand All @@ -480,7 +480,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Staking + Investminting revenue actual 173.5%\n",
"Staking + Investminting revenue actual 211.9%\n",
"Staking + Investminting revenue optimal 40.0%\n"
]
},
Expand All @@ -496,7 +496,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Investminting revenue actual 72.4%\n",
"Investminting revenue actual 72.6%\n",
"Investminting revenue optimal 40.0%\n"
]
},
Expand All @@ -512,9 +512,9 @@
"name": "stdout",
"output_type": "stream",
"text": [
"AMPERE price actual 6,630,516 LP optimal 3,287,671, AMPERE can decrease by 2.02 times\n",
"VOLT price actual 52,761,993 LP optimal 32,876,712, VOLT can decrease by 1.60 times\n",
"LP price actual 0.337 PUSSY optimal 0.5, LP can increase by 1.48 times\n"
"AMPERE price actual 6,638,966 LP optimal 3,287,671, AMPERE can decrease by 2.02 times\n",
"VOLT price actual 52,910,167 LP optimal 32,876,712, VOLT can decrease by 1.61 times\n",
"LP price actual 0.324 PUSSY optimal 0.5, LP can increase by 1.54 times\n"
]
}
],
Expand All @@ -529,8 +529,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-21T04:38:37.576988Z",
"start_time": "2023-11-21T04:38:25.933813Z"
"end_time": "2023-11-29T03:07:33.253971Z",
"start_time": "2023-11-29T03:07:24.639449Z"
}
}
},
Expand All @@ -550,12 +550,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
"UATOM Supply 375,776,819,559,510\n",
"UATOM Staked 245,773,435,530,138\n",
"UATOM Inflation 14.31%\n",
"UATOM Supply 377,003,298,365,633\n",
"UATOM Staked 241,986,544,842,812\n",
"UATOM Inflation 10.00%\n",
"UATOM Inflation Community Tax 10.00%\n",
"UATOM Staking Revenue without restake 18.71%\n",
"UATOM Staking Revenue with restake 20.57%\n"
"UATOM Staking Revenue without restake 13.32%\n",
"UATOM Staking Revenue with restake 14.25%\n"
]
}
],
Expand All @@ -570,8 +570,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-21T04:38:52.619309Z",
"start_time": "2023-11-21T04:38:37.577929Z"
"end_time": "2023-11-29T03:07:38.716233Z",
"start_time": "2023-11-29T03:07:33.253219Z"
}
}
},
Expand All @@ -583,8 +583,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-11-21T04:38:52.622507Z",
"start_time": "2023-11-21T04:38:52.619215Z"
"end_time": "2023-11-29T03:07:38.716411Z",
"start_time": "2023-11-29T03:07:38.648310Z"
}
}
}
Expand Down
28 changes: 28 additions & 0 deletions src/data_extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,31 @@ def get_price_enriched(price_df: pd.DataFrame, base_coin_denom: str = 'hydrogen'
if display_data:
display(HTML(_price_enriched_df.to_html(notebook=True, show_dimensions=False)))
return _price_enriched_df


def get_pools_and_prices(networks: Optional[list[str]],
pools_isin: Optional[dict[str, list]],
pools_notisin: Optional[dict[str, list]]) -> [pd.DataFrame, pd.DataFrame, pd.DataFrame]:
"""
Get pool, direct price, and enriched price data
:param networks: a list of `bostrom`, `space-pussy` or `osmosis` networks, all of them are extracted by default
:param pools_isin: dictionary with pools which must be in result
:param pools_notisin: dictionary with pools which must not be in result
:return: pool, direct price, and enriched price dataframes
"""
_pools_df = get_pools(networks=networks)
if pools_isin:
_pools_df = _pools_df[
_pools_df.apply(
lambda row: True if row['network'] in pools_isin.keys() and row.id in pools_isin[
row['network']] else False,
axis=1)]
if pools_notisin:
_pools_df = _pools_df[
_pools_df.apply(
lambda row: True if row['network'] in pools_notisin.keys() and row.id not in pools_notisin[
row['network']] else False,
axis=1)]
_price_df = get_prices(pools_df=_pools_df)
_price_enriched_df = get_price_enriched(price_df=_price_df)
return _pools_df, _price_df, _price_enriched_df
6 changes: 1 addition & 5 deletions src/denom_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,4 @@ def reverse_rename_denom(denom: str, denom_names_dict: dict = IBC_COIN_NAMES) ->
:return: network name
"""
denom_names_reverse_dict = {v: k for k, v in denom_names_dict.items()}
if denom in denom_names_reverse_dict.keys():
return denom_names_reverse_dict[denom]
if denom[-7:] == '(pussy)':
return denom[:-7]
return denom
return denom_names_reverse_dict.get(denom, denom.removesuffix('(pussy)'))
Loading

0 comments on commit f0a0cb3

Please sign in to comment.