Skip to content

Commit

Permalink
Extra fee util (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipzeta authored Mar 14, 2024
1 parent 72a8301 commit a3479ab
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
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.23.6]

- Extra util getFeeBps() ([#368](https://github.com/zetamarkets/sdk/pull/368))

## [1.23.5]

- Add support for fee tiers. ([#358](https://github.com/zetamarkets/sdk/pull/358))
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.23.5",
"version": "1.23.6",
"description": "Zeta SDK",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
15 changes: 15 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2172,3 +2172,18 @@ export function calculateTakeTriggerOrderExecutionPrice(
}
return executionPrice;
}

export function getFeeBps(
isTaker: boolean,
accountType: constants.MarginAccountType
): number {
let feeMap = isTaker
? constants.FEE_TIER_MAP_BPS["taker"]
: constants.FEE_TIER_MAP_BPS["maker"];

let fee = feeMap[accountType];
if (fee == undefined) {
return feeMap[constants.MarginAccountType.NORMAL];
}
return fee;
}

0 comments on commit a3479ab

Please sign in to comment.