Skip to content

Commit

Permalink
Fixed bug in Omnipool arbitrager
Browse files Browse the repository at this point in the history
  • Loading branch information
poliwop committed Jul 12, 2023
1 parent 8e884b8 commit 993db55
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion hydradx/model/amm/trade_strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,8 @@ def strategy(state: GlobalState, agent_id: str) -> None:
if delta_Qi > 0:
dr[i] = r[asset] * delta_Qi / (q[asset] + delta_Qi) * (1 - asset_fees[i])
else:
dr[i] = r[asset] * delta_Qi / (q[asset] + delta_Qi) / (1 - lrna_fees[i])
delta_Qi_fee_adj = delta_Qi / (1 - lrna_fees[i])
dr[i] = r[asset] * delta_Qi_fee_adj / (q[asset] + delta_Qi_fee_adj)
profit = sum([dr[i] * prices[i] for i in range(len(prices))])
if profit < 0:
if j > 0:
Expand Down
2 changes: 1 addition & 1 deletion hydradx/tests/test_omnipool_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_omnipool_arbitrager_feeless(omnipool: oamm.OmnipoolState, market: list,


# @settings(max_examples=10000)
@reproduce_failure('6.39.6', b'AXicY5q21t2625ph/UwWCZE8Vv/zu857bGF9lFS/rtaG/z+Dy4QUK6ggg7+h29ZbMvwLE88vu1kH5THdftezVEKVwXrTK3cnJ6ggIwDM+iJ/')
# @reproduce_failure('6.39.6', b'AXicY5q21t2625ph/UwWCZE8Vv/zu857bGF9lFS/rtaG/z+Dy4QUK6ggg7+h29ZbMvwLE88vu1kH5THdftezVEKVwXrTK3cnJ6ggIwDM+iJ/')
@given(omnipool_reasonable_config(token_count=3), reasonable_market(token_count=3), arb_precision_strategy)
def test_omnipool_arbitrager(omnipool: oamm.OmnipoolState, market: list, arb_precision: int):
omnipool.trade_limit_per_block = float('inf')
Expand Down

0 comments on commit 993db55

Please sign in to comment.