cryptosharks131 / lndg

Lite GUI web interface to analyze lnd data and leverage the backend database for automation tools around rebalancing and other basic maintenance tasks.
MIT License
232 stars 47 forks source link

Improve Auto Fees logic #337

Closed Impa10r closed 10 months ago

Impa10r commented 1 year ago

Improve Auto Fees logic to allow smooth non-linear increase of fees based on each Update period's flows and channel's liquidity situation. The new logic is described and simulated in this Google Sheet:

https://docs.google.com/spreadsheets/d/1BXsj9pjiKgdaz9JnJ_wKHq5cRRDhzdYQnKLqMyZS-1c/edit?usp=sharing

M1ch43lV commented 11 months ago

Running the modified af.py since 1 week with these AF settings image

I am very satisfied with this new kind of fee algorithm! Thanks very much for this new proposal! It has a more reactive and fast behavior, also a more granular approach of fee adjustment.

However, on channels with very fast liquidity drain, the increase of ppm fees is too high in my opinion, especially if you have high value sink channels with >=1000ppm. Unfortunately the AF.multiplier is an integer variable, and the value of 1 is the lowest setting. However I need a fractional value such as 0.1.

Therefore I suggest to adapt the code line 110 by introducing a divisor like 10 for a smoother slope increase with draining liquidity:

'''balanced_df['new_rate'] = balanced_df.apply(lambda row: row['local_fee_rate'] + (1 if row['local_fee_rate'] < 10 else 1 + (row['local_fee_rate'] - 10) / 20) multiplier / 10 row['net_routed_hours'] * row['in_percent'] if row['net_routed_hours'] > 0 else row['new_rate'], axis=1) '''

Impa10r commented 11 months ago

Thanks for the feedback! There is definitely room to customise further and the beauty of python implementation is that everyone can tweak it to his heart's content.

blckbx commented 11 months ago

+1 I also like this approach a lot for source peers. Been using it for some weeks now.

M1ch43lV commented 11 months ago

By the way I suggest the minimum outflow from 1000 (row['amt_routed_out_7day'] < 1000) to 1000000 sats (row['amt_routed_out_7day'] < 1000000) in line 108 and 118 to have a faster fee reduction in case of almost no flow.