We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9b4228e commit 68ee193Copy full SHA for 68ee193
sdk/src/driftClient.ts
@@ -124,6 +124,7 @@ import { TxSender, TxSigAndSlot } from './tx/types';
124
import {
125
BASE_PRECISION,
126
GOV_SPOT_MARKET_INDEX,
127
+ MARGIN_PRECISION,
128
ONE,
129
PERCENTAGE_PRECISION,
130
PRICE_PRECISION,
@@ -4798,11 +4799,15 @@ export class DriftClient {
4798
4799
}
4800
);
4801
4802
+ const marginRatio = Math.floor(
4803
+ (1 / positionMaxLev) * MARGIN_PRECISION.toNumber()
4804
+ );
4805
+
4806
// TODO: Handle multiple markets?
4807
const setPositionMaxLevIxs =
4808
await this.getUpdateUserPerpPositionCustomMarginRatioIx(
4809
readablePerpMarketIndex[0],
- 1 / positionMaxLev,
4810
+ marginRatio,
4811
subAccountId
4812
4813
0 commit comments