Skip to content

Commit

Permalink
Add a test for overlapping strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
barak manos committed May 23, 2024
1 parent f640a43 commit 7638132
Show file tree
Hide file tree
Showing 3 changed files with 10,209 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fastlane_bot/helpers/poolandtokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def _other_to_cpc(self) -> List[Any]:
class DoubleInvalidCurveError(ValueError):
pass

def _carbon_to_cpc(self) -> ConstantProductCurve:
def _carbon_to_cpc_and_type(self) -> ConstantProductCurve:
"""
constructor: from a single Carbon order (see class docstring for other parameters)*
Expand Down Expand Up @@ -467,6 +467,8 @@ def _carbon_to_cpc(self) -> ConstantProductCurve:
for i in [0, 1] if encoded_orders[i]["y"] > 0 and encoded_orders[i]["B"] > 0
]

prices_overlap = False

pmarg_threshold = Decimal("0.01") # 1% # WARNING using this condition alone can included stable/stable pairs incidently

# Only overlapping strategies are selected for modification
Expand Down Expand Up @@ -497,8 +499,11 @@ def _carbon_to_cpc(self) -> ConstantProductCurve:
if typed_args["yint"] < yint0:
typed_args["yint"] = yint0

return {'strategy_typed_args': strategy_typed_args, 'prices_overlap': prices_overlap}

def _carbon_to_cpc(self) -> ConstantProductCurve:
cpc_list = []
for typed_args in strategy_typed_args:
for typed_args in self._carbon_to_cpc_and_type()['strategy_typed_args']:
try:
cpc_list.append(ConstantProductCurve.from_carbon(**self._convert_to_float(typed_args)))
except Exception as e:
Expand Down
Loading

0 comments on commit 7638132

Please sign in to comment.