Skip to content

Commit

Permalink
Fix import_monthly_binance_prices in processing.py
Browse files Browse the repository at this point in the history
  • Loading branch information
poliwop committed Jun 27, 2023
1 parent 6e1d0bc commit c283616
Show file tree
Hide file tree
Showing 2 changed files with 392 additions and 89 deletions.
8 changes: 7 additions & 1 deletion hydradx/model/amm/omnipool_amm.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,8 +901,14 @@ def execute_add_liquidity(
) -> tuple[OmnipoolState, Agent]:
"""Compute new state after liquidity addition"""

if quantity <= 0:
return state.fail_transaction('Quantity must be non-negative.', agent)

delta_Q = lrna_price(state, tkn_add) * quantity
if not (state.unique_id, tkn_add) in agent.holdings:
if (state.unique_id, tkn_add) in agent.holdings:
if agent.holdings[(state.unique_id, tkn_add)] != 0:
return state.fail_transaction(f'Agent already has liquidity in pool {tkn_add}.', agent)
else:
agent.holdings[(state.unique_id, tkn_add)] = 0

if agent.holdings[tkn_add] < quantity:
Expand Down
473 changes: 385 additions & 88 deletions hydradx/notebooks/Omnipool/DynamicFeesComaprison4.ipynb

Large diffs are not rendered by default.

0 comments on commit c283616

Please sign in to comment.