Skip to content

Commit

Permalink
removed duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
akintewe committed Jan 16, 2025
1 parent ebe854f commit bb6f430
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions web_app/db/crud/position.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,27 +469,7 @@ def add_extra_deposit_to_position(self, position: Position, amount: str) -> None
session.execute(stmt)
session.commit()

def add_extra_deposit(self, token_symbol: str, amount: str, position_id: UUID) -> None:
"""
Add or update an extra deposit for a position.
If deposit exists for token_symbol, update amount instead of creating new.
"""
with self.Session() as session:
stmt = insert(ExtraDeposit).values(
token_symbol=token_symbol,
amount=amount,
position_id=position_id,
added_at=datetime.utcnow()
).on_conflict_do_update(
index_elements=['token_symbol', 'position_id'],
set_={
'amount': ExtraDeposit.amount + cast(amount, String),
'added_at': datetime.utcnow()
}
)
session.execute(stmt)
session.commit()


def get_extra_deposits_data(self, position_id: UUID) -> Dict[str, str]:
"""
Get all extra deposits for a position.
Expand Down

0 comments on commit bb6f430

Please sign in to comment.