econia-labs / econia

Hyper-parallelized on-chain order book for the Aptos blockchain

Home Page:https://econia.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider assorted market configuration modifications/trade-offs

alnoki opened this issue · comments

commented

Per discussions with @bogberry and @elliottdehn in #396

This issue aims to capture trade-offs associated with assorted approaches, rather than selecting any one approach definitively

Background

Presently, Econia configures markets based on lot size, tick size, min size, with prices defined at ticks per lot.

For spot markets, a market is uniquely identified by its trading pair and market parameter tuple, such that multiple markets can be registered per trading pair.

This presents an unintuitive experience for users, who might wish that there were only one "official" market, where parameters are defined based on market prices (such as on a CEX). Econia, rather than enabling a central authority to dictate parameters, allows permissionless market registration with any unique parameter set that is not already registered, and thus provides a recognized market registry for governance votes to recognize certain parameters for a giving trading pair.

Prices are in 32 bits due to limitations enforced by the AVL queue, and are represented in ticks per lot.

DoS Mitigation

Min size mitigates the DoS vector of lots of tiny orders on the book.

Tick size mitigates adversarial dynamics where someone places an order at price 15.00, someone places one at 15.000000001 just to get ahead in the priority queue, etc.

Pricing and truncation

To simplify pricing, one potential method is using a fixed point price that converts base subunits to quote subunits, rather than from ticks to lot. This approach is captured in #396 and #72

Enabling such a pricing mechanism could result in truncation, however, and if truncation is to be forbidden in all situations, then prices will have to be checked to ensure that they don't result in truncation for a given market parameter set.

Additionally, if truncation is to be forbidden in all scenarios, including in fees assessed on fills, then it may be necessary to enforce that the combination of lot size/prices/tick size is an integer multiple of 10,000 indivisible subunits: if a trade has 0.01 USDC volume and if fees are defined in terms of basis points, then the minimum increment in a fee would be 0.000001 USDC, a single subunit. Hence in this case, it would have to be enforced that the minimum increment in trade volume is at least 0.01 USDC.

To enforce this, market parameters could be checked upon market registration (for example using the modulo operator %) to see if truncation will result.

Prices could be left in terms of integer ticks per lot, but this might be confusing to integrators.

Prices could be switched to a fixed point, but then certain fixed point prices would be considered invalid based on truncation restrictions.

Market uniqueness and fee configuration

Rather than assessing global fees, markets could define their own maker/taker fees.

Note, however, this would mean that for a given trading pair, lot size, min size, and tick size, there could be multiple markets with different fee tiers.

Similarly, it may be useful for a market registrant to pass a string as market metadata, but this would compound the uniqueness issue as above

Why are you opening a new issue? It's best to keep the discussion in one place.

commented

This issue is related to more than just price representations, and I'd like to provide a summary of the assorted trade-off spectra that we are operation on