Skip to main content

Class: ChromaticPosition

Represents a Chromatic position and provides methods to interact with it.

Constructors​

constructor​

• new ChromaticPosition(_client)

Creates a new instance of ChromaticPosition.

Parameters​

NameTypeDescription
_clientClientThe Chromatic Client instance.

Defined in​

packages/sdk-ethers-v6/src/entities/ChromaticPosition.ts:75

Methods​

contracts​

▸ contracts(): Object

Retrieves the contract instances associated with Chromatic Position.

Returns​

Object

An object containing the contract instances of Lens, Market, and Market Factory.

NameType
lensChromaticLens
market(marketAddress: string) => IChromaticMarket
marketFactoryChromaticMarketFactory

Defined in​

packages/sdk-ethers-v6/src/entities/ChromaticPosition.ts:81


getInterest​

▸ getInterest(marketAddress, position): Promise<bigint>

Retrieves the interest for a position in the specified market.

Parameters​

NameTypeDescription
marketAddressstringThe address of the Chromatic Market contract.
positionInterestParamThe position parameters.

Returns​

Promise<bigint>

A promise that resolves to the interest.

Defined in​

packages/sdk-ethers-v6/src/entities/ChromaticPosition.ts:152


getInterestRateRecords​

▸ getInterestRateRecords(marketAddress): Promise<RecordStructOutput[]>

Retrieves the interest rate records for the specified market address.

Parameters​

NameTypeDescription
marketAddressstringThe address of the Chromatic Market contract.

Returns​

Promise<RecordStructOutput[]>

A promise that resolves to an array of interest rate records.

Defined in​

packages/sdk-ethers-v6/src/entities/ChromaticPosition.ts:128


getLiquidationPrice​

▸ getLiquidationPrice(marketAddress, entryPrice, position): Promise<{ lossCutPrice: bigint ; profitStopPrice: bigint }>

Calculates the liquidation price for a position in the specified market.

Parameters​

NameTypeDescription
marketAddressstringThe address of the Chromatic Market contract.
entryPricebigintThe entry price of the position.
positionPositionParamThe position parameters.

Returns​

Promise<{ lossCutPrice: bigint ; profitStopPrice: bigint }>

A promise that resolves to an object containing the profit stop price and loss cut price.

Defined in​

packages/sdk-ethers-v6/src/entities/ChromaticPosition.ts:214


getPnl​

▸ getPnl(marketAddress, entryPrice, exitPrice, position, options?): Promise<bigint>

Calculates the profit and loss (PNL) for a position in the specified market.

Parameters​

NameTypeDescription
marketAddressstringThe address of the Chromatic Market contract.
entryPricebigintThe entry price of the position.
exitPricebigintThe exit price of the position.
positionPositionParamThe position parameters.
optionsObjectOptional parameters for PNL calculation.
options.includeInterestboolean-

Returns​

Promise<bigint>

A promise that resolves to the PNL value.

Defined in​

packages/sdk-ethers-v6/src/entities/ChromaticPosition.ts:191


getPositions​

▸ getPositions(marketAddress, positionIds): Promise<IPosition[]>

Retrieves positions from the Chromatic Market contract.

Parameters​

NameTypeDescription
marketAddressstringThe address of the Chromatic Market contract.
positionIdsBigNumberish[]An array of position IDs.

Returns​

Promise<IPosition[]>

A promise that resolves to an array of positions.

Defined in​

packages/sdk-ethers-v6/src/entities/ChromaticPosition.ts:95


lossCutPrice​

▸ lossCutPrice(marketAddress, entryPrice, position): Promise<bigint>

Calculates the loss cut price for a position in the specified market.

Parameters​

NameTypeDescription
marketAddressstringThe address of the Chromatic Market contract.
entryPricebigintThe entry price of the position.
positionPositionParamThe position parameters.

Returns​

Promise<bigint>

A promise that resolves to the loss cut price.

Defined in​

packages/sdk-ethers-v6/src/entities/ChromaticPosition.ts:270


profitStopPrice​

▸ profitStopPrice(marketAddress, entryPrice, position): Promise<bigint>

Calculates the profit stop price for a position in the specified market.

Parameters​

NameTypeDescription
marketAddressstringThe address of the Chromatic Market contract.
entryPricebigintThe entry price of the position.
positionPositionParamThe position parameters.

Returns​

Promise<bigint>

A promise that resolves to the profit stop price.

Defined in​

packages/sdk-ethers-v6/src/entities/ChromaticPosition.ts:253