Skip to content

Commit

Permalink
rebalance: average forward fee report is optional
Browse files Browse the repository at this point in the history
- listforwards call takes half a minute on my machine and consumes lots of memory, as I have hundreds of thousands of forwards right now
- it's an option to turn this part of the report off, although by default it's turned on for backward compatibility (others may use this already)
Gálli Zoltán authored and m-schmoock committed Feb 6, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent cf96eb6 commit 78e2d06
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions rebalance/rebalance.py
Original file line number Diff line number Diff line change
@@ -910,7 +910,7 @@ def get_avg_forward_fees(intervals):


@plugin.method("rebalancereport")
def rebalancereport(plugin: Plugin):
def rebalancereport(plugin: Plugin, include_avg_fees: bool = True):
"""Show information about rebalance
"""
res = {}
@@ -961,10 +961,11 @@ def rebalancereport(plugin: Plugin):
else:
res["average_rebalance_fee_ppm"] = 0

avg_forward_fees = get_avg_forward_fees([1, 7, 30])
res['average_forward_fee_ppm_1d'] = avg_forward_fees[0]
res['average_forward_fee_ppm_7d'] = avg_forward_fees[1]
res['average_forward_fee_ppm_30d'] = avg_forward_fees[2]
if include_avg_fees:
avg_forward_fees = get_avg_forward_fees([1, 7, 30])
res['average_forward_fee_ppm_1d'] = avg_forward_fees[0]
res['average_forward_fee_ppm_7d'] = avg_forward_fees[1]
res['average_forward_fee_ppm_30d'] = avg_forward_fees[2]

return res

0 comments on commit 78e2d06

Please sign in to comment.