Skip to main content

Class: Market

The Market class focuses on a Mangrove market. On-chain, markets are implemented as two offer lists, one for asks (base,quote), the other for bids (quote,base).

Market initialization needs to store the network name, so you cannot directly use the constructor. Instead of new Market(...), do await Market.connect(...).

See

connect

Properties​

mgv​

β€’ mgv: Mangrove

Defined in​

@mangrovedao/mangrove.js/src/market.ts:505


base​

β€’ base: Token

Defined in​

@mangrovedao/mangrove.js/src/market.ts:506


quote​

β€’ quote: Token

Defined in​

@mangrovedao/mangrove.js/src/market.ts:507


tickSpacing​

β€’ tickSpacing: number

Defined in​

@mangrovedao/mangrove.js/src/market.ts:508


olKeyBaseQuote​

β€’ olKeyBaseQuote: OLKeyStruct

The OLKey for the base, quote offer list

Defined in​

@mangrovedao/mangrove.js/src/market.ts:510


olKeyQuoteBase​

β€’ olKeyQuoteBase: OLKeyStruct

The OLKey for the quote, base offer list

Defined in​

@mangrovedao/mangrove.js/src/market.ts:512


trade​

β€’ trade: Trade

Defined in​

@mangrovedao/mangrove.js/src/market.ts:517


tradeEventManagement​

β€’ tradeEventManagement: TradeEventManagement

Defined in​

@mangrovedao/mangrove.js/src/market.ts:518


prettyP​

β€’ prettyP: PrettyPrint

Defined in​

@mangrovedao/mangrove.js/src/market.ts:519


minVolumeAsk​

β€’ Optional minVolumeAsk: Big

Defined in​

@mangrovedao/mangrove.js/src/market.ts:524


minVolumeBid​

β€’ Optional minVolumeBid: Big

Defined in​

@mangrovedao/mangrove.js/src/market.ts:525

Methods​

connect​

β–Έ connect(params): Promise<Market>

Connect to a market.

Parameters​

NameTypeDescription
params{ mgv: Mangrove } & Key & Partial<OptionalParams>A set of parameters identifying the market on Mangrove to connect to.

Returns​

Promise<Market>

A promise that resolves to a Market instance.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:532


close​

β–Έ close(): void

Close a Market instance.

Returns​

void

Defined in​

@mangrovedao/mangrove.js/src/market.ts:611


initialize​

β–Έ initialize(): Promise<void>

Initialize the market.

Returns​

Promise<void>

Defined in​

@mangrovedao/mangrove.js/src/market.ts:627


getOLKey​

β–Έ getOLKey(ba): OLKeyStruct

Get the configuration of the specified offer list of the market.

Parameters​

NameTypeDescription
baBAbids or asks

Returns​

OLKeyStruct

The configuration of the specified offer list of the market.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:692


getBook​

β–Έ getBook(): Book

Return the two semibooks of this market.

Asks are standing offers to sell base and buy quote. Bids are standing offers to buy base and sell quote. All prices are in quote/base, all volumes are in base. Offers are ordered from best to worse from the taker perspective.

Returns​

Book

Defined in​

@mangrovedao/mangrove.js/src/market.ts:734


getSemibook​

β–Έ getSemibook(ba): Semibook

Return the bids or asks semibook.

Parameters​

NameType
baBA

Returns​

Semibook

Defined in​

@mangrovedao/mangrove.js/src/market.ts:747


requestBook​

β–Έ requestBook(opts?): Promise<{ asks: Offer[] ; bids: Offer[] }>

Return the asks and bids semibook.

Parameters​

NameTypeDefault valueDescription
optsBookOptionsbookOptsDefaultOptions to filter the offers in the book.

Returns​

Promise<{ asks: Offer[] ; bids: Offer[] }>

The asks and bids semibooks, with the offers that match the options.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:759


spread​

β–Έ spread(): Promise<{ absoluteSpread: undefined ; relativeSpread: undefined ; tickSpread: undefined } | { absoluteSpread: Big ; relativeSpread: Big ; tickSpread: number }>

Gets the absolute, relative, and tick spread between bids and asks on the market.

Returns​

Promise<{ absoluteSpread: undefined ; relativeSpread: undefined ; tickSpread: undefined } | { absoluteSpread: Big ; relativeSpread: Big ; tickSpread: number }>

Defined in​

@mangrovedao/mangrove.js/src/market.ts:776


spread​

β–Έ spread(market, bestAsk?, bestBid?): { absoluteSpread: undefined ; relativeSpread: undefined ; tickSpread: undefined } | { absoluteSpread: Big ; relativeSpread: Big ; tickSpread: number }

