@drift-labs/sdk
Version:
SDK for Drift Protocol
20 lines (19 loc) • 1.2 kB
TypeScript
/// <reference types="bn.js" />
import { MarginCategory, SpotMarketAccount, SpotPosition } from '../types';
import { BN } from '@coral-xyz/anchor';
import { StrictOraclePrice } from '../oracles/strictOraclePrice';
export declare function isSpotPositionAvailable(position: SpotPosition): boolean;
export type OrderFillSimulation = {
tokenAmount: BN;
ordersValue: BN;
tokenValue: BN;
weight: BN;
weightedTokenValue: BN;
freeCollateralContribution: any;
};
export declare function getWorstCaseTokenAmounts(spotPosition: SpotPosition, spotMarketAccount: SpotMarketAccount, strictOraclePrice: StrictOraclePrice, marginCategory: MarginCategory, customMarginRatio?: number): OrderFillSimulation;
export declare function calculateWeightedTokenValue(tokenAmount: BN, tokenValue: BN, oraclePrice: BN, spotMarket: SpotMarketAccount, marginCategory: MarginCategory, customMarginRatio?: number): {
weight: BN;
weightedTokenValue: BN;
};
export declare function simulateOrderFill(tokenAmount: BN, tokenValue: BN, openOrders: BN, strictOraclePrice: StrictOraclePrice, spotMarket: SpotMarketAccount, marginCategory: MarginCategory, customMarginRatio?: number): OrderFillSimulation;