Skip to content

Commit

Permalink
Improve ArbitrageFinderBase.get_profit
Browse files Browse the repository at this point in the history
  • Loading branch information
barak manos committed May 27, 2024
1 parent a02c92c commit a15c976
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fastlane_bot/modes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ def find_arbitrage(self) -> Dict[List[Any], List[Any]]:
...

def get_profit(self, src_token: str, optimization, trade_instructions_df):
profit = self.calculate_profit(src_token, -optimization.result)
return profit if profit.is_finite() and profit > self.ConfigObj.DEFAULT_MIN_PROFIT_GAS_TOKEN and is_net_change_small(trade_instructions_df) else None
if is_net_change_small(trade_instructions_df):
profit = self.calculate_profit(src_token, -optimization.result)
if profit.is_finite() and profit > self.ConfigObj.DEFAULT_MIN_PROFIT_GAS_TOKEN:
return profit
return None

def calculate_profit(self, src_token: str, src_profit: float) -> Decimal:
"""
Expand Down

0 comments on commit a15c976

Please sign in to comment.