@drift-labs/sdk
Version:
SDK for Drift Protocol
12 lines (11 loc) • 805 B
TypeScript
/// <reference types="bn.js" />
import { BN } from '@coral-xyz/anchor';
import { MarginCategory, SpotBalanceType, SpotMarketAccount } from '../types';
export declare function castNumberToSpotPrecision(value: number | BN, spotMarket: SpotMarketAccount): BN;
export declare function calculateSpotMarketMarginRatio(market: SpotMarketAccount, oraclePrice: BN, marginCategory: MarginCategory, size: BN, balanceType: SpotBalanceType, customMarginRatio?: number): number;
/**
* Returns the maximum remaining deposit that can be made to the spot market. If the maxTokenDeposits on the market is zero then there is no limit and this function will also return zero. (so that needs to be checked)
* @param market
* @returns
*/
export declare function calculateMaxRemainingDeposit(market: SpotMarketAccount): BN;