Skip to content

Commit

Permalink
Fixing the convertor 'convertKujiraBalancesToBalances'.
Browse files Browse the repository at this point in the history
  • Loading branch information
darley-silva-funttastic committed Sep 8, 2023
1 parent 7324211 commit 1c0809c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/connectors/kujira/kujira.convertors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,16 +535,18 @@ export const convertKujiraBalancesToBalances = async (

const amount = order.amount;

if (order.status == OrderStatus.OPEN) {
if ([OrderStatus.OPEN, OrderStatus.PARTIALLY_FILLED].includes(
getNotNullOrThrowError<OrderStatus>(order.status)
)) {
tokenBalance.lockedInOrders = tokenBalance.lockedInOrders.plus(amount);
tokenBalance.inUSD.lockedInOrders =
tokenBalance.inUSD.lockedInOrders.plus(
tokenBalance.lockedInOrders.multipliedBy(quotation)
amount.multipliedBy(quotation)
);
} else if (order.status == OrderStatus.FILLED) {
tokenBalance.unsettled = tokenBalance.unsettled.plus(amount);
tokenBalance.inUSD.unsettled =
tokenBalance.unsettled.multipliedBy(quotation);
amount.multipliedBy(quotation);
}
}

Expand Down

0 comments on commit 1c0809c

Please sign in to comment.