From b5854d3c6a7fb0e3c87591da3c3b0fec9523118e Mon Sep 17 00:00:00 2001 From: borcherd Date: Fri, 27 Sep 2024 00:41:48 +0700 Subject: [PATCH] feat: risk page **WIP** --- .vscode/settings.json | 2 +- csv/BLZE-buy-model-oputput.csv | 2 + csv/BLZE-sell-model-output.csv | 2 + csv/Bonk-buy-model-output.csv | 2 + csv/Bonk-sell-model-output.csv | 2 + csv/Dust-buy-model-output.csv | 2 + csv/Dust-sell-model-output.csv | 2 + csv/GUAC-buy-model-output.csv | 1 + csv/GUAC-sell-model-output.csv | 1 + csv/HNT-buy-model-output.csv | 2 + csv/HNT-sell-model-output.csv | 2 + csv/JLP-buy-model-output.csv | 2 + csv/JLP-sell-model-output.csv | 2 + csv/JTO-buy-model-output.csv | 2 + csv/JTO-sell-model-output.csv | 2 + csv/JitoSOL-buy-model-output.csv | 2 + csv/JitoSOL-sell-model-output.csv | 2 + csv/KIN-buy-model-output.csv | 1 + csv/KIN-sell-model-output.csv | 2 + csv/LST-buy-model-output.csv | 2 + csv/LST-sell-model-output.csv | 2 + csv/MNDE-buy-model-output.csv | 2 + csv/OPOS-buy-model-output.csv | 2 + csv/OPOS-sell-model-output.csv | 2 + csv/ORCA-buy-model-output.csv | 1 + csv/ORCA-sell-model-output.csv | 1 + csv/PYTH-buy-model-output.csv | 2 + csv/PYTH-sell-model-output.csv | 2 + csv/RLB-buy-model-output.csv | 1 + csv/SAMO-buy-model-output.csv | 1 + csv/SAMO-sell-model-output.csv | 1 + csv/SHDW-sell-model-output.csv | 2 + csv/SOL-buy-model-output.csv | 2 + csv/SOL-sell-model-output.csv | 2 + csv/USDT-buy-model-output.csv | 2 + csv/USDT-sell-model-output.csv | 2 + csv/UXD-buy-model-output.csv | 2 + csv/UXD-sell-model-output.csv | 2 + csv/WBTC-buy-model-output.csv | 2 + csv/WBTC-sell-model-output.csv | 2 + csv/WETH-buy-model-output.csv | 2 + csv/WETH-sell-model-output.csv | 2 + csv/WIF-sell-model-output.csv | 2 + csv/bSOL-buy-model-output.csv | 2 + csv/bSOL-sell-model-output.csv | 2 + next.config.mjs | 9 + package.json | 1 + pnpm-lock.yaml | 20 ++ src/app/api/getCsvData/route.ts | 39 ++++ src/app/risk-model/page.tsx | 6 +- .../components/filter-component.tsx | 50 ++++ .../common/risk-model/components/index.ts | 3 + .../components/search-component.tsx | 20 ++ .../risk-model/components/table-component.tsx | 75 ++++++ .../common/risk-model/risk-model.tsx | 218 ++++++++++++++++++ .../summary/components/pool-summary.tsx | 9 +- src/components/common/summary/summary.tsx | 4 +- src/components/ui/input.tsx | 25 ++ src/components/ui/table.tsx | 120 ++++++++++ src/types/index.tsx | 2 + 60 files changed, 674 insertions(+), 9 deletions(-) create mode 100644 csv/BLZE-buy-model-oputput.csv create mode 100644 csv/BLZE-sell-model-output.csv create mode 100644 csv/Bonk-buy-model-output.csv create mode 100644 csv/Bonk-sell-model-output.csv create mode 100644 csv/Dust-buy-model-output.csv create mode 100644 csv/Dust-sell-model-output.csv create mode 100644 csv/GUAC-buy-model-output.csv create mode 100644 csv/GUAC-sell-model-output.csv create mode 100644 csv/HNT-buy-model-output.csv create mode 100644 csv/HNT-sell-model-output.csv create mode 100644 csv/JLP-buy-model-output.csv create mode 100644 csv/JLP-sell-model-output.csv create mode 100644 csv/JTO-buy-model-output.csv create mode 100644 csv/JTO-sell-model-output.csv create mode 100644 csv/JitoSOL-buy-model-output.csv create mode 100644 csv/JitoSOL-sell-model-output.csv create mode 100644 csv/KIN-buy-model-output.csv create mode 100644 csv/KIN-sell-model-output.csv create mode 100644 csv/LST-buy-model-output.csv create mode 100644 csv/LST-sell-model-output.csv create mode 100644 csv/MNDE-buy-model-output.csv create mode 100644 csv/OPOS-buy-model-output.csv create mode 100644 csv/OPOS-sell-model-output.csv create mode 100644 csv/ORCA-buy-model-output.csv create mode 100644 csv/ORCA-sell-model-output.csv create mode 100644 csv/PYTH-buy-model-output.csv create mode 100644 csv/PYTH-sell-model-output.csv create mode 100644 csv/RLB-buy-model-output.csv create mode 100644 csv/SAMO-buy-model-output.csv create mode 100644 csv/SAMO-sell-model-output.csv create mode 100644 csv/SHDW-sell-model-output.csv create mode 100644 csv/SOL-buy-model-output.csv create mode 100644 csv/SOL-sell-model-output.csv create mode 100644 csv/USDT-buy-model-output.csv create mode 100644 csv/USDT-sell-model-output.csv create mode 100644 csv/UXD-buy-model-output.csv create mode 100644 csv/UXD-sell-model-output.csv create mode 100644 csv/WBTC-buy-model-output.csv create mode 100644 csv/WBTC-sell-model-output.csv create mode 100644 csv/WETH-buy-model-output.csv create mode 100644 csv/WETH-sell-model-output.csv create mode 100644 csv/WIF-sell-model-output.csv create mode 100644 csv/bSOL-buy-model-output.csv create mode 100644 csv/bSOL-sell-model-output.csv create mode 100644 src/app/api/getCsvData/route.ts create mode 100644 src/components/common/risk-model/components/filter-component.tsx create mode 100644 src/components/common/risk-model/components/index.ts create mode 100644 src/components/common/risk-model/components/search-component.tsx create mode 100644 src/components/common/risk-model/components/table-component.tsx create mode 100644 src/components/common/risk-model/risk-model.tsx create mode 100644 src/components/ui/input.tsx create mode 100644 src/components/ui/table.tsx diff --git a/.vscode/settings.json b/.vscode/settings.json index 246e9c6..58aaa72 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" } } diff --git a/csv/BLZE-buy-model-oputput.csv b/csv/BLZE-buy-model-oputput.csv new file mode 100644 index 0000000..a3d32dd --- /dev/null +++ b/csv/BLZE-buy-model-oputput.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +BLZE,buy,2.5,5985575.287769635,5985575.287769635,24,19487419.17776644,1.75,1.75,-336.58206171801726,128829907.52437764,0.0,35.861102849757685,31.568073055450636,41.01651222413176,-1.0707306674416595,295 days 16:00:00,51.9423774527622,38.294183732554814,44.992587249511026,-2.366260284751642,140 days 14:50:00,production,,73807292.0,5985575.287769635,100.0,377.76726277803476,0.0 diff --git a/csv/BLZE-sell-model-output.csv b/csv/BLZE-sell-model-output.csv new file mode 100644 index 0000000..baa3883 --- /dev/null +++ b/csv/BLZE-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +BLZE,sell,2.5,10026658.383206028,10026658.383206028,24,12518712955.649525,0.0,1,-43.98989203305356,10798719690.068449,0.0,37.12835165370529,32.547998340229576,42.77656116784873,-1.233447787610816,295 days 06:00:00,51.171584415030836,36.24779345137351,43.34725777080147,-2.393617414262579,140 days 05:05:00,production,,2000000000.0,10026658.383206028,100.0,-86.26062222470829,0.0 diff --git a/csv/Bonk-buy-model-output.csv b/csv/Bonk-buy-model-output.csv new file mode 100644 index 0000000..6fffda3 --- /dev/null +++ b/csv/Bonk-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +Bonk,buy,2.5,6.619808708365724e+17,6.619808708365724e+17,24,14645483579.497177,1.2,1.2,-47.568751937627646,781519480386.8502,3112486378.2907667,48.72384264132631,51.610871110161725,37.29633201760317,-5.706533188488269,616 days 22:00:00,840836304.1604849,646101878.9749229,199.99978316268462,-1205163613229313.5,225 days 19:05:00,production,,26405707857.0,2929044789.472689,99.7786190690991,4446.874219759075,105163605.10086761 diff --git a/csv/Bonk-sell-model-output.csv b/csv/Bonk-sell-model-output.csv new file mode 100644 index 0000000..a8f487e --- /dev/null +++ b/csv/Bonk-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +Bonk,sell,2.5,1533936035.1862316,1533936035.1862316,24,367727196621.3892,0.65,0.65,22.206567690623242,136976021953.03764,736289296889.3911,48.70567867598601,51.495752080573865,37.24283288153423,-5.739828078951672,616 days 13:00:00,566.6620908099745,329.58514770296637,186.8499459926784,-893.0676676304042,225 days 10:05:00,production,,1000000000000.0,1533936035.1862316,0.0,-57.306705460564864,5375315229564.986 diff --git a/csv/Dust-buy-model-output.csv b/csv/Dust-buy-model-output.csv new file mode 100644 index 0000000..7ec24df --- /dev/null +++ b/csv/Dust-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +DUST,buy,2.5,2072.112015585274,2072.112015585274,24,801.5245345967504,1.2,1.2,-469.8484552916459,1346.183261679869,0.0,137.12166500903328,166.39266882670626,174.30655304163062,-34.77152738640052,834 days 10:00:00,19.806264815898665,50.05982956475803,24.489856645179835,-0.4188535746530855,139 days 19:10:00,production,,5200.0,2072.112015585274,100.0,139.96070442155775,0.0 diff --git a/csv/Dust-sell-model-output.csv b/csv/Dust-sell-model-output.csv new file mode 100644 index 0000000..40b2853 --- /dev/null +++ b/csv/Dust-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +DUST,sell,2.5,9095.013045919473,9095.013045919473,24,88.43318845252124,0.65,0.65,6.444054209954943,37.85515946569598,18115.300477369696,140.26193323929493,170.08528871296238,175.38990215453356,-36.53909069888815,834 days 02:00:00,40.844310054290865,37.01955066329505,48.54847194965044,-6.783751165864083,139 days 11:05:00,production,,50000.0,9095.013045919473,99.58504502261505,-65.85616541641399,23927122.132170156 diff --git a/csv/GUAC-buy-model-output.csv b/csv/GUAC-buy-model-output.csv new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/csv/GUAC-buy-model-output.csv @@ -0,0 +1 @@ + diff --git a/csv/GUAC-sell-model-output.csv b/csv/GUAC-sell-model-output.csv new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/csv/GUAC-sell-model-output.csv @@ -0,0 +1 @@ + diff --git a/csv/HNT-buy-model-output.csv b/csv/HNT-buy-model-output.csv new file mode 100644 index 0000000..b457296 --- /dev/null +++ b/csv/HNT-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +HNT,buy,2.5,12229.806111493546,12229.806111493546,24,1933.9296021963073,2.0,2.0,-17.734615455358774,3319.449880805519,0.0,28.19446305104985,19.944141500267477,17.386482890760295,-0.9479550565966481,448 days 06:00:00,59.03082839542322,31.16304117784609,25.902135471590793,-8.056212159115919,173 days 08:05:00,production,,1000000.0,12229.806111493546,100.0,85.8213731522522,0.0 diff --git a/csv/HNT-sell-model-output.csv b/csv/HNT-sell-model-output.csv new file mode 100644 index 0000000..89f4179 --- /dev/null +++ b/csv/HNT-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +HNT,sell,2.5,11537.597040450786,11537.597040450786,24,100632.882136413,0.65,0.65,26.768010455506424,15608.642116698647,9207.59522644162,28.910585254053377,20.82496310003125,18.12330972039233,-1.0034035793784652,447 days 21:00:00,79.55045491278179,66.22571523867016,47.99949159240575,-11.985418574171646,172 days 23:05:00,production,,10000000.0,11537.597040450786,99.83373929607843,-23.862275485263872,5899036.673145979 diff --git a/csv/JLP-buy-model-output.csv b/csv/JLP-buy-model-output.csv new file mode 100644 index 0000000..fd89ce8 --- /dev/null +++ b/csv/JLP-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +JLP,buy,2.5,122812.36310109757,122812.36310109757,24,21061.45062955656,1.2,1.2,-36.790288706301645,8206.888803660073,7159000.668337201,50.419766203172024,8.427459907193487,8.88546734760915,-3.825059457473566,292 days 11:00:00,40.35272611417483,156.50454518630266,180.14007232885228,-3.4644683705186248,225 days 09:15:00,production,,2000000.0,16055.959402888682,7.108729217270142,32.47199883493521,1744632062.0658245 diff --git a/csv/JLP-sell-model-output.csv b/csv/JLP-sell-model-output.csv new file mode 100644 index 0000000..7dc2254 --- /dev/null +++ b/csv/JLP-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +JLP,sell,2.5,174196.56602679173,174196.56602679173,24,217504.2643421407,0.65,0.65,-13.771346931256637,39434.225219846885,7749465.835341856,52.44606340466659,8.821544805157718,9.319283263099416,-4.448244779519843,293 days 02:00:00,73.1581693934686,52.42552640580149,78.9302417579485,-6.224315258661672,226 days 00:15:00,production,,5000000.0,16144.720490295533,0.0,-27.89280430122133,982581221.279025 diff --git a/csv/JTO-buy-model-output.csv b/csv/JTO-buy-model-output.csv new file mode 100644 index 0000000..9642f2b --- /dev/null +++ b/csv/JTO-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +JTO,buy,2.5,168486.72756010454,168486.72756010454,24,54344.02301947852,1.5,1.5,47.37373353665604,72877.51294113726,4050005.7828115886,151.59193797034794,74.85539159409329,124.97612316371351,-46.141888329410776,268 days 08:00:00,41.228111914477175,14.79608731269775,14.592361756422376,-2.7639565606242393,225 days 09:15:00,production,,1000000.0,22665.790390286384,62.774243023353336,89.40267195531423,55572777.10729171 diff --git a/csv/JTO-sell-model-output.csv b/csv/JTO-sell-model-output.csv new file mode 100644 index 0000000..81e9725 --- /dev/null +++ b/csv/JTO-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +JTO,sell,2.5,109454.45814459499,109454.45814459499,24,532888.3643604974,0.75,0.75,179.6152302031061,101918.99370483129,11289867.34405871,151.97600395146003,75.50073837196504,125.97494634518651,-46.616139364202326,268 days 23:00:00,22.792412746975923,4.082850753162456,3.975736617672148,-0.10446317129310123,226 days 00:15:00,production,,10000000.0,23520.556966788976,0.0,-25.5010243598622,1107729475.5043812 diff --git a/csv/JitoSOL-buy-model-output.csv b/csv/JitoSOL-buy-model-output.csv new file mode 100644 index 0000000..5ccc577 --- /dev/null +++ b/csv/JitoSOL-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +JitoSOL,buy,2.5,269.9204189804466,269.9204189804466,24,40990.74189612538,1.2,1.2,-57.47406026211256,21687.952078347716,105311.62067713098,111.6328155828272,56.61202982166535,42.484281340334476,-36.346930020426505,671 days 11:00:00,27.172310024912882,1316.5878450177788,161.58480692733625,-0.018565394008680514,226 days 01:05:00,production,,500000.0,269.9204189804466,18.71707573189693,44.091159521880876,2427883.0084254337 diff --git a/csv/JitoSOL-sell-model-output.csv b/csv/JitoSOL-sell-model-output.csv new file mode 100644 index 0000000..40c7ae7 --- /dev/null +++ b/csv/JitoSOL-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +JitoSOL,sell,2.5,2402.546981975961,2402.546981975961,24,261170.53714954614,0.85,0.85,-15.420155501319307,109170.00411599949,159257.34617688015,111.33619408547261,56.42388047836898,42.38048663761742,-36.290391810650895,671 days 02:00:00,58.3483629458355,35.39519409812997,29.693668188033488,-11.442682276155077,225 days 16:05:00,production,,2000000.0,331.7861378685003,0.0,-49.17679473410793,2917602.641246765 diff --git a/csv/KIN-buy-model-output.csv b/csv/KIN-buy-model-output.csv new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/csv/KIN-buy-model-output.csv @@ -0,0 +1 @@ + diff --git a/csv/KIN-sell-model-output.csv b/csv/KIN-sell-model-output.csv new file mode 100644 index 0000000..00eec60 --- /dev/null +++ b/csv/KIN-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +KIN,sell,2.5,105179584.46548048,105179584.46548048,24,645043996.9760133,0.0,1,778.0172904293391,283730063.4169331,0.0,17.590488988992863,14.48943768630922,14.51962069779123,-0.10872871147051466,918 days 20:00:00,12.001695399024683,20.5688258163551,25.76623347957396,-0.24562190458216127,147 days 18:40:00,production,,61162079510.0,105179584.46548048,100.0,-43.98615671908716,0.0 diff --git a/csv/LST-buy-model-output.csv b/csv/LST-buy-model-output.csv new file mode 100644 index 0000000..6df306e --- /dev/null +++ b/csv/LST-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +LST,buy,2.5,,,24,5236.731798077779,1.2,1.2,-30.44434009064117,1615.575396210049,106123.85144667243,18.714619785102183,8.146964858740175,8.155295492131529,-0.00020384109806625972,339 days 21:00:00,23.195872803189225,10735.442139591776,164.34153418428212,-0.05524982047177884,226 days 03:05:00,production,,50000.0,282.88535161928706,21.84418319471103,25.709027731174338,3284397.982775257 diff --git a/csv/LST-sell-model-output.csv b/csv/LST-sell-model-output.csv new file mode 100644 index 0000000..1108a70 --- /dev/null +++ b/csv/LST-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +LST,sell,2.5,31.604480555423322,31.604480555423322,24,46779.00907756136,0.8,0.8,-1.4969921363386647,8455.062344710086,15170.150666603195,18.733628078097343,8.292049064626411,8.256083168400512,-0.005194892966168485,339 days 12:00:00,34.82549749054881,36.541237737878376,47.64789507516925,-0.7203236475913977,225 days 18:05:00,production,,500000.0,31.604480555423322,0.0,-22.59309921115279,897104.6012507766 diff --git a/csv/MNDE-buy-model-output.csv b/csv/MNDE-buy-model-output.csv new file mode 100644 index 0000000..fb10de3 --- /dev/null +++ b/csv/MNDE-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +MNDE,buy,2.5,1345.509255951485,1345.509255951485,24,121880.48252035043,1.75,1.75,-64.61356884391547,590381.4010453704,118503.53221469837,23.707991952306195,46.13832911159309,37.1214483496576,-1.6421396584697079,910 days 01:00:00,17.651152440079567,138.74592939793712,28.799747072458352,0.2626381926419119,139 days 02:10:00,production,,122704.0,1345.509255951485,81.65138160970604,276.7964104023179,24629.599426955687 diff --git a/csv/OPOS-buy-model-output.csv b/csv/OPOS-buy-model-output.csv new file mode 100644 index 0000000..da2072c --- /dev/null +++ b/csv/OPOS-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +OPOS,buy,2.5,40.30750356176077,40.30750356176077,24,306.5984852189336,1.5,1.5,-215818.67127665674,1697399.3191537126,10518.104477861807,2.8382427370014596,23.456797370953154,29.031470989824697,-0.001271268770613343,260 days 13:00:00,13.412274937732201,226.62074030031084,126.14432944893635,-0.10254356826069788,147 days 18:10:00,production,,5000.0,40.30750356176077,45.63613291347465,369081.9102692013,30.98299957816029 diff --git a/csv/OPOS-sell-model-output.csv b/csv/OPOS-sell-model-output.csv new file mode 100644 index 0000000..b88fb69 --- /dev/null +++ b/csv/OPOS-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +OPOS,sell,2.5,51.19148935076421,51.19148935076421,24,3186.976374724833,0.0,1,-34243.44638750173,3186.9763715378567,13873.859491214662,2.8404936530234806,22.045094687684198,26.874182854162054,-0.0012630771534367646,260 days 02:00:00,46.92113492723432,73.54251465549468,73.20445157331608,-5.512434176597374,147 days 05:20:00,production,,50000.0,51.19148935076421,43.5377358490566,-99.9999999,217664.92552500337 diff --git a/csv/ORCA-buy-model-output.csv b/csv/ORCA-buy-model-output.csv new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/csv/ORCA-buy-model-output.csv @@ -0,0 +1 @@ + diff --git a/csv/ORCA-sell-model-output.csv b/csv/ORCA-sell-model-output.csv new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/csv/ORCA-sell-model-output.csv @@ -0,0 +1 @@ + diff --git a/csv/PYTH-buy-model-output.csv b/csv/PYTH-buy-model-output.csv new file mode 100644 index 0000000..d397067 --- /dev/null +++ b/csv/PYTH-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +PYTH,buy,2.5,579190.6784968148,579190.6784968148,24,260497.30880019066,1.2,1.2,-177.10897012225408,163029.62228031337,18939784.82476398,81.88701923170507,42.71116798887488,58.105521604514585,-14.089823052088398,286 days 02:00:00,69.83146449575082,31.85689845610283,39.59448983360703,-15.374406506796529,226 days 00:05:00,production,,10000000.0,191029.32324528103,79.34459255717101,52.153329027723295,1161738864.37637 diff --git a/csv/PYTH-sell-model-output.csv b/csv/PYTH-sell-model-output.csv new file mode 100644 index 0000000..5dc8507 --- /dev/null +++ b/csv/PYTH-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +PYTH,sell,2.5,254024.27596308384,254024.27596308384,24,1283392.3427381106,0.65,0.65,-5.0752793696655685,771824.9971768958,35577987.374981135,80.48383833939543,41.775375619279835,56.459775256306855,-13.619256570257766,285 days 17:00:00,59.45972512497429,33.98162608849321,28.305362957672664,-5.015103192515613,225 days 15:05:00,production,,3750000.0,189400.96427570438,60.865665433827665,-92.52221889110535,172859719.68280408 diff --git a/csv/RLB-buy-model-output.csv b/csv/RLB-buy-model-output.csv new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/csv/RLB-buy-model-output.csv @@ -0,0 +1 @@ + diff --git a/csv/SAMO-buy-model-output.csv b/csv/SAMO-buy-model-output.csv new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/csv/SAMO-buy-model-output.csv @@ -0,0 +1 @@ + diff --git a/csv/SAMO-sell-model-output.csv b/csv/SAMO-sell-model-output.csv new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/csv/SAMO-sell-model-output.csv @@ -0,0 +1 @@ + diff --git a/csv/SHDW-sell-model-output.csv b/csv/SHDW-sell-model-output.csv new file mode 100644 index 0000000..05b519b --- /dev/null +++ b/csv/SHDW-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +SHDW,sell,2.5,62050.76258755411,62050.76258755411,24,444119.1139425132,0.0,1,487.109958105468,232034.76387954538,0.0,29.733142040711662,49.80622314766684,56.97801585970358,-1.5713286478002275,884 days 21:00:00,56.73044510501796,55.45391354831148,90.90154569519765,-3.505824608391232,364 days 11:00:00,production,,3000000.0,62050.76258755411,100.0,-52.24606566011928,0.0 diff --git a/csv/SOL-buy-model-output.csv b/csv/SOL-buy-model-output.csv new file mode 100644 index 0000000..ebbf229 --- /dev/null +++ b/csv/SOL-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +SOL,buy,2.5,24037.669456741463,24037.669456741463,24,141092.14017582903,1.15,1.15,-9.062520945690887,73876.97236458879,170850.9883918046,45.48472276495216,27.392012976235726,23.60401620511125,-4.393664282844911,997 days 03:00:00,40.25431116292821,150.63710908086352,53.08183382967826,-3.760990933618193,364 days 19:00:00,production,,500000.0,370.5559116242815,3.9444391564608585,45.53112983782661,1156320.9950499951 diff --git a/csv/SOL-sell-model-output.csv b/csv/SOL-sell-model-output.csv new file mode 100644 index 0000000..ca2d713 --- /dev/null +++ b/csv/SOL-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +SOL,sell,2.5,8285.532660675588,8285.532660675588,24,198035.82718091508,0.9,0.9,31.9189119654331,85217.3361059003,174676.62083034468,45.331748682106074,27.282697847526244,23.528108769727048,-4.341192070604474,996 days 18:00:00,26.50843470231973,61.793101774722544,29.37993116912885,-1.7976473695518904,364 days 10:00:00,production,,2000000.0,381.2789210891376,4.5555349111975,-47.812524811510904,4099556.0014519244 diff --git a/csv/USDT-buy-model-output.csv b/csv/USDT-buy-model-output.csv new file mode 100644 index 0000000..c07cc1a --- /dev/null +++ b/csv/USDT-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +USDT,buy,2.5,,,24,13952286.225454703,1.1,1.1,-0.585839247535868,2350738.408745546,22046171.330721684,8.752518879078945,0.046427061922825384,0.046437208818605344,-0.1880470650812327,996 days 22:00:00,57.07884855973274,11068.022960273322,199.99992940393366,-2.2716218945898605,225 days 23:05:00,production,,50000000.0,49995.60428419456,8.132876353311376,15.316736501166206,468920132.6847435 diff --git a/csv/USDT-sell-model-output.csv b/csv/USDT-sell-model-output.csv new file mode 100644 index 0000000..8123d1b --- /dev/null +++ b/csv/USDT-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +USDT,sell,2.5,536958.7185807268,536958.7185807268,24,5905871.275769599,1.0,1.0,0.7139246161330457,589077.2835255577,24005098.30321961,8.3433621453877,0.04329322347014593,0.04329991973834858,-0.07485631701807827,996 days 13:00:00,26.834828391726067,22.37942748113493,25.24042357843907,-47.660931744392855,225 days 14:05:00,production,,100000000.0,50010.62146504085,0.0,-9.974434863529847,4075033781.5697017 diff --git a/csv/UXD-buy-model-output.csv b/csv/UXD-buy-model-output.csv new file mode 100644 index 0000000..aec58d4 --- /dev/null +++ b/csv/UXD-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +UXD,buy,2.5,779094.7625624427,779094.7625624427,24,1096124.3672585217,1.1,1.1,-0.02374007090305147,51798.33344349146,22475556.535413034,5.537832821529397,0.047678744056929435,0.047672934441840106,-0.2874894167159874,881 days 16:00:00,41.46618359730213,462.3231448893026,196.8389497569657,-21.39562969010157,225 days 14:05:00,production,,4000000.0,49951.73521038848,6.261362256529182,4.29599007613628,1735620051.168818 diff --git a/csv/UXD-sell-model-output.csv b/csv/UXD-sell-model-output.csv new file mode 100644 index 0000000..ea0e24e --- /dev/null +++ b/csv/UXD-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +UXD,sell,2.5,119984.09467504169,119984.09467504169,24,609107.067410495,0.95,0.95,0.3341145111595022,24059.988232646017,23973563.99790508,4.93619898125696,0.051730329858009794,0.051727207147447565,-0.36820737812402227,882 days 07:00:00,25.536014276126483,30.515243130488273,28.073018389518268,-0.2098961768943155,226 days 05:05:00,production,,10000000.0,49944.924995635585,0.0,-4.157939508148434,9964079685.3659 diff --git a/csv/WBTC-buy-model-output.csv b/csv/WBTC-buy-model-output.csv new file mode 100644 index 0000000..da99be7 --- /dev/null +++ b/csv/WBTC-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +WBTC,buy,2.5,5.618004231496031,5.618004231496031,24,6.463055784593001,1.6,1.6,-38.07447600764947,1.7447397380817258,374.410420189019,82.29947426969127,25.931416378751003,22.162985596188463,-17.23784561830345,568 days 04:00:00,24.50120602779996,19.08857487335008,17.946667840381274,-0.09776953068770977,225 days 10:15:00,production,,10.0,0.8478690865899084,8.0021053881873,16.872240819901087,2145.938514592835 diff --git a/csv/WBTC-sell-model-output.csv b/csv/WBTC-sell-model-output.csv new file mode 100644 index 0000000..92f854a --- /dev/null +++ b/csv/WBTC-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +WBTC,sell,2.5,5.971941846186817,5.971941846186817,24,18.96738962514295,0.65,0.65,-7.704259249268692,2.264518541225428,412.17219477081045,80.48693998147695,25.305530009042943,21.681615358165143,-16.325347097779453,568 days 19:00:00,26.628023170644017,27.282913292603233,28.899865944394126,-0.18732037718958372,226 days 01:15:00,production,,1000.0,0.8586920724391884,0.0,-18.36770766911524,182013.16848029272 diff --git a/csv/WETH-buy-model-output.csv b/csv/WETH-buy-model-output.csv new file mode 100644 index 0000000..225a35d --- /dev/null +++ b/csv/WETH-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +WETH,buy,2.5,76.19849238716293,76.19849238716293,24,123.92235752562696,1.6,1.6,-15.392688869375803,51.63308197133048,8951.829174936285,33.997629710230136,16.09870895827568,15.681984789885247,-1.7213314143981004,996 days 14:00:00,10.8169241657828,53.1836054333901,58.988594973277095,-0.23191853268030105,225 days 15:05:00,production,,200.0,20.262092635137545,7.957956513784372,26.041044470452412,34674.78148953739 diff --git a/csv/WETH-sell-model-output.csv b/csv/WETH-sell-model-output.csv new file mode 100644 index 0000000..eb21b4d --- /dev/null +++ b/csv/WETH-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +WETH,sell,2.5,20.579475074128734,20.579475074128734,24,211.77085310402717,0.65,0.65,20.533920868329783,33.615433289749085,9559.865693235533,33.872070836113025,16.01931383258323,15.626330725385762,-1.7135924597662417,996 days 05:00:00,67.28507019126542,18.12974327771628,18.818686507670158,-5.0701432044139505,225 days 06:05:00,production,,10000.0,19.95946062792769,0.2158062676306013,-24.420759730138297,2843891.8549209307 diff --git a/csv/WIF-sell-model-output.csv b/csv/WIF-sell-model-output.csv new file mode 100644 index 0000000..cf88b5d --- /dev/null +++ b/csv/WIF-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +$WIF,sell,2.5,1807.4483510892192,1807.4483510892192,24,2091671.1649269087,0.33,0.33,83121.53452688162,575456.4069538391,867575.2085228252,test,,20000000.0,1807.4483510892192,0.0,-83.36909371987484,30152595.332644153 diff --git a/csv/bSOL-buy-model-output.csv b/csv/bSOL-buy-model-output.csv new file mode 100644 index 0000000..37ff348 --- /dev/null +++ b/csv/bSOL-buy-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +bSOL,buy,2.5,,,24,10301.853418251645,1.2,1.2,-58.31159008468945,5034.962544921412,122358.27536349377,79.59297353415312,40.84118592110283,32.497768167632366,-15.89897845734274,802 days 04:00:00,39.97749968135579,13882.425731550313,189.8190151003402,-1.1593878872803116,225 days 07:05:00,production,,500000.0,319.310827754641,20.1677326552105,40.72861406991291,12150862.521004474 diff --git a/csv/bSOL-sell-model-output.csv b/csv/bSOL-sell-model-output.csv new file mode 100644 index 0000000..d3ffad8 --- /dev/null +++ b/csv/bSOL-sell-model-output.csv @@ -0,0 +1,2 @@ +bank,slippage_type,liquidator_premium_perc,tail_risk_profitability_capacity_native,tail_risk_profitability_capacity_native_raw,forecast_timesteps,active_asset_limit_native,weight_current,weight_adj_for_calcs,daily_cVaR_percent_raw,daily_displaced_at_risk_native,daily_liquidator_capacity_native,cvar-nrmse_in_perc,cvar-mape_in_perc,cvar-smape_in_perc,cvar-r_squared,cvar-len_price_data,market_depth-nrmse_in_perc,market_depth-mape_in_perc,market_depth-smape_in_perc,market_depth-r_squared,market_depth-len_price_data,environment,full_llm_response,current_actual_bank_limit_native,final_tail_risk_optimized_profitable_trade_size_native,final_premium_exceeding_day_percent,final_daily_cVaR_percent,final_target_limit_native +bSOL,sell,2.5,2165.072142746522,2165.072142746522,24,54704.24684464482,0.8,0.8,-30.144077839906245,17394.084367269665,159161.69124146312,81.03017498803958,41.63753056840774,32.982198374067224,-16.499054572978217,802 days 19:00:00,17.729461747073806,8.412403373790339,8.29451409980649,0.4655527095211589,225 days 22:05:00,production,,1000000.0,331.58685675304815,0.0,-39.74573586733429,9150334.555175358 diff --git a/next.config.mjs b/next.config.mjs index 87bcb37..d7f48a0 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -11,6 +11,15 @@ const nextConfig = { return config; }, reactStrictMode: false, + images: { + remotePatterns: [ + { + protocol: "https", + hostname: "storage.googleapis.com", + pathname: "/mrgn-public/mrgn-token-icons/**", + }, + ], + }, }; export default nextConfig; diff --git a/package.json b/package.json index ed6e487..8ff7e61 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@radix-ui/react-slot": "^1.1.0", "@solana/web3.js": "^1.95.3", "@tabler/icons-react": "^2.40.0", + "@tanstack/react-table": "^8.20.5", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", "lucide-react": "^0.439.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1527c80..bc49772 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41,6 +41,9 @@ dependencies: '@tabler/icons-react': specifier: ^2.40.0 version: 2.47.0(react@18.3.1) + '@tanstack/react-table': + specifier: ^8.20.5 + version: 8.20.5(react-dom@18.3.1)(react@18.3.1) class-variance-authority: specifier: ^0.7.0 version: 0.7.0 @@ -1563,6 +1566,23 @@ packages: tailwindcss: 3.4.10 dev: true + /@tanstack/react-table@8.20.5(react-dom@18.3.1)(react@18.3.1): + resolution: {integrity: sha512-WEHopKw3znbUZ61s9i0+i9g8drmDo6asTWbrQh8Us63DAk/M0FkmIqERew6P71HI75ksZ2Pxyuf4vvKh9rAkiA==} + engines: {node: '>=12'} + peerDependencies: + react: '>=16.8' + react-dom: '>=16.8' + dependencies: + '@tanstack/table-core': 8.20.5 + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + dev: false + + /@tanstack/table-core@8.20.5: + resolution: {integrity: sha512-P9dF7XbibHph2PFRz8gfBKEXEY/HJPOhym8CHmjF8y3q5mWpKx9xtZapXQUWCgkqvsK0R46Azuz+VaxD4Xl+Tg==} + engines: {node: '>=12'} + dev: false + /@types/bn.js@5.1.6: resolution: {integrity: sha512-Xh8vSwUeMKeYYrj3cX4lGQgFSF/N03r+tv4AiLl1SucqV+uTQpxRcnM8AkXKHwYP9ZPXOYXRr2KPXpVlIvqh9w==} dependencies: diff --git a/src/app/api/getCsvData/route.ts b/src/app/api/getCsvData/route.ts new file mode 100644 index 0000000..210c6ef --- /dev/null +++ b/src/app/api/getCsvData/route.ts @@ -0,0 +1,39 @@ +import fs from "fs"; +import path from "path"; +import { NextResponse } from "next/server"; + +// This is just a temporary solution to serve the CSV files +export async function GET(request: Request) { + const { searchParams } = new URL(request.url); + const tokenSymbol = searchParams.get("tokenSymbol"); + const type = searchParams.get("type"); + + if (!tokenSymbol || !type) { + return NextResponse.json( + { error: "Missing tokenSymbol or type query parameters" }, + { status: 400 } + ); + } + + try { + const filePath = path.join( + process.cwd(), + "csv", + `${tokenSymbol}-${type}-model-output.csv` + ); + + if (fs.existsSync(filePath)) { + const csvData = fs.readFileSync(filePath, "utf8"); + return NextResponse.json({ data: csvData }, { status: 200 }); + } else { + console.error(`File not found: ${filePath}`); + return NextResponse.json({ error: "File not found" }, { status: 404 }); + } + } catch (error) { + console.error("Error reading CSV file:", error); + return NextResponse.json( + { error: "Internal server error" }, + { status: 500 } + ); + } +} diff --git a/src/app/risk-model/page.tsx b/src/app/risk-model/page.tsx index 41010e6..eea6643 100644 --- a/src/app/risk-model/page.tsx +++ b/src/app/risk-model/page.tsx @@ -1,3 +1,5 @@ -export default function RiskModel() { - return
risk layout page
; +import { RiskModel } from "~/components/common/risk-model/risk-model"; + +export default function RiskModelPage() { + return ; } diff --git a/src/components/common/risk-model/components/filter-component.tsx b/src/components/common/risk-model/components/filter-component.tsx new file mode 100644 index 0000000..8749dab --- /dev/null +++ b/src/components/common/risk-model/components/filter-component.tsx @@ -0,0 +1,50 @@ +import * as dropdown from "~/components/ui/dropdown"; +import { MenuIcon } from "lucide-react"; +import * as React from "react"; +import { UIRiskModelType } from "~/types"; + +interface FilterComponentProps { + selectedFilter: string; + setSelectedFilter: React.Dispatch>; +} +export const FilterComponent = ({ + selectedFilter, + setSelectedFilter, +}: FilterComponentProps) => { + return ( + + + + + + { + setSelectedFilter("All"); + }} + > + All + + + { + setSelectedFilter("Buy"); + }} + > + Buy + + { + setSelectedFilter("Sell"); + }} + > + Sell + + + + ); +}; + +// TODO: combine two filter components into one, also rename cause filter and search might be confusing diff --git a/src/components/common/risk-model/components/index.ts b/src/components/common/risk-model/components/index.ts new file mode 100644 index 0000000..35a061f --- /dev/null +++ b/src/components/common/risk-model/components/index.ts @@ -0,0 +1,3 @@ +export * from "./filter-component"; +export * from "./search-component"; +export * from "./table-component"; diff --git a/src/components/common/risk-model/components/search-component.tsx b/src/components/common/risk-model/components/search-component.tsx new file mode 100644 index 0000000..ac64173 --- /dev/null +++ b/src/components/common/risk-model/components/search-component.tsx @@ -0,0 +1,20 @@ +import { Input } from "~/components/ui/input"; +import { UIRiskModelType } from "~/types"; + +interface SearchComponentProps { + value?: string; + setValue: React.Dispatch>; +} + +export const SearchComponent = ({ value, setValue }: SearchComponentProps) => { + return ( + setValue(e.target.value as UIRiskModelType)} + className="sm:max-w-sm max-w-56" + /> + ); +}; + +// TODO: make more global (placeholder, className...) diff --git a/src/components/common/risk-model/components/table-component.tsx b/src/components/common/risk-model/components/table-component.tsx new file mode 100644 index 0000000..cac3bb7 --- /dev/null +++ b/src/components/common/risk-model/components/table-component.tsx @@ -0,0 +1,75 @@ +import { + Table, + TableHeader, + TableBody, + TableHead, + TableRow, + TableCell, +} from "~/components/ui/table"; +import { dataType } from "../risk-model"; +import Image from "next/image"; +import { tokenPriceFormatter } from "@mrgnlabs/mrgn-common"; + +interface TableComponentProps { + data: dataType[]; +} + +export const TableComponent = ({ data }: TableComponentProps) => { + return ( + + + + Health + Buy/Sell + Token + Token Symbol + Price + Liquidator Capacity + Current Bank Limit + Daily Displaced + Target + + + + {data.map((row, index) => { + return ( + + + {row.health.isHealthy ? ( + Healthy + ) : ( + Unhealthy + )} + {/* TODO: add indicators */} + + + {row.type === "Buy" ? ( + Buy + ) : ( + Sell + )} + + + {" "} + + {row.tokenSymbol} + + {tokenPriceFormatter( + row.price?.priceRealtime?.price?.toNumber()! + )} + + + {Number(row.liquidatorCapacity)?.toFixed(2)} + + {Number(row.currentBankLimit)?.toFixed(2)} + {Number(row.dailyDisplaced)?.toFixed(2)} + {Number(row.target)?.toFixed(2)} + + ); + })} + +
+ ); +}; + +// TODO: add indicators, format numbers, add sorting diff --git a/src/components/common/risk-model/risk-model.tsx b/src/components/common/risk-model/risk-model.tsx new file mode 100644 index 0000000..fd5b5e6 --- /dev/null +++ b/src/components/common/risk-model/risk-model.tsx @@ -0,0 +1,218 @@ +"use client"; +import React, { useEffect } from "react"; +import * as riskModelComponents from "./components"; +import { UIRiskModelType } from "~/types"; +import { useMrgnStore } from "~/stores"; +import { Connection } from "@solana/web3.js"; +import { + Bank, + MarginfiClient, + OraclePrice, +} from "@mrgnlabs/marginfi-client-v2"; + +export type dataType = { + health: HealthCheckResult; + type: string; + tokenImage: string; + tokenSymbol: string | null; + price: OraclePrice | null; + liquidatorCapacity: string | null; + currentBankLimit: string | null; + dailyDisplaced: string | null; + target: string | null; +}; // TODO: move + +const parseCSVToObject = (csvText: string) => { + const rows = csvText.trim().split("\n"); + const headers = rows[0].split(","); + const dataRow = rows[1].split(","); + + const parsedObject = Object.fromEntries( + headers.map((header, index) => [header, dataRow[index] || ""]) + ) as Record; + + return parsedObject; +}; // TODO: move + +type HealthCheckResult = { + isHealthy: boolean; + healthFactor: number; + statusMessage: string; +}; // TODO: move + +type RiskModelData = { + liquidatorCapacity: string; + dailyDisplaced: string; +}; // TODO: move + +const calculateRiskModelHealthFactor = ( + data: RiskModelData +): HealthCheckResult => { + const liquidatorCapacity = parseFloat(data.liquidatorCapacity); + const dailyDisplaced = parseFloat(data.dailyDisplaced); + + const healthFactor = liquidatorCapacity - dailyDisplaced; + const isHealthy = liquidatorCapacity > dailyDisplaced; + const statusMessage = isHealthy + ? "The bank is healthy with sufficient liquidity." + : "The bank is at risk due to insufficient liquidator capacity."; + + return { + isHealthy, + healthFactor, + statusMessage, + }; +}; // TODO: move + +export const RiskModel = () => { + const [searchValue, setSearchValue] = React.useState(); + const [filterValue, setFilterValue] = React.useState("All"); + const { fetchMrgnClient, mrgnClient } = useMrgnStore(); + const [data, setData] = React.useState([]); + const [filteredData, setFilteredData] = React.useState< + dataType[] | undefined + >([]); + + const fetchData = async (mrgnClient: MarginfiClient) => { + const banks = Array.from(mrgnClient.banks.entries()); + + const fetchBankData = async (bank: Bank) => { + const tokenSymbol = bank.tokenSymbol; + let buyDataObject: dataType | null = null; + let sellDataObject: dataType | null = null; + const oraclePricePerBank = mrgnClient.getOraclePriceByBank(bank.address); + + try { + const buyResponse = await fetch( + `/api/getCsvData?tokenSymbol=${tokenSymbol}&type=buy` + ); + if (buyResponse.ok) { + const buyData = await buyResponse.json(); + const parsedBuyData = parseCSVToObject(buyData.data); + + const health = calculateRiskModelHealthFactor({ + liquidatorCapacity: + parsedBuyData["tail_risk_profitability_capacity_native"], + dailyDisplaced: parsedBuyData["daily_displaced_at_risk_native"], + }); + + buyDataObject = { + health, + type: "Buy", + tokenImage: `https://storage.googleapis.com/mrgn-public/mrgn-token-icons/${bank.tokenSymbol}.png`, + tokenSymbol: bank.tokenSymbol ?? null, + price: oraclePricePerBank, + liquidatorCapacity: + parsedBuyData.tail_risk_profitability_capacity_native, + currentBankLimit: bank.config.borrowLimit.toString(), + dailyDisplaced: parsedBuyData["daily_displaced_at_risk_native"], + target: parsedBuyData.final_target_limit_native, + }; + } else { + console.error(`Failed to fetch buy data for ${tokenSymbol}`); + } + } catch (error) { + console.error(`Error fetching buy data for ${tokenSymbol}:`, error); + } + + try { + const sellResponse = await fetch( + `/api/getCsvData?tokenSymbol=${tokenSymbol}&type=sell` + ); + if (sellResponse.ok) { + const sellData = await sellResponse.json(); + const parsedSellData = parseCSVToObject(sellData.data); + + const health = calculateRiskModelHealthFactor({ + liquidatorCapacity: + parsedSellData["tail_risk_profitability_capacity_native"], + dailyDisplaced: parsedSellData["daily_displaced_at_risk_native"], + }); + + sellDataObject = { + health, + type: "Sell", + tokenImage: `https://storage.googleapis.com/mrgn-public/mrgn-token-icons/${bank.tokenSymbol}.png`, + tokenSymbol: bank.tokenSymbol ?? null, + price: oraclePricePerBank, + liquidatorCapacity: + parsedSellData.tail_risk_profitability_capacity_native, + currentBankLimit: bank.config.depositLimit.toString(), + dailyDisplaced: parsedSellData.daily_displaced_at_risk_native, + target: parsedSellData.final_target_limit_native, + }; + } else { + console.error(`Failed to fetch sell data for ${tokenSymbol}`); + } + } catch (error) { + console.error(`Error fetching sell data for ${tokenSymbol}:`, error); + } + + if (buyDataObject) { + setData((prevData) => [...prevData, buyDataObject]); + } + if (sellDataObject) { + setData((prevData) => [...prevData, sellDataObject]); + } + }; + + const fetchPromises = banks.map( + ([, bank]) => bank.tokenSymbol && fetchBankData(bank) + ); + + await Promise.all(fetchPromises); + }; // TOOD: split, add fetched data to store, and move to utils or hooks + + React.useEffect(() => { + if (!mrgnClient) { + const connection = new Connection( // eslint-disable-next-line + process.env.NEXT_PUBLIC_MARGINFI_RPC_ENDPOINT!, + "confirmed" + ); + fetchMrgnClient({ connection }); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); // TOOD: move to one place, its repeated in both components right now + + React.useEffect(() => { + if (mrgnClient) fetchData(mrgnClient); + }, [mrgnClient]); + + useEffect(() => { + let _data = filteredData ?? data; + if (filterValue === "All") { + _data = data; + } else { + _data = data.filter( + (item) => item.type.toLowerCase() === filterValue.toLowerCase() + ); + } + + if (searchValue) { + _data = _data.filter((item) => + item.tokenSymbol?.toLowerCase().includes(searchValue.toLowerCase()) + ); + } + + setFilteredData(_data); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [filterValue, searchValue]); + + return ( +
+
+ + +
+ 0 ? filteredData : data} + /> +
+ ); +}; diff --git a/src/components/common/summary/components/pool-summary.tsx b/src/components/common/summary/components/pool-summary.tsx index a381e4c..588392d 100644 --- a/src/components/common/summary/components/pool-summary.tsx +++ b/src/components/common/summary/components/pool-summary.tsx @@ -11,10 +11,11 @@ export const PoolSummary = ({ poolName, poolData }: PoolSummaryProps) => {

{poolName}

- + /> */} + {/* TODO: compute total number of loans once cached in the api */} { } return ( -
+

{poolName}

@@ -53,7 +54,7 @@ const PoolItem = ({ poolName, poolNumber }: PoolItemProps) => { const LoadingItem = ({ poolName }: { poolName: string }) => { return ( -
+

{poolName}

diff --git a/src/components/common/summary/summary.tsx b/src/components/common/summary/summary.tsx index ff1e6b1..55a48df 100644 --- a/src/components/common/summary/summary.tsx +++ b/src/components/common/summary/summary.tsx @@ -20,7 +20,7 @@ export const Summary = () => { >(undefined); const { fetchMrgnClient, mrgnClient } = useMrgnStore(); - const getBanks = async (client: MarginfiClient) => { + const computeBankTotals = async (client: MarginfiClient) => { const banksArray = Array.from(client.banks.values()); setCollateralBanksValues( calculateTotals( @@ -46,7 +46,7 @@ export const Summary = () => { }, []); React.useEffect(() => { - if (mrgnClient) getBanks(mrgnClient); + if (mrgnClient) computeBankTotals(mrgnClient); }, [mrgnClient]); return ( diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx new file mode 100644 index 0000000..ac55148 --- /dev/null +++ b/src/components/ui/input.tsx @@ -0,0 +1,25 @@ +import * as React from "react"; + +import { cn } from "~/utils/theme-utils"; + +export interface InputProps + extends React.InputHTMLAttributes {} + +const Input = React.forwardRef( + ({ className, type, ...props }, ref) => { + return ( + + ); + } +); +Input.displayName = "Input"; + +export { Input }; diff --git a/src/components/ui/table.tsx b/src/components/ui/table.tsx new file mode 100644 index 0000000..c21ad11 --- /dev/null +++ b/src/components/ui/table.tsx @@ -0,0 +1,120 @@ +import * as React from "react"; + +import { cn } from "~/utils/theme-utils"; + +const Table = React.forwardRef< + HTMLTableElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+ + +)); +Table.displayName = "Table"; + +const TableHeader = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + +)); +TableHeader.displayName = "TableHeader"; + +const TableBody = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + +)); +TableBody.displayName = "TableBody"; + +const TableFooter = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + tr]:last:border-b-0", + className + )} + {...props} + /> +)); +TableFooter.displayName = "TableFooter"; + +const TableRow = React.forwardRef< + HTMLTableRowElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + +)); +TableRow.displayName = "TableRow"; + +const TableHead = React.forwardRef< + HTMLTableCellElement, + React.ThHTMLAttributes +>(({ className, ...props }, ref) => ( +
[role=checkbox]]:translate-y-[2px]", + className + )} + {...props} + /> +)); +TableHead.displayName = "TableHead"; + +const TableCell = React.forwardRef< + HTMLTableCellElement, + React.TdHTMLAttributes +>(({ className, ...props }, ref) => ( + [role=checkbox]]:translate-y-[2px]", + className + )} + {...props} + /> +)); +TableCell.displayName = "TableCell"; + +const TableCaption = React.forwardRef< + HTMLTableCaptionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)); +TableCaption.displayName = "TableCaption"; + +export { + Table, + TableHeader, + TableBody, + TableFooter, + TableHead, + TableRow, + TableCell, + TableCaption, +}; diff --git a/src/types/index.tsx b/src/types/index.tsx index 468619d..09bcda7 100644 --- a/src/types/index.tsx +++ b/src/types/index.tsx @@ -10,3 +10,5 @@ export interface NavItem { } export type UIPoolType = "All pools" | "Global pools" | "Isolated pools"; + +export type UIRiskModelType = "All" | "Buy" | "Sell";