Gets the absolute, relative, and tick spread between a bid and an ask on the market.

Parameters​

NameType
marketKeyResolvedForCalculation
bestAsk?Object
bestAsk.priceBigSource
bestAsk.ticknumber
bestBid?Object
bestBid.priceBigSource
bestBid.ticknumber

Returns​

{ absoluteSpread: undefined ; relativeSpread: undefined ; tickSpread: undefined } | { absoluteSpread: Big ; relativeSpread: Big ; tickSpread: number }

Defined in​

@mangrovedao/mangrove.js/src/market.ts:788


isActive​

β–Έ isActive(): boolean

Is the market active?

Returns​

boolean

Whether the market is active, i.e., whether both the asks and bids semibooks are active.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:813


isLive​

β–Έ isLive(ba, offerId): Promise<boolean>

Is the offer corresponding to the given offerId in the book ba live?

Parameters​

NameTypeDescription
baBABids or asks.
offerIdnumberAn offer id to check.

Returns​

Promise<boolean>

True, if a corresponding live offer was found, else false.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:824


isLiveOffer​

β–Έ isLiveOffer(offer): boolean

Is the offer live?

Parameters​

NameTypeDescription
offerOfferAn offer to check.

Returns​

boolean

True, if the offer is live, else false.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:834


getOfferProvision​

β–Έ getOfferProvision(ba, gasreq, gasprice?): Promise<Big>

Gets the amount of ethers necessary to provision an offer on the market.

Parameters​

NameTypeDescription
baBAbids or asks
gasreqnumbergas required for the offer execution.
gasprice?numbergas price to use for the calculation. If undefined, then Mangrove's current gas price is used.

Returns​

Promise<Big>

the amount of ethers necessary to provision the offer.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:844


getBidProvision​

β–Έ getBidProvision(gasreq, gasprice?): Promise<Big>

Gets the amount of ethers necessary to provision a bid on the market.

Parameters​

NameTypeDescription
gasreqnumbergas required for the offer execution.
gasprice?numbergas price to use for the calculation. If undefined, then Mangrove's current gas price is used.

Returns​

Promise<Big>

the amount of ethers necessary to provision the offer.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:864


getAskProvision​

β–Έ getAskProvision(gasreq, gasprice?): Promise<Big>

Gets the amount of ethers necessary to provision a bid on the market.

Parameters​

NameTypeDescription
gasreqnumbergas required for the offer execution.
gasprice?numbergas price to use for the calculation. If undefined, then Mangrove's current gas price is used.

Returns​

Promise<Big>

the amount of ethers necessary to provision the offer.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:873


getMissingProvision​

β–Έ getMissingProvision(ba, lockedProvision, gasreq, gasprice?): Promise<Big>

Gets the missing provision in ethers for an offer with the given parameters

Parameters​

NameTypeDescription
baBAbids or asks
lockedProvisionBigSourcethe provision already locked with the offer
gasreqnumbergas required for the offer execution.
gasprice?numbergas price to use for the calculation. If undefined, then Mangrove's current gas price is used.

Returns​

Promise<Big>

the additional required provision, in ethers.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:884


bidInfo​

β–Έ bidInfo(offerId): Promise<Offer>

Returns the offer info for the given offerId in the bids offer list.

Parameters​

NameTypeDescription
offerIdnumberid of the offer to get info for.

Returns​

Promise<Offer>

the offer info for the given offerId.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:906


askInfo​

β–Έ askInfo(offerId): Promise<Offer>

Returns the offer info for the given offerId in the asks offer list.

Parameters​

NameTypeDescription
offerIdnumberid of the offer to get info for.

Returns​

Promise<Offer>

the offer info for the given offerId.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:915


offerInfo​

β–Έ offerInfo(ba, offerId): Promise<Offer>

Returns struct containing offer details in the current market state.

Parameters​

NameTypeDescription
baBAbids or asks
offerIdnumberid of the offer to get info for.

Returns​

Promise<Offer>

the offer info for the given offerId.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:924


permit​

β–Έ permit(action, data): Promise<ContractTransaction>

Sign permit data. If action="buy", will permit buying base with spender's quote token. If action="sell", will permit buying quote with spender's base token.

Parameters​

NameTypeDescription
action"buy" | "sell""buy" or "sell"
dataOmit<SimplePermitData, "outbound_tkn" | "inbound_tkn">permit data

Returns​

Promise<ContractTransaction>

a promise that resolves to the permit signature.

See

Mangrove.permit

Defined in​

@mangrovedao/mangrove.js/src/market.ts:937


buy​

β–Έ buy(params, overrides?): Promise<Transaction<OrderResult>>

Market buy order. Will attempt to buy base token using quote tokens.

Parameters​

NameTypeDescription
paramsTradeParamsTrade parameters - see Market.TradeParams.
overridesOverridesethers overrides for the transaction.

Returns​

Promise<Transaction<OrderResult>>

a promise that resolves to the transaction response and the result of the trade.

Remarks

Will stop if

  • book is empty, or
  • price no longer good, or
  • wants tokens have been bought.

Example

const market = await mgv.market({base:"USDC",quote:"DAI"};
market.buy({volume: 100, price: '1.01'}) //use strings to be exact

Defined in​

@mangrovedao/mangrove.js/src/market.ts:979


sell​

β–Έ sell(params, overrides?): Promise<Transaction<OrderResult>>

Market sell order. Will attempt to sell base token for quote tokens.

Parameters​

NameTypeDescription
paramsTradeParamsTrade parameters - see Market.TradeParams.
overridesOverridesethers overrides for the transaction.

Returns​

Promise<Transaction<OrderResult>>

a promise that resolves to the transaction response and the result of the trade.

Remarks

Will stop if

  • book is empty, or
  • price no longer good, or -gives tokens have been sold.

Example

const market = await mgv.market({base:"USDC",quote:"DAI"})
market.sell({volume: 100, price: 1})

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1006


gasEstimateBuy​

β–Έ gasEstimateBuy(params): Promise<BigNumber>

Estimate amount of gas for a buy order corresponding to the given trade parameters.

Parameters​

NameTypeDescription
paramsTradeParamsTrade parameters.

Returns​

Promise<BigNumber>

a gas estimate for the trade.

See

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1019


gasEstimateSell​

β–Έ gasEstimateSell(params): Promise<BigNumber>

Estimate amount of gas for a sell order corresponding to the given trade parameters.

Parameters​

NameTypeDescription
paramsTradeParamsTrade parameters.

Returns​

Promise<BigNumber>

a gas estimate for the trade.

See

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1030


updateRestingOrder​

β–Έ updateRestingOrder(ba, params, overrides?): Promise<Transaction<void>>

Update a resting order posted by MangroveOrder.

Parameters​

NameTypeDescription
baBAwhether the offer is a bid or ask
paramsUpdateRestingOrderParamsupdate parameters - see Market.UpdateRestingOrderParams
overridesOverridesoverrides for the transaction

Returns​

Promise<Transaction<void>>

a promise that resolves to the transaction response and the result of the update.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1042


retractRestingOrder​

β–Έ retractRestingOrder(ba, id, deprovision?, overrides?): Promise<Transaction<void>>

Retract a resting order posted by MangroveOrder.

Parameters​

NameTypeDefault valueDescription
baBAundefinedwhether the offer is a bid or ask
idnumberundefinedthe offer id
deprovisionbooleanfalsewhether to deprovision the offer. If true, the offer's provision will be returned to the maker's balance on Mangrove.
overridesOverrides{}overrides for the transaction

Returns​

Promise<Transaction<void>>

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1057


clean​

β–Έ clean(params, overrides?): Promise<{ result: Promise<CleanResult> ; response: Promise<ContractTransaction> }>

Clean a set of given offers.

Parameters​

NameTypeDescription
paramsCleanParamsParameters for the cleaning, specifying the target offers, the side of the market to clean, and optionally the taker to impersonate.
overridesOverridesethers overrides for the transaction.

Returns​

Promise<{ result: Promise<CleanResult> ; response: Promise<ContractTransaction> }>

a promise that resolves to the transasction response and the result of the cleaning.

See

Market.CleanParams for a description of params.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1074


getRawCleanParams​

β–Έ getRawCleanParams(params): Promise<RawCleanParams>

Gets parameters to send to function market.mgv.cleanerContract.cleanByImpersonation.

Parameters​

NameTypeDescription
paramsCleanParamsParameters for the cleaning, specifying the target offers, the side of the market to clean, and optionally the taker to impersonate

Returns​

Promise<RawCleanParams>

a promise that resolves to the raw parameters to send to the cleaner contract

Remarks

In more detail, the parameters should be an object with the following fields: targets: an array of offerId: the offer to be cleaned takerWants: the amount of base token (for asks) or quote token (for bids) the taker wants tick: the of the offer to be cleaned gasreq: the maximum gasreq the taker/cleaner, wants to use to clean the offer, has to be at least the same as the gasreq of the offer in order for it be cleaned ba: whether to clean asks or bids taker: specifies what taker to impersonate, if not specified, the caller of the function will be used

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1102


estimateGas​

β–Έ estimateGas(bs, volume): Promise<BigNumber>

Estimate amount of gas for a buy or sell order for the given volume.

Parameters​

NameTypeDescription
bsBSbuy or sell
volumeBigNumbervolume to trade

Returns​

Promise<BigNumber>

an estimate of the gas required for the trade

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1114


simulateGas​

β–Έ simulateGas(ba, maxTick, fillVolume, fillWants): Promise<BigNumber>

Uses Semibook.simulateMarketOrder to simulate the gas required for a market order. An overhead of 50% is added to account for changes to the book and failing offers.

Parameters​

NameTypeDescription
baBAbids or asks
maxTicknumberthe maximum to reach for the market order.
fillVolumeBigNumberthe amount to fill (wants or gives)
fillWantsbooleanwhether to fill wants or gives

Returns​

Promise<BigNumber>

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1141


estimateVolume​

β–Έ estimateVolume(params): Promise<VolumeEstimate>

Volume estimation for buying or selling:

If you say estimateVolume({given:100,what:"base",to:"buy"}),

an estimate of how much quote token you would have to spend to get 100 base tokens will be returned.

If you say estimateVolume({given:10,what:"quote",to:"sell"}),

an estimate of how much base tokens you'd have to buy in order to spend 10 quote tokens will be returned.

Parameters​

NameTypeDescription
paramsVolumeParamsParameters for the volume estimation - see Market.VolumeParams

Returns​

Promise<VolumeEstimate>

a promise that resolves to the volume estimation.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1181


estimateVolumeToReceive​

β–Έ estimateVolumeToReceive(params): Promise<VolumeEstimate>

Convenience method: Estimate volume to be received given an amount of base/quote you are ready to spend.

Parameters​

NameTypeDescription
paramsDirectionlessVolumeParamsParameters for the volume estimation - see Market.DirectionlessVolumeParams

Returns​

Promise<VolumeEstimate>

a promise that resolves to the volume estimation.

See

estimateVolume

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1201


estimateVolumeToSpend​

β–Έ estimateVolumeToSpend(params): Promise<VolumeEstimate>

Convenience method: Estimate volume to be spent given an amount of base/quote you want to receive.

Parameters​

NameTypeDescription
paramsDirectionlessVolumeParamsParameters for the volume estimation - see Market.DirectionlessVolumeParams

Returns​

Promise<VolumeEstimate>

a promise that resolves to the volume estimation.

See

estimateVolume

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1214


config​

β–Έ config(): Object

Return config local to a market.

Returns​

Object

The config for the asks and bids side of the market.

NameType
asksLocalConfig
bidsLocalConfig

Remarks

  • Amounts are converted to plain numbers.
  • density is converted to public token units per gas used
  • fee remains in basis points of the token being bought

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1230


consoleAsks​

β–Έ consoleAsks(filter?): void

Pretty prints the current state of the asks of the market

Parameters​

NameType
filter?prettyPrintFilter

Returns​

void

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1241


consoleBids​

β–Έ consoleBids(filter?): void

Pretty prints the current state of the bids of the market

Parameters​

NameType
filter?prettyPrintFilter

Returns​

void

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1246


prettyPrint​

β–Έ prettyPrint(ba, filter): void

Pretty prints the current state of the asks or bids of the market

Parameters​

NameType
baBA
filterprettyPrintFilter

Returns​

void

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1251


subscribe​

β–Έ subscribe(cb): void

Subscribe to order book updates.

Parameters​

NameTypeDescription
cbMarketCallback<void>a callback, which gets called whenever the order book is updated.

Returns​

void

Remarks

The first argument of cb, event, is a summary of the event. It has the following properties:

  • type the type of change. May be: "OfferWrite": an offer was inserted or moved in the book. "OfferFail", "OfferSuccess", "OfferRetract": an offer was removed from the book because it failed, succeeded, or was canceled.

  • ba is either "bids" or "asks". The offer concerned by the change is either an ask (an offer for base asking for quote) or a bid (an offer for quoteasking forbase`).

  • offer is information about the offer, see type Offer.

  • taker, takerWants, takerGives (for "OfferFail" and "OfferSuccess" only): address of the taker who executed the offer as well as the volumes that were requested by the taker.

  • mgvData : extra data from mangrove and the maker contract. See the Mangrove contracts documentation for the list of possible status codes.

opts may specify the maximum of offers to read initially, and the chunk size used when querying the reader contract (always ran locally).

Example

const market = await mgv.market({base:"USDC",quote:"DAI"}
market.subscribe((event,utils) => console.log(event.type, utils.book()))

Note

Only one subscription may be active at a time.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1295


once​

β–Έ once<T>(cb, filter?): Promise<T>

Returns a promise which is fulfilled after execution of the callback.

Type parameters​

Name
T

Parameters​

NameType
cbMarketCallback<T>
filter?MarketFilter

Returns​

Promise<T>

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1302


unsubscribe​

β–Έ unsubscribe(cb): void

Stop calling a user-provided callback function on book-related events.

Parameters​

NameType
cbStorableMarketCallback

Returns​

void

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1316


getOutboundInbound​

β–Έ getOutboundInbound(ba): Object

Determine which token will be Mangrove's outbound/inbound depending on whether you're working with bids or asks.

Parameters​

NameTypeDescription
baBAbids or asks

Returns​

Object

the outbound and inbound tokens.

NameType
outbound_tknToken
inbound_tknToken

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1324


getOutboundInbound​

β–Έ getOutboundInbound<T>(ba, base, quote): Object

Determine which token will be Mangrove's outbound/inbound depending on whether you're working with bids or asks.

Type parameters​

Name
T

Parameters​

NameTypeDescription
baBAbids or asks
baseTbase token
quoteTquote token

Returns​

Object

the outbound and inbound tokens.

NameType
outbound_tknT
inbound_tknT

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1337


getBaseQuoteVolumes​

β–Έ getBaseQuoteVolumes(ba, gives, wants): Object

Determine whether gives or wants will be baseVolume/quoteVolume depending on whether you're working with bids or asks.

Parameters​

NameTypeDescription
baBAbids or asks
givesBigamount of token to give
wantsBigamount of token to receive

Returns​

Object

the base and quote volumes.

NameType
baseVolumeBig
quoteVolumeBig

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1357


getWantsForPrice​

β–Έ getWantsForPrice(ba, gives, price): Big

Determine the wants from gives and price depending on whether you're working with bids or asks.

Parameters​

NameType
baBA
givesBig
priceBig

Returns​

Big

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1369


getGivesForPrice​

β–Έ getGivesForPrice(ba, wants, price): Big

Determine the gives from wants and price depending on whether you're working with bids or asks.

Parameters​

NameType
baBA
wantsBig
priceBig

Returns​

Big

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1374


getGivesWantsForVolumeAtPrice​

β–Έ getGivesWantsForVolumeAtPrice(ba, volume, price): Object

Determine gives and wants from a volume (in base) and a price depending on whether you're working with bids or asks.

Parameters​

NameTypeDescription
baBAbids or asks
volumeBigvolume of the offer
priceBigprice of the offer

Returns​

Object

the gives and wants

NameType
givesBig
wantsBig

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1384


getDisplayDecimalsForPriceDifferences​

β–Έ getDisplayDecimalsForPriceDifferences(): number

Determine the first decimal place where the smallest price difference between neighboring offers in the order book cache is visible.

Returns​

number

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1398


getDisplayDecimalsForPriceDifferences​

β–Έ getDisplayDecimalsForPriceDifferences(offers): number

Determine the first decimal place where the smallest price difference between neighboring offers is visible.

Parameters​

NameTypeDescription
offersOffer[]offers to consider

Returns​

number

the first decimal place where the smallest price difference between neighboring offers is visible.

Defined in​

@mangrovedao/mangrove.js/src/market.ts:1410

  • Properties
    • mgv
    • base
    • quote
    • tickSpacing
    • olKeyBaseQuote
    • olKeyQuoteBase
    • trade
    • tradeEventManagement
    • prettyP
    • minVolumeAsk
    • minVolumeBid
  • Methods
    • connect
    • close
    • initialize
    • getOLKey
    • getBook
    • getSemibook
    • requestBook
    • spread
    • spread
    • isActive
    • isLive
    • isLiveOffer
    • getOfferProvision
    • getBidProvision
    • getAskProvision
    • getMissingProvision
    • bidInfo
    • askInfo
    • offerInfo
    • permit
    • buy
    • sell
    • gasEstimateBuy
    • gasEstimateSell
    • updateRestingOrder
    • retractRestingOrder
    • clean
    • getRawCleanParams
    • estimateGas
    • simulateGas
    • estimateVolume
    • estimateVolumeToReceive
    • estimateVolumeToSpend
    • config
    • consoleAsks
    • consoleBids
    • prettyPrint
    • subscribe
    • once
    • unsubscribe
    • getOutboundInbound
    • getOutboundInbound
    • getBaseQuoteVolumes
    • getWantsForPrice
    • getGivesForPrice
    • getGivesWantsForVolumeAtPrice
    • getDisplayDecimalsForPriceDifferences
    • getDisplayDecimalsForPriceDifferences