Skip to content

Commit

Permalink
Bugfix (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipzeta authored Aug 28, 2023
1 parent 7ce2d2b commit 092c1ef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Version changes are pinned to SDK releases.

## Unreleased

## [1.7.3] 2023-08-28

- Small bugfix for sizeUpperBound in getMaxTradeSize(). ([#260](https://github.com/zetamarkets/sdk/pull/260))

## [1.7.2] 2023-08-24

- New risk utils return 0 if balance is 0. ([#259](https://github.com/zetamarkets/sdk/pull/259))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zetamarkets/sdk",
"repository": "https://github.com/zetamarkets/sdk/",
"version": "1.7.2",
"version": "1.7.3",
"description": "Zeta SDK",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/risk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ export class RiskCalculator {

// Iterate until we find a good size using a binary search
let sizeLowerBound = 0;
let sizeUpperBound = Math.max(0, (state.balance / init) * markPrice);
let sizeUpperBound = 2 * Math.max(0, state.balance / (init * markPrice));
if (sizeUpperBound == 0) {
return closeSize;
}
Expand Down

0 comments on commit 092c1ef

Please sign in to comment.