Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Princeton University, USA https://sites.google.com/view/virajnadkarni/home viraj@princeton.eduhttps://orcid.org/0000-0003-2637-3676 Princeton University, USA https://www.princeton.edu/~kulkarni/ kulkarni@princeton.eduhttps://orcid.org/0000-0002-5308-5250 Princeton University, USA https://ece.princeton.edu/people/pramod-viswanath pramodv@princeton.eduhttps://orcid.org/0000-0003-3171-8667 \CopyrightAnonymous \ccsdesc[100]Mathematics of computing

Adaptive Curves for Optimally Efficient Market Making

Viraj Nadkarni    Sanjeev Kulkarni    Pramod Viswanath
Abstract

Automated Market Makers (AMMs) are essential in Decentralized Finance (DeFi) as they match liquidity supply with demand. They function through liquidity providers (LPs) who deposit assets into liquidity pools. However, the asset trading prices in these pools often trail behind those in more dynamic, centralized exchanges, leading to potential arbitrage losses for LPs. This issue is tackled by adapting market maker bonding curves to trader behavior, based on the classical market microstructure model of Glosten and Milgrom. Our approach ensures a zero-profit condition for the market maker’s prices. We derive the differential equation that an optimal adaptive curve should follow to minimize arbitrage losses while remaining competitive. Solutions to this optimality equation are obtained for standard Gaussian and Lognormal price models using Kalman filtering. A key feature of our method is its ability to estimate the external market price without relying on price or loss oracles. We also provide an equivalent differential equation for the implied dynamics of canonical static bonding curves and establish conditions for their optimality. Our algorithms demonstrate robustness to changing market conditions and adversarial perturbations, and we offer an on-chain implementation using Uniswap v4 alongside off-chain AI co-processors.

keywords:
Automated market makers, Adaptive, Glosten-Milgrom, Decentralized Finance
category:
\relatedversion

1 Introduction

Market making plays a crucial role in enhancing liquidity in financial systems. In traditional finance, effective market making strategies involve setting buy and sell prices (bid and ask quotes) as narrowly separated as possible, ensuring these quotes closely mirror the asset’s true price on a limit order book. This strategy enables market makers to earn a marginal profit. Such efficacy in market making is driven by sophisticated models that analyze trader behavior [43, 51, 45]. These models have become fundamental in understanding the principles of microeconomics and the microstructure of markets.

Market Makers in DeFi In the field of Decentralized Finance (DeFi), the concept of automated market making has gained prominence. DeFi employs Automated Market Makers (AMMs), particularly Constant Function Market Makers (CFMMs) [59][26], offering an alternative to traditional limit order books. This approach reduces the computational effort needed to facilitate trades and ensures liquidity is available for tokens that are less frequently traded. Unlike conventional markets that primarily utilize limit order books for Peer-to-Peer transactions, decentralized markets implement a Peer-to-Pool-to-Peer structure. In this model, Liquidity Providers (LPs) aggregate their resources in a contract, which traders then utilize to meet their liquidity needs. Thus, any DeFi market needs to incentivize both the LPs and the traders to ensure a fair and efficient market is created.

Market depth and volatility DeFi markets exhibit a range of distinct characteristics, primarily differentiated by market depth (or liquidity) and price volatility. Notably, the trading volume of stablecoins (approximately $11.1 trillion) has recently exceeded the transaction volumes of centralized entities like MasterCard and PayPal [19]. Markets with significant liquidity, especially those trading stablecoins, are highlighted in this context [22]. Such markets typically experience minimal volatility, and their substantial depth minimizes the price impact of retail trades. Conversely, DeFi features hundreds of infrequently traded tokens, which suffer from a lack of liquidity, leading to high volatility and price sensitivity to even small-scale retail trades. These markets are also susceptible to swings in price caused by flash loan transactions [12]. This paper addresses the optimization of market making strategies for the latter (less liquid) kind of markets.

Incentives of LPs A key challenge for Constant Function Market Makers (CFMMs) is motivating Liquidity Providers (LPs) to contribute their tokens to the pool. For this incentive to work, it is crucial for CFMMs to minimize the average losses on pooled assets. Yet, it is widely acknowledged that LPs often incur losses due to fluctuations in reserves [52] and a lack of market insights [57]. This paper concentrates on reducing the losses that stem from such informational deficiencies. Specifically, static curves in CFMMs frequently lead to LP losses as a result of arbitrage activities. These losses are intended to be offset by transaction fees, contrasting with centralized exchanges which benefit from higher liquidity and trading volumes but impose lower fees. For example, Binance, a centralized exchange, records a daily trading volume of approximately $15 billion, significantly higher than Uniswap’s $1.1 billion [6], the largest decentralized exchange. The lower liquidity on platforms like Uniswap results in less current prices, making them more susceptible to arbitrage losses.

Arbitrage Loss The specific type of arbitrage loss known as loss-versus-rebalancing (LVR) can be quantified in certain scenarios [57], and these losses continue to occur despite the implementation of trading fees [55]. In the case of a generic market maker who sets bid and ask prices for a volatile asset, arbitrage losses are defined relative to the asset’s true market price. An arbitrageur engages in a buy transaction when the market price surpasses the ask price, and in a sell transaction when it drops below the bid price. The resultant loss for the market maker is calculated as the product of the price difference and the volume of the asset traded.

Trader behavior In traditional financial systems, arbitrage-related losses are conceptualized as adverse selection costs, which arise from interactions with informed traders—those who are privy to the external market price, akin to arbitrageurs. A market maker achieves optimal operation by balancing these costs against the profits gained from uninformed traders, also known as noise traders. This balancing principle was first delineated by Glosten and Milgrom [43]. Within the Decentralized Finance (DeFi) ecosystem, trading parties are differentiated into toxic and non-toxic order flows, which correspond to informed and uninformed traders, respectively [18, 10]. We extend this model to a more nuanced framework where traders are categorized along a continuous spectrum of information awareness, ranging from highly informed to completely uninformed, rather than being strictly classified as either toxic or non-toxic (Section 3).

CFMMs as prediction markets For CFMMs, a significant portion of their losses also arises from the need to encourage traders to disclose their genuine price perceptions during transactions. In essence, CFMMs provide compensation to informed traders in exchange for their crucial market insights, which mirrors the principles of market scoring rules utilized in prediction markets to extract valuable information [42].

Conditions for optimality A straightforward approach to reduce losses to arbitrage would be aligning the marginal price exactly with the external market price, which would require real-time data from a price oracle [11]. Yet, integrating oracles with market making strategies can lead to potential frontrunning risks [14] and necessitates reliance on centralized, potentially manipulable external entities [39, 13]. To circumvent these issues, our framework explicitly excludes the use of oracles. The objective is to deduce the hidden market price by analyzing trade history data, aiming for maximum efficiency in terms of data utilization. Further, the market maker uses this to adaptively set its bonding curve so that the loss to arbitrageurs is as close to zero as possible, ensuring an optimally efficient market. The market maker turning a profit would be undesirable since this would allow a competitor to undercut its prices and take away their order flow. In other words, it should quote an efficient and competitive market price, given only the information it has in form of the trading history. Keeping this objective in mind, we outline the key contributions of this work.

1.1 Our contributions

Optimal algorithms for adapting curves (Section 4) We provide the differential equation that the demand curve of an optimally efficient market should follow (Theorem 4.1). When the statistics governing trader and price behavior are known and Gaussian/Lognormal, we show that this differential equation can be solved exactly using a dynamic bonding curve that changes its operating point using the Kalman Filter (Theorem 5.1 and Theorem 5.2).

Adapting to unknown market conditions When the statistics governing trader and price behavior are unknown, we extend the previous approach by using an Adaptive Kalman Filter. We empirically show that both these approaches suffer significantly lower arbitrage losses compared to a static CFMM. (Section 5.2)

Robustness to adversarial manipulation In presence of irrational traders that seek to make the price of the market maker deviate from the external market, we present a robust version of the adaptive curve algorithm that tolerates upto 50% of trader population being adversarial. (Section 5.3)

Comparisons with static curves (Section 6) We provide theoretical comparisons of static and the proposed adaptive curve models by showing that the error in the adaptive AMM price, when viewed as an oracle, decays with more trades, while that of a static curve remains unchanged (Theorem 6.1).

Implied dynamics of static curves (Section 6)We derive a differential equation (30) that governs the implied dynamical model given the static CFMM curves that are used in practice. We show that these CFMMs can only be optimally efficient in a model where inter-block time for the underlying blockhchain vanishes, the CFMM has more liquidity than the external market, and that the trader and price behaviour is severely constrained. (Theorem 6.2)

On-chain Implementation We specify the end-to-end system design for our proposed market maker. Furthermore, we provide an implementation of our algorithm using the recently released Uniswap v4 [23] platform and an off-chain machine learning co-processor Axiom [3]. This co-processor provides guarantees that the algorithms derived in this work are executed, and the result is put securely on-chain. (Section 8)

2 Related work

In this section, we reprise relevant literature surrounding the problem formulated in this paper. Although the motivation of the problem stems from literature studying AMMs in DeFi, our formulation derives heavily from classical works in market microstructure. The algorithms that we present in our work derive heavily from literature on control and robust filtering.

Automated Market Makers: Automated Market Makers (AMMs), particularly in the form of Constant Function Market Makers (CFMMs) [66, 59], are designed to incentivize trades that align prices with a more liquid external market [27]. However, this mechanism imposes costs on CFMM liquidity providers while generating profits for arbitrageurs [41, 47, 62]. This arbitrage profit, often quantified as "loss-versus-rebalancing" in scenarios where only arbitrageurs (informed traders) interact with the market maker, is proportional to external price volatility [57]. Various methods have been proposed to capture this loss, including on-chain auctions [53] and the application of auction theory to dynamically recommend ask and bid prices for an AMM [56]. Another recent study [44] suggests an optimal curve for a CFMM based on liquidity providers’ price beliefs. However, this study does not consider a dynamic model where traders react to market maker price settings. In [56], a dynamic trading model is examined, deriving optimal ask and bid prices. Yet, this approach necessitates the market maker’s knowledge of underlying model parameters, limiting adaptability to market conditions. Additionally, while [56] focuses on a monopolistic market maker, our work examines a competitive market maker. Our research aligns closely with [60], which addresses competitive market conditions but only within a liquid, non-volatile market with restricted trade sizes. Reinforcement learning algorithms to adapt CFMM bonding curves have been explored in [34], though the primary objectives there are fee revenue control and minimization of failed trades.

Optimal market making: The trader behavior model we employ is derived from the Glosten-Milgrom model [43], which is widely used in market microstructure literature. However, we modify it to incorporate a continuously changing external price. Several subsequent studies [35, 36] develop optimal market-making rules within a modified Glosten-Milgrom framework, but they assume that the underlying model parameters are known and that external price changes are communicated to the market maker. A more data-driven reinforcement learning approach is taken in [32], but their reward function presupposes direct information about the external hidden price, whereas we assume no access to a price oracle. Another aspect of optimal market making in traditional market microstructure literature focuses on inventory management [48, 31], rather than the information asymmetry between traders and market makers. Our goal is to design a market maker that mitigates losses due to information asymmetry, similar to the Glosten-Milgrom model, without imposing inventory constraints. The Glosten-Milgrom model has been considered for AMMs in DeFi, though only for individual trades [29, 28].

Optimal filtering and control: The classical filtering and control literature underpins many contemporary automated systems, offering theoretical foundations and practical applications for dynamic system regulation. Kalman filtering, a robust statistical method, is widely used for estimating the state of a linear dynamic system from incomplete and noisy measurements [49]. This technique combines real-time measurements with prior estimates to produce updated predictions, proving crucial for systems requiring high accuracy and responsiveness, such as navigation systems, aerospace engineering, and automated trading. In control theory, concepts like optimal control and feedback mechanisms are fundamental for designing systems that maintain desired output levels despite external condition changes. These principles have been extensively explored in works such as [65], and further developed through modern control theories addressing non-linearities and uncertainties in system dynamics [67]. The integration of filtering and control methodologies has led to the development of Adaptive Kalman Filtering [54], which adjusts its parameters based on observed errors, enhancing performance in varying conditions. Adaptive Kalman Filtering has seen applications in diverse areas, including robotics [63], automotive systems [46], and finance [38], illustrating its versatility and robustness in handling dynamic, uncertain environments.

3 Preliminaries and model

We now describe the framework used for modeling trader behavior in response to the evolution of an external price process, that is hidden from the market maker, and the prices set by the market maker. We also state the objective that the market maker seeks to optimize, and provide the motivation behind it. The model and the objective are based on the canonical Glosten-Milgrom model [43] studied extensively in market microstructure literature. We assume that the market maker has access to an inventory of the asset and numeraire. The price of the asset is expressed in terms of the numeraire. We assume that time is discrete and indexed by t𝑡titalic_t.

External price process: The external price process pexttsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡p_{ext}^{t}italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT of a risky asset is assumed to follow a discrete time random walk, where the distribution of a price jump at any t𝑡titalic_t is parametrized by σ𝜎\sigmaitalic_σ. That is, we have

pextt+1superscriptsubscript𝑝𝑒𝑥𝑡𝑡1\displaystyle p_{ext}^{t+1}italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t + 1 end_POSTSUPERSCRIPT =pextt+Δpexttabsentsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡Δsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡\displaystyle=p_{ext}^{t}+\Delta p_{ext}^{t}= italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT + roman_Δ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT (1)

where ΔpexttΔsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡\Delta p_{ext}^{t}roman_Δ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT is i.i.d. 𝒟σ,pexttsimilar-toabsentsubscript𝒟𝜎superscriptsubscript𝑝𝑒𝑥𝑡𝑡\sim\mathcal{D}_{\sigma,p_{ext}^{t}}∼ caligraphic_D start_POSTSUBSCRIPT italic_σ , italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUBSCRIPT. Intuitively, the parameter σ𝜎\sigmaitalic_σ can be thought of as a measure of volatility of the external price. Further, the random process pexttsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡p_{ext}^{t}italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT can either represent the price of the asset in a larger and much more liquid exchange, or some underlying “true” value of the asset. In both cases, we assume that it is hidden from the market maker. To put it in DeFi terms, the market maker does not have an access to any “price oracle” that can tell it information about this external price.

Market Maker: The market maker consists of a pool containing an asset and a numeraire. It then publishes a demand curve gt(p)subscript𝑔𝑡𝑝g_{t}(p)italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) [56] before each trade. All traders have full access to the demand curve at any time. The demand curve specifies how the price of the asset changes based on the inventory available. In particular, g(p0t)𝑔superscriptsubscript𝑝0𝑡g(p_{0}^{t})italic_g ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) specifies the amount of asset when the initial operating point of the demand curve is p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. That is, the price of an infinitesimal amount dx𝑑𝑥dxitalic_d italic_x of asset is p0tdxsuperscriptsubscript𝑝0𝑡𝑑𝑥p_{0}^{t}dxitalic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT italic_d italic_x. The amount of numeraire in the inventory at the same operating point is 0p0tp𝑑g(p)superscriptsubscript0superscriptsubscript𝑝0𝑡𝑝differential-d𝑔𝑝-\int_{0}^{p_{0}^{t}}pdg(p)- ∫ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT italic_p italic_d italic_g ( italic_p ). For an incentive compatible market maker, we constrain g(.)g(.)italic_g ( . ) to be non-increasing (Proposition 2.1 in [56]). Equivalently, the market maker may be represented by the canonical bonding curve ϕt(x,y)subscriptitalic-ϕ𝑡𝑥𝑦\phi_{t}(x,y)italic_ϕ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_x , italic_y ) [66] which is a function (of reserves x,y𝑥𝑦x,yitalic_x , italic_y of the asset, numeraire respectively) that stays constant over any single trade.

Trader behavior: We assume that a trader appears at every time step t𝑡titalic_t, and sees a noisy version of the external price in each time step, denoted by ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT, with the noise distribution being parametrized by η𝜂\etaitalic_η.

ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡\displaystyle p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT =pextt+Δptradtabsentsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡Δsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡\displaystyle=p_{ext}^{t}+\Delta p_{trad}^{t}= italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT + roman_Δ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT (2)

where ΔptradtΔsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡\Delta p_{trad}^{t}roman_Δ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT is i.i.d. noise 𝒟η,pexttsimilar-toabsentsubscript𝒟𝜂superscriptsubscript𝑝𝑒𝑥𝑡𝑡\sim\mathcal{D}_{\eta,p_{ext}^{t}}∼ caligraphic_D start_POSTSUBSCRIPT italic_η , italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUBSCRIPT sampled at each time step. Intuitively, the parameter η𝜂\etaitalic_η can be construed as measuring the level of “toxicity” or informed nature of the traders.

Trade actions: As mentioned before, the market maker publishes a demand curve gt(p)subscript𝑔𝑡𝑝g_{t}(p)italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) at each time step. The trader performs a trade that brings the operating point of the demand curve from p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT to ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. Thus, the trader behaves as if it is performing arbitrage between a market with price ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT and the demand curve published. For instance, if the operating point p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT of the market maker is less than the trader price ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT, then a trader would buy asset from the market maker to sell on the external market until the operating point shifts to ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT.

Objective: Our objective is to design an algorithm to set ask and bid prices for the market maker, such that the expected loss with respect to the external market is minimized and the market maker stays competitive. Taking inspiration from [43], but extending to the modified trader behaviour, we get the following condition

ptsuperscript𝑝𝑡\displaystyle p^{t}italic_p start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT =E[pextt|t1,ptradt]ptradtabsent𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1subscriptsuperscript𝑝𝑡𝑡𝑟𝑎𝑑for-allsubscriptsuperscript𝑝𝑡𝑡𝑟𝑎𝑑\displaystyle=E[p_{ext}^{t}|\mathcal{H}_{t-1},p^{t}_{trad}]\ \ \ \ \forall p^{% t}_{trad}= italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_p start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT ] ∀ italic_p start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT (3)

where t1=(ptradτ,gτ(.))τ=0t1\mathcal{H}_{t-1}=\langle(p_{trad}^{\tau},g_{\tau}(.))\rangle_{\tau=0}^{t-1}caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT = ⟨ ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT , italic_g start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT ( . ) ) ⟩ start_POSTSUBSCRIPT italic_τ = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t - 1 end_POSTSUPERSCRIPT is the history of trades and demand curves until time t1𝑡1t-1italic_t - 1, and ptsuperscript𝑝𝑡p^{t}italic_p start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT is the net price of the trade (the ratio of change in the reserves of the numeraire with the change in the reserves of the asset).

Interpreting the objective: Setting the prices as per the above objective makes the expected loss of the market makers to traders vanish, since

E[(pexttpt)|t1]=0𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡superscript𝑝𝑡subscript𝑡10\displaystyle E[(p_{ext}^{t}-p^{t})|\mathcal{H}_{t-1}]=0italic_E [ ( italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_p start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] = 0 (4)

Note that the expression above quantifies the expected loss for per unit trade of the asset.

The market maker can obtain a strictly positive profit by choosing a curve with slightly higher prices (than the ones obtained in (3)) on the ask side or slightly lower prices on the bid side (in other words, by choosing a CFMM with a higher curvature [28]). However, doing this would make it less competitive, since any other market maker with slightly greater bid or a slightly lesser ask would offer a better price and take away the trade volume. Although we do not explicitly model other market makers, their presence is implicit in setting prices according to (3). This equation represents the ideal conditions for capital efficiency, where both the trader gets the best price possible while the market maker avoids a loss.

Also, note that the market maker incurs a loss in every trade made by an perfectly informed trader. Thus, to make the expected loss vanish, it should learn to set prices so that the loss to more informed traders is balanced by the profit obtained from less informed traders. The equation (3) can also be interpreted as striking this balance.

4 Differential Equation for the optimal curve

As mentioned in Section 3, we make use of the general demand curve formulation for market makers. Assume that the amount of asset in reserves at any price p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT is gt(p0t)subscript𝑔𝑡superscriptsubscript𝑝0𝑡g_{t}(p_{0}^{t})italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ), while the amount of numeraire is 0p0tp𝑑gt(p)superscriptsubscript0superscriptsubscript𝑝0𝑡𝑝differential-dsubscript𝑔𝑡𝑝-\int_{0}^{p_{0}^{t}}pdg_{t}(p)- ∫ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT italic_p italic_d italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ), where the function gtsubscript𝑔𝑡g_{t}italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT needs to be non-increasing for the AMM to be incentive compatible [56]. Here, p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT is the initial operating point of the AMM at the beginning of the time slot t𝑡titalic_t. Let ft(p)subscript𝑓𝑡𝑝f_{t}(p)italic_f start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) be the belief (probability distribution function) of the AMM over the price p𝑝pitalic_p of the asset at time t𝑡titalic_t. Let fη(p)subscript𝑓𝜂𝑝f_{\eta}(p)italic_f start_POSTSUBSCRIPT italic_η end_POSTSUBSCRIPT ( italic_p ) be the distribution of noise through which the price is observed by the traders. Let ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT be the price that the trader observes. Then, the trader would make a trade with the AMM such that the marginal price of the asset just after the trade is ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. We now solve the optimal market conditions given by (3).

In this case, the effective price of a trade at time t𝑡titalic_t is given by

ptsuperscript𝑝𝑡\displaystyle p^{t}italic_p start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT =p0tptradtp𝑑gt(p)gt(p0t)gt(ptradt),absentsuperscriptsubscriptsuperscriptsubscript𝑝0𝑡superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝differential-dsubscript𝑔𝑡𝑝subscript𝑔𝑡superscriptsubscript𝑝0𝑡subscript𝑔𝑡superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡\displaystyle=\frac{-\int_{p_{0}^{t}}^{p_{trad}^{t}}pdg_{t}(p)}{g_{t}(p_{0}^{t% })-g_{t}(p_{trad}^{t})},= divide start_ARG - ∫ start_POSTSUBSCRIPT italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT italic_p italic_d italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) end_ARG start_ARG italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) - italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) end_ARG , (5)

where p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT is the operating point of the AMM just before the trade. Further, by definition of conditional expectation of the external market price, we also have

E[pextt|t1,ptradt]𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1subscriptsuperscript𝑝𝑡𝑡𝑟𝑎𝑑\displaystyle E[p_{ext}^{t}|\mathcal{H}_{t-1},p^{t}_{trad}]italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_p start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT ] =0pfη(ptradtp)ft(p)𝑑p0fη(ptradtp)ft(p)𝑑p.absentsuperscriptsubscript0𝑝subscript𝑓𝜂superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝subscript𝑓𝑡𝑝differential-d𝑝superscriptsubscript0subscript𝑓𝜂superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝subscript𝑓𝑡𝑝differential-d𝑝\displaystyle=\frac{\int_{0}^{\infty}pf_{\eta}(p_{trad}^{t}-p)f_{t}(p)dp}{\int% _{0}^{\infty}f_{\eta}(p_{trad}^{t}-p)f_{t}(p)dp}.= divide start_ARG ∫ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT italic_p italic_f start_POSTSUBSCRIPT italic_η end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_p ) italic_f start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) italic_d italic_p end_ARG start_ARG ∫ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_η end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_p ) italic_f start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) italic_d italic_p end_ARG . (6)

since the noise at time t𝑡titalic_t is independent of the external price at time t𝑡titalic_t. Substituting (6) and (5) in (3) gives us

p0tptradtp𝑑gt(p)gt(p0t)gt(ptradt)superscriptsubscriptsuperscriptsubscript𝑝0𝑡superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝differential-dsubscript𝑔𝑡𝑝subscript𝑔𝑡superscriptsubscript𝑝0𝑡subscript𝑔𝑡superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡\displaystyle\frac{-\int_{p_{0}^{t}}^{p_{trad}^{t}}pdg_{t}(p)}{g_{t}(p_{0}^{t}% )-g_{t}(p_{trad}^{t})}divide start_ARG - ∫ start_POSTSUBSCRIPT italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT italic_p italic_d italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) end_ARG start_ARG italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) - italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) end_ARG =0pfη(ptradtp)ft(p)𝑑p0fη(ptradtp)ft(p)𝑑pptradtabsentsuperscriptsubscript0𝑝subscript𝑓𝜂superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝subscript𝑓𝑡𝑝differential-d𝑝superscriptsubscript0subscript𝑓𝜂superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝subscript𝑓𝑡𝑝differential-d𝑝for-allsubscriptsuperscript𝑝𝑡𝑡𝑟𝑎𝑑\displaystyle=\frac{\int_{0}^{\infty}pf_{\eta}(p_{trad}^{t}-p)f_{t}(p)dp}{\int% _{0}^{\infty}f_{\eta}(p_{trad}^{t}-p)f_{t}(p)dp}\ \ \ \ \forall p^{t}_{trad}= divide start_ARG ∫ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT italic_p italic_f start_POSTSUBSCRIPT italic_η end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_p ) italic_f start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) italic_d italic_p end_ARG start_ARG ∫ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_η end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_p ) italic_f start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) italic_d italic_p end_ARG ∀ italic_p start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT (7)

Rearranging gives us

gt(ptradt)=gt(p0t)+p0tptradtpgt(p)𝑑pβ(ptradt)ptradtsubscript𝑔𝑡superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡subscript𝑔𝑡superscriptsubscript𝑝0𝑡superscriptsubscriptsuperscriptsubscript𝑝0𝑡superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝subscriptsuperscript𝑔𝑡𝑝differential-d𝑝𝛽superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡for-allsubscriptsuperscript𝑝𝑡𝑡𝑟𝑎𝑑\displaystyle g_{t}(p_{trad}^{t})=g_{t}(p_{0}^{t})+\frac{\int_{p_{0}^{t}}^{p_{% trad}^{t}}pg^{\prime}_{t}(p)dp}{\beta(p_{trad}^{t})}\ \ \ \ \forall p^{t}_{trad}italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) = italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) + divide start_ARG ∫ start_POSTSUBSCRIPT italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT italic_p italic_g start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) italic_d italic_p end_ARG start_ARG italic_β ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) end_ARG ∀ italic_p start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT (8)

where βt(ptradt)=0pfη(ptradtp)ft(p)𝑑p0fη(ptradtp)ft(p)𝑑psubscript𝛽𝑡superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡superscriptsubscript0𝑝subscript𝑓𝜂superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝subscript𝑓𝑡𝑝differential-d𝑝superscriptsubscript0subscript𝑓𝜂superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝subscript𝑓𝑡𝑝differential-d𝑝\beta_{t}(p_{trad}^{t})=\frac{\int_{0}^{\infty}pf_{\eta}(p_{trad}^{t}-p)f_{t}(% p)dp}{\int_{0}^{\infty}f_{\eta}(p_{trad}^{t}-p)f_{t}(p)dp}italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) = divide start_ARG ∫ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT italic_p italic_f start_POSTSUBSCRIPT italic_η end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_p ) italic_f start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) italic_d italic_p end_ARG start_ARG ∫ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_η end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_p ) italic_f start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) italic_d italic_p end_ARG. On the other hand, if we let ptradtp0tsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡superscriptsubscript𝑝0𝑡p_{trad}^{t}\rightarrow p_{0}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT → italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT in (7), we get

p0tsuperscriptsubscript𝑝0𝑡\displaystyle p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT =βt(p0t)absentsubscript𝛽𝑡superscriptsubscript𝑝0𝑡\displaystyle=\beta_{t}(p_{0}^{t})= italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) (9)

Thus, using (8) and (9), the demand curve of the optimal market maker can be given by the following theorem.

Theorem 4.1.

Let the amounts of asset and numeraire in the reserves of a market maker be x0t,y0tsuperscriptsubscript𝑥0𝑡superscriptsubscript𝑦0𝑡x_{0}^{t},y_{0}^{t}italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT , italic_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. Then, the optimal demand curve gt(p)subscript𝑔𝑡𝑝g_{t}(p)italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) for a market maker obeys the following differential equation

(βt(p)p)gt(p)+βt(p)gt(p)βt(p)x0tsubscript𝛽𝑡𝑝𝑝superscriptsubscript𝑔𝑡𝑝superscriptsubscript𝛽𝑡𝑝subscript𝑔𝑡𝑝superscriptsubscript𝛽𝑡𝑝superscriptsubscript𝑥0𝑡\displaystyle(\beta_{t}(p)-p)g_{t}^{\prime}(p)+\beta_{t}^{\prime}(p)g_{t}(p)-% \beta_{t}^{\prime}(p)x_{0}^{t}( italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) - italic_p ) italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ( italic_p ) + italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ( italic_p ) italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) - italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ( italic_p ) italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT =0absent0\displaystyle=0= 0 (10)

with the constraints limδ0g(p0t+δ)x0tsubscript𝛿superscript0𝑔superscriptsubscript𝑝0𝑡𝛿superscriptsubscript𝑥0𝑡\lim_{\delta\rightarrow 0^{-}}g(p_{0}^{t}+\delta)\geq x_{0}^{t}roman_lim start_POSTSUBSCRIPT italic_δ → 0 start_POSTSUPERSCRIPT - end_POSTSUPERSCRIPT end_POSTSUBSCRIPT italic_g ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT + italic_δ ) ≥ italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT and limδ00p0t+δp𝑑g(p)y0tsubscript𝛿superscript0subscriptsuperscriptsuperscriptsubscript𝑝0𝑡𝛿0𝑝differential-d𝑔𝑝superscriptsubscript𝑦0𝑡\lim_{\delta\rightarrow 0^{-}}-\int^{p_{0}^{t}+\delta}_{0}pdg(p)\geq y_{0}^{t}roman_lim start_POSTSUBSCRIPT italic_δ → 0 start_POSTSUPERSCRIPT - end_POSTSUPERSCRIPT end_POSTSUBSCRIPT - ∫ start_POSTSUPERSCRIPT italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT + italic_δ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT italic_p italic_d italic_g ( italic_p ) ≥ italic_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. This equation can be solved separately for p>p0t𝑝superscriptsubscript𝑝0𝑡p>p_{0}^{t}italic_p > italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT and p<p0t𝑝superscriptsubscript𝑝0𝑡p<p_{0}^{t}italic_p < italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. Furthermore, the initial operating point p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT is a solution to the fixed point equation

p𝑝\displaystyle pitalic_p =βt(p).absentsubscript𝛽𝑡𝑝\displaystyle=\beta_{t}(p).= italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) . (11)

The differential equation (10) is obtained by simply applying the Leibniz rule of the derivative of a definite integral on (8). Note that we can rewrite (8) as

p0tptradt(1pβt(ptradt))𝑑gt(p)=0superscriptsubscriptsuperscriptsubscript𝑝0𝑡superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡1𝑝subscript𝛽𝑡superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡differential-dsubscript𝑔𝑡𝑝0\displaystyle\int_{p_{0}^{t}}^{p_{trad}^{t}}\left(1-\frac{p}{\beta_{t}(p_{trad% }^{t})}\right)dg_{t}(p)=0∫ start_POSTSUBSCRIPT italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT ( 1 - divide start_ARG italic_p end_ARG start_ARG italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) end_ARG ) italic_d italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) = 0 (12)

We see that a discontinuity at p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT implies that dgt(p)𝑑subscript𝑔𝑡𝑝dg_{t}(p)italic_d italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) is not a differential but is a negative real number. Since p=βt(p)𝑝subscript𝛽𝑡𝑝p=\beta_{t}(p)italic_p = italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) at p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT, we have the term inside the integral 0absent0\rightarrow 0→ 0 as ptradtp0tsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡superscriptsubscript𝑝0𝑡p_{trad}^{t}\rightarrow p_{0}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT → italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. This implies that a discontinuity in gt(p)subscript𝑔𝑡𝑝g_{t}(p)italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) is allowed at p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. Further, since the (12) holds for ptradt>p0tsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡superscriptsubscript𝑝0𝑡p_{trad}^{t}>p_{0}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT > italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT and for ptradt<p0tsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡superscriptsubscript𝑝0𝑡p_{trad}^{t}<p_{0}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT < italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT, the differential equation can be solved separately for p>p0t𝑝superscriptsubscript𝑝0𝑡p>p_{0}^{t}italic_p > italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT and p<p0t𝑝superscriptsubscript𝑝0𝑡p<p_{0}^{t}italic_p < italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT.

Finally, assuming that the AMM finds solutions to (10) and (11), the trader is free to move the market to ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. The market maker then simply uses Bayes’ rule to update its beliefs over the external prices as

ft+1(p)=fη(ptradtp)ft(p)0fη(ptradtp)ft(p)𝑑psubscript𝑓𝑡1𝑝subscript𝑓𝜂superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝subscript𝑓𝑡𝑝superscriptsubscript0subscript𝑓𝜂superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝subscript𝑓𝑡𝑝differential-d𝑝\displaystyle f_{t+1}(p)=\frac{f_{\eta}(p_{trad}^{t}-p)f_{t}(p)}{\int_{0}^{% \infty}f_{\eta}(p_{trad}^{t}-p)f_{t}(p)dp}italic_f start_POSTSUBSCRIPT italic_t + 1 end_POSTSUBSCRIPT ( italic_p ) = divide start_ARG italic_f start_POSTSUBSCRIPT italic_η end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_p ) italic_f start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) end_ARG start_ARG ∫ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∞ end_POSTSUPERSCRIPT italic_f start_POSTSUBSCRIPT italic_η end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_p ) italic_f start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) italic_d italic_p end_ARG (13)

The updated belief ft+1(p)subscript𝑓𝑡1𝑝f_{t+1}(p)italic_f start_POSTSUBSCRIPT italic_t + 1 end_POSTSUBSCRIPT ( italic_p ) is now used to compute βt+1(p)subscript𝛽𝑡1𝑝\beta_{t+1}(p)italic_β start_POSTSUBSCRIPT italic_t + 1 end_POSTSUBSCRIPT ( italic_p ), thus completing the market making algorithm. Equations (10), (11) and (13) describe the complete dynamics of an optimally efficient market maker.

5 Optimal Solutions for special cases

In this section, we present solutions to the differential equation derived in Theorem 4.1 for some special cases: Gaussian and Lognormal price jumps and trader noises. That is, we assume that both ΔpexttΔsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡\Delta p_{ext}^{t}roman_Δ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT and ΔptradtΔsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡\Delta p_{trad}^{t}roman_Δ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT follow a Gaussian or Lognormal distribution. Under these assumptions, we get the following key results.

5.1 Kalman Filter algorithm for known market parameters

Theorem 5.1.

If Δpextt𝒩(0,σ2)similar-toΔsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡𝒩0superscript𝜎2\Delta p_{ext}^{t}\sim\mathcal{N}(0,\sigma^{2})roman_Δ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ∼ caligraphic_N ( 0 , italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ) and Δptradt𝒩(0,η2)similar-toΔsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝒩0superscript𝜂2\Delta p_{trad}^{t}\sim\mathcal{N}(0,\eta^{2})roman_Δ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ∼ caligraphic_N ( 0 , italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ) where σ,η𝜎𝜂\sigma,\etaitalic_σ , italic_η are known to the market maker, then the fixed point equation p0t=βt(p0t)superscriptsubscript𝑝0𝑡subscript𝛽𝑡superscriptsubscript𝑝0𝑡p_{0}^{t}=\beta_{t}(p_{0}^{t})italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) (11) has a unique solution given by the Kalman filter [49] estimate of pexttsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡p_{ext}^{t}italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT, that is, we have

p0tsuperscriptsubscript𝑝0𝑡\displaystyle p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT =E[pextt|t1].absent𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1\displaystyle=E[p_{ext}^{t}|\mathcal{H}_{t-1}].= italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] . (14)

Further, the differential equation (10) has a family of solutions, given by

gt(p)={x0t+y0tp0tifpp0tmax(0,x~0tCt(pp0t)Kt1Kt)ifp>p0tsubscript𝑔𝑡𝑝casessuperscriptsubscript𝑥0𝑡superscriptsubscript𝑦0𝑡superscriptsubscript𝑝0𝑡if𝑝superscriptsubscript𝑝0𝑡0superscriptsubscript~𝑥0𝑡subscript𝐶𝑡superscript𝑝superscriptsubscript𝑝0𝑡subscript𝐾𝑡1subscript𝐾𝑡if𝑝superscriptsubscript𝑝0𝑡\displaystyle g_{t}(p)=\begin{cases}x_{0}^{t}+\frac{y_{0}^{t}}{p_{0}^{t}}\ \ &% \mathrm{if\ }p\leq p_{0}^{t}\\ \max(0,\tilde{x}_{0}^{t}-C_{t}(p-p_{0}^{t})^{\frac{K_{t}}{1-K_{t}}})\ \ &% \mathrm{if\ }p>p_{0}^{t}\end{cases}italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) = { start_ROW start_CELL italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT + divide start_ARG italic_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_ARG start_ARG italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_ARG end_CELL start_CELL roman_if italic_p ≤ italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_CELL end_ROW start_ROW start_CELL roman_max ( 0 , over~ start_ARG italic_x end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_C start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p - italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT divide start_ARG italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_ARG start_ARG 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_ARG end_POSTSUPERSCRIPT ) end_CELL start_CELL roman_if italic_p > italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_CELL end_ROW (15)

where Ktsubscript𝐾𝑡K_{t}italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT is the Kalman gain, and Ct,x~0tsubscript𝐶𝑡superscriptsubscript~𝑥0𝑡C_{t},\tilde{x}_{0}^{t}italic_C start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT , over~ start_ARG italic_x end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT are non-negative constants, such that x~0tx0tsuperscriptsubscript~𝑥0𝑡superscriptsubscript𝑥0𝑡\tilde{x}_{0}^{t}\leq x_{0}^{t}over~ start_ARG italic_x end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ≤ italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT.

The above solution corresponds to a CFMM with the initial slope of the bonding curve given by the Kalman estimate of pexttsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡p_{ext}^{t}italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT by treating ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT as noisy observations. Thus, we only need to calculate a single quantity E[pextt|t]𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡E[p_{ext}^{t}|\mathcal{H}_{t}]italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ] (see Algorithm 1), and set the other parameters of the demand curve according to (15). We get a similar solution if we assume that the external price follows geometric Brownian motion.

Theorem 5.2.

If logpexttpextt1𝒩(0,σ2)similar-tosuperscriptsubscript𝑝𝑒𝑥𝑡𝑡superscriptsubscript𝑝𝑒𝑥𝑡𝑡1𝒩0superscript𝜎2\log\frac{p_{ext}^{t}}{p_{ext}^{t-1}}\sim\mathcal{N}(0,\sigma^{2})roman_log divide start_ARG italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_ARG start_ARG italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t - 1 end_POSTSUPERSCRIPT end_ARG ∼ caligraphic_N ( 0 , italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ) and logptradtpextt𝒩(0,η2)similar-tosuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡superscriptsubscript𝑝𝑒𝑥𝑡𝑡𝒩0superscript𝜂2\log\frac{p_{trad}^{t}}{p_{ext}^{t}}\sim\mathcal{N}(0,\eta^{2})roman_log divide start_ARG italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_ARG start_ARG italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_ARG ∼ caligraphic_N ( 0 , italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ) where σ,η𝜎𝜂\sigma,\etaitalic_σ , italic_η are known to the market maker, then the fixed point equation p0t=βt(p0t)superscriptsubscript𝑝0𝑡subscript𝛽𝑡superscriptsubscript𝑝0𝑡p_{0}^{t}=\beta_{t}(p_{0}^{t})italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) (11) has a unique solution which is a function of the Kalman filter [49] estimate of logpexttsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡\log p_{ext}^{t}roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT, that is, we have

p0tsuperscriptsubscript𝑝0𝑡\displaystyle p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT =exp(E[logpextt|t1]+Pt|t2(1Kt)),absent𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1subscript𝑃conditional𝑡𝑡21subscript𝐾𝑡\displaystyle=\exp\left(E[\log p_{ext}^{t}|\mathcal{H}_{t-1}]+\frac{P_{t|t}}{2% (1-K_{t})}\right),= roman_exp ( italic_E [ roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] + divide start_ARG italic_P start_POSTSUBSCRIPT italic_t | italic_t end_POSTSUBSCRIPT end_ARG start_ARG 2 ( 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) end_ARG ) , (16)

where Ktsubscript𝐾𝑡K_{t}italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT is the Kalman gain, and Pt|tsubscript𝑃conditional𝑡𝑡P_{t|t}italic_P start_POSTSUBSCRIPT italic_t | italic_t end_POSTSUBSCRIPT is the variance of the Kalman estimate of logpexttsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡\log p_{ext}^{t}roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. Further, the differential equation (10) has a solution given by

gt(p)={x0t+y0tp0tifpp0tmax(0,x~0tCt(p1Ktκt)Kt1KtpKt)ifp>p0tsubscript𝑔𝑡𝑝casessuperscriptsubscript𝑥0𝑡superscriptsubscript𝑦0𝑡superscriptsubscript𝑝0𝑡if𝑝superscriptsubscript𝑝0𝑡0superscriptsubscript~𝑥0𝑡subscript𝐶𝑡superscriptsuperscript𝑝1subscript𝐾𝑡subscript𝜅𝑡subscript𝐾𝑡1subscript𝐾𝑡superscript𝑝subscript𝐾𝑡if𝑝superscriptsubscript𝑝0𝑡\displaystyle g_{t}(p)=\begin{cases}x_{0}^{t}+\frac{y_{0}^{t}}{p_{0}^{t}}\ \ &% \mathrm{if\ }p\leq p_{0}^{t}\\ \max(0,\tilde{x}_{0}^{t}-C_{t}(p^{1-K_{t}}-\kappa_{t})^{\frac{K_{t}}{1-K_{t}}}% p^{K_{t}})\ \ &\mathrm{if\ }p>p_{0}^{t}\end{cases}italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) = { start_ROW start_CELL italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT + divide start_ARG italic_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_ARG start_ARG italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_ARG end_CELL start_CELL roman_if italic_p ≤ italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_CELL end_ROW start_ROW start_CELL roman_max ( 0 , over~ start_ARG italic_x end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_C start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUPERSCRIPT 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_POSTSUPERSCRIPT - italic_κ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT divide start_ARG italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_ARG start_ARG 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_ARG end_POSTSUPERSCRIPT italic_p start_POSTSUPERSCRIPT italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_POSTSUPERSCRIPT ) end_CELL start_CELL roman_if italic_p > italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_CELL end_ROW (17)

where Ct,κt,x~0tsubscript𝐶𝑡subscript𝜅𝑡superscriptsubscript~𝑥0𝑡C_{t},\kappa_{t},\tilde{x}_{0}^{t}italic_C start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT , italic_κ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT , over~ start_ARG italic_x end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT are non-negative constants such that x~0tx0tsuperscriptsubscript~𝑥0𝑡superscriptsubscript𝑥0𝑡\tilde{x}_{0}^{t}\leq x_{0}^{t}over~ start_ARG italic_x end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ≤ italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT.

Algorithm 1 A Kalman filter based algorithm to adapt the AMM curve
1:Known η,σ𝜂𝜎\eta,\sigmaitalic_η , italic_σ, Reserves x0,y0subscript𝑥0subscript𝑦0x_{0},y_{0}italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT
2:t0𝑡0t\leftarrow 0italic_t ← 0
3:T𝑇absentT\leftarrowitalic_T ← Number of total time slots
4:Initial price estimate pext0|0pext0subscriptsuperscript𝑝conditional00𝑒𝑥𝑡superscriptsubscript𝑝𝑒𝑥𝑡0p^{0|0}_{ext}\leftarrow p_{ext}^{0}italic_p start_POSTSUPERSCRIPT 0 | 0 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT ← italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT
5:P0|0=0subscript𝑃conditional000P_{0|0}=0italic_P start_POSTSUBSCRIPT 0 | 0 end_POSTSUBSCRIPT = 0
6:while tT𝑡𝑇t\leq Titalic_t ≤ italic_T do
7:     θtpextt1|t1xt1pextt1|t1xt1+yt1subscript𝜃𝑡subscriptsuperscript𝑝𝑡conditional1𝑡1𝑒𝑥𝑡subscript𝑥𝑡1subscriptsuperscript𝑝𝑡conditional1𝑡1𝑒𝑥𝑡subscript𝑥𝑡1subscript𝑦𝑡1\theta_{t}\leftarrow\frac{p^{t-1|t-1}_{ext}x_{t-1}}{p^{t-1|t-1}_{ext}x_{t-1}+y% _{t-1}}italic_θ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ← divide start_ARG italic_p start_POSTSUPERSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT italic_x start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT end_ARG start_ARG italic_p start_POSTSUPERSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT italic_x start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT + italic_y start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT end_ARG
8:     Publish bonding curve xθty1θt=xt1θtyt11θtsuperscript𝑥subscript𝜃𝑡superscript𝑦1subscript𝜃𝑡superscriptsubscript𝑥𝑡1subscript𝜃𝑡superscriptsubscript𝑦𝑡11subscript𝜃𝑡x^{\theta_{t}}y^{1-\theta_{t}}=x_{t-1}^{\theta_{t}}y_{t-1}^{1-{\theta_{t}}}italic_x start_POSTSUPERSCRIPT italic_θ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_POSTSUPERSCRIPT italic_y start_POSTSUPERSCRIPT 1 - italic_θ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_POSTSUPERSCRIPT = italic_x start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_θ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_POSTSUPERSCRIPT italic_y start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 1 - italic_θ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_POSTSUPERSCRIPT
9:     Observe trader action ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT
10:     KtPt1|t1+σ2Pt1|t1+σ2+η2subscript𝐾𝑡subscript𝑃𝑡conditional1𝑡1superscript𝜎2subscript𝑃𝑡conditional1𝑡1superscript𝜎2superscript𝜂2K_{t}\leftarrow\frac{P_{t-1|t-1}+\sigma^{2}}{P_{t-1|t-1}+\sigma^{2}+\eta^{2}}italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ← divide start_ARG italic_P start_POSTSUBSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUBSCRIPT + italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_ARG italic_P start_POSTSUBSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUBSCRIPT + italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG \triangleright Update Kalman gain
11:     pextt|t(1Kt)pextt1|t1+Ktptradtsuperscriptsubscript𝑝𝑒𝑥𝑡conditional𝑡𝑡1subscript𝐾𝑡superscriptsubscript𝑝𝑒𝑥𝑡𝑡conditional1𝑡1subscript𝐾𝑡superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{ext}^{t|t}\leftarrow(1-K_{t})p_{ext}^{t-1|t-1}+K_{t}p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t | italic_t end_POSTSUPERSCRIPT ← ( 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUPERSCRIPT + italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT\triangleright Update Kalman estimate of the external price
12:     Pt|t=(1Kt)(Pt1|t1+σ2)subscript𝑃conditional𝑡𝑡1subscript𝐾𝑡subscript𝑃𝑡conditional1𝑡1superscript𝜎2P_{t|t}=(1-K_{t})(P_{t-1|t-1}+\sigma^{2})italic_P start_POSTSUBSCRIPT italic_t | italic_t end_POSTSUBSCRIPT = ( 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) ( italic_P start_POSTSUBSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUBSCRIPT + italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT )\triangleright Update Kalman uncertainty
13:end while

Family of optimal demand curves: We note that both Theorem 5.1 and Theorem 5.2 recommend a family of demand curves that satisfy the Glosten-Milgrom condition (3). The simplest curve in this family is the one where x~0t=Ct=0superscriptsubscript~𝑥0𝑡subscript𝐶𝑡0\tilde{x}_{0}^{t}=C_{t}=0over~ start_ARG italic_x end_ARG start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = italic_C start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = 0. This gives the simple demand curve which is constant except for a discontinuity at p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. This corresponds to a constant sum market maker with bonding curve y+p0tx=k𝑦superscriptsubscript𝑝0𝑡𝑥𝑘y+p_{0}^{t}x=kitalic_y + italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT italic_x = italic_k with an adaptive slope given by the Kalman estimate of the external price conditioned on trader behavior.

An apparent contradiction, and a resolution: A feature of the optimal demand curves derived is the fact that they do not make it possible for a trader to express any price ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT between 00 and \infty. For instance, if we take the constant sum instance of the family of curves, it only allows the trader to express if the price of the trade is greater than or less than p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT, but not the exact value of ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT, which contradicts our assumption that the market maker can observe all of the history of trader prices ptradττ=1tsuperscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝜏1𝑡\langle p_{trad}^{\tau}\rangle_{\tau=1}^{t}⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. We can resolve this contradiction by approximating the optimal demand curve as a sum of two demand curves gt(p)=gtopt(p)+gtexp(p)subscript𝑔𝑡𝑝subscriptsuperscript𝑔𝑜𝑝𝑡𝑡𝑝subscriptsuperscript𝑔𝑒𝑥𝑝𝑡𝑝g_{t}(p)=g^{opt}_{t}(p)+g^{exp}_{t}(p)italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) = italic_g start_POSTSUPERSCRIPT italic_o italic_p italic_t end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) + italic_g start_POSTSUPERSCRIPT italic_e italic_x italic_p end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ), where the former curve is the optimal solution with most of the liquidity, and the latter curve with low liquidity to improve its price expressiveness. For instance, we can have gt(p)=(1ϵ)gtCSMM(p)+ϵgtCPMM(p)subscript𝑔𝑡𝑝1italic-ϵsubscriptsuperscript𝑔𝐶𝑆𝑀𝑀𝑡𝑝italic-ϵsubscriptsuperscript𝑔𝐶𝑃𝑀𝑀𝑡𝑝g_{t}(p)=(1-\epsilon)g^{CSMM}_{t}(p)+\epsilon g^{CPMM}_{t}(p)italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) = ( 1 - italic_ϵ ) italic_g start_POSTSUPERSCRIPT italic_C italic_S italic_M italic_M end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) + italic_ϵ italic_g start_POSTSUPERSCRIPT italic_C italic_P italic_M italic_M end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) where we have

gtCSMM(p)superscriptsubscript𝑔𝑡𝐶𝑆𝑀𝑀𝑝\displaystyle g_{t}^{CSMM}(p)italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_C italic_S italic_M italic_M end_POSTSUPERSCRIPT ( italic_p ) ={x0t+y0tp0tifpp0t0ifp>p0tabsentcasessuperscriptsubscript𝑥0𝑡superscriptsubscript𝑦0𝑡superscriptsubscript𝑝0𝑡if𝑝superscriptsubscript𝑝0𝑡0if𝑝superscriptsubscript𝑝0𝑡\displaystyle=\begin{cases}x_{0}^{t}+\frac{y_{0}^{t}}{p_{0}^{t}}\ \ &\mathrm{% if\ }p\leq p_{0}^{t}\\ 0\ \ &\mathrm{if\ }p>p_{0}^{t}\end{cases}= { start_ROW start_CELL italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT + divide start_ARG italic_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_ARG start_ARG italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_ARG end_CELL start_CELL roman_if italic_p ≤ italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_CELL end_ROW start_ROW start_CELL 0 end_CELL start_CELL roman_if italic_p > italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_CELL end_ROW (18)
gtCPMM(p)subscriptsuperscript𝑔𝐶𝑃𝑀𝑀𝑡𝑝\displaystyle g^{CPMM}_{t}(p)italic_g start_POSTSUPERSCRIPT italic_C italic_P italic_M italic_M end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) =1/pabsent1𝑝\displaystyle=1/\sqrt{p}= 1 / square-root start_ARG italic_p end_ARG (19)

with ϵ<<1much-less-thanitalic-ϵ1\epsilon<<1italic_ϵ < < 1. This combines the demand curves of the constant sum market maker (the optimal solution) and a constant product market maker (the expressive solution) as an approximation.

Other practical approximations: Another way we can parametrize the curve of the market maker is to choose it from a family of curves such that the initial marginal price matches p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT as prescribed by Theorem 5.1 and Theorem 5.2, and processing a trade on any curve in that family is computationally simple. To that end, we can use the Constant Mean Market Makers [40, 4] with its weighting factor as our variable parameter. Note that the CMMMs performs trades along the curve xθy1θ=ksuperscript𝑥𝜃superscript𝑦1𝜃𝑘x^{\theta}y^{1-\theta}=kitalic_x start_POSTSUPERSCRIPT italic_θ end_POSTSUPERSCRIPT italic_y start_POSTSUPERSCRIPT 1 - italic_θ end_POSTSUPERSCRIPT = italic_k where k𝑘kitalic_k is a constant, and x,y𝑥𝑦x,yitalic_x , italic_y are the quantities of the asset and the numeraire in the market maker [40]. This ensures that no trade can exhaust either the asset or the numeraire from the AMM reserves. We know that the marginal price of the asset at any state of the reserves is given by p=θy(1θ)x𝑝𝜃𝑦1𝜃𝑥p=\frac{\theta y}{(1-\theta)x}italic_p = divide start_ARG italic_θ italic_y end_ARG start_ARG ( 1 - italic_θ ) italic_x end_ARG. Therefore, in our case, we set the value of parameter as θt=p0txp0tx+ysubscript𝜃𝑡superscriptsubscript𝑝0𝑡𝑥superscriptsubscript𝑝0𝑡𝑥𝑦\theta_{t}=\frac{p_{0}^{t}x}{p_{0}^{t}x+y}italic_θ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = divide start_ARG italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT italic_x end_ARG start_ARG italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT italic_x + italic_y end_ARG. This ensures that the starting price of any trade is p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT, and the market maker can only get a better price than that for a large trade.

5.2 Adaptive Kalman Filter algorithm for unknown market parameters

Need for more adaptivity: A major assumption while solving for the optimal demand curve in the Gaussian/Lognormal model was that the market parameters σ,η𝜎𝜂\sigma,\etaitalic_σ , italic_η that control the variances of the price jump and noise were known to the AMM. These can indeed be obtained by analysing historical trading data in any market, and can be assumed to change slowly on the timescale that prices undergo changes. However, this assumption might not always hold for assets or tokens that are less well known or have no historical data. To deal with this case, we propose a modification to Algorithm 1. This ensures that we simultaneously estimate the parameters η,σ𝜂𝜎\eta,\sigmaitalic_η , italic_σ and hence help estimate the hidden external market price. To that end, we observe that we can write the likelihood function of all random variables and parameters of our model at time t𝑡titalic_t as follows

Lt=L(ptradτ,pextττ=1t,η,σ)subscript𝐿𝑡𝐿superscriptsubscriptsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏superscriptsubscript𝑝𝑒𝑥𝑡𝜏𝜏1𝑡𝜂𝜎\displaystyle L_{t}=L(\langle p_{trad}^{\tau},p_{ext}^{\tau}\rangle_{\tau=1}^{% t},\eta,\sigma)italic_L start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = italic_L ( ⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT , italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT , italic_η , italic_σ ) =τ=1t12πησexp((pextτpextτ1)22σ2(ptradτpextτ)22η2),absentsuperscriptsubscriptproduct𝜏1𝑡12𝜋𝜂𝜎superscriptsuperscriptsubscript𝑝𝑒𝑥𝑡𝜏superscriptsubscript𝑝𝑒𝑥𝑡𝜏122superscript𝜎2superscriptsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏superscriptsubscript𝑝𝑒𝑥𝑡𝜏22superscript𝜂2\displaystyle=\prod_{\tau=1}^{t}\frac{1}{2\pi\sqrt{\eta\sigma}}\exp{\left(-% \frac{(p_{ext}^{\tau}-p_{ext}^{\tau-1})^{2}}{2\sigma^{2}}-\frac{(p_{trad}^{% \tau}-p_{ext}^{\tau})^{2}}{2\eta^{2}}\right)},= ∏ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT divide start_ARG 1 end_ARG start_ARG 2 italic_π square-root start_ARG italic_η italic_σ end_ARG end_ARG roman_exp ( - divide start_ARG ( italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT - italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ - 1 end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_ARG 2 italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG - divide start_ARG ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT - italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_ARG 2 italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG ) , (20)

which gives us the conditional log-likelihood given the trader actions as

E[logLt|ptradττ=1t]𝐸delimited-[]conditionalsubscript𝐿𝑡superscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝜏1𝑡\displaystyle E[\log L_{t}|\langle p_{trad}^{\tau}\rangle_{\tau=1}^{t}]italic_E [ roman_log italic_L start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT | ⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ] =tlogσ2tlogη2τ=1tAτ2σ2τ=1tBτ2η2,absent𝑡𝜎2𝑡𝜂2superscriptsubscript𝜏1𝑡subscript𝐴𝜏2superscript𝜎2superscriptsubscript𝜏1𝑡subscript𝐵𝜏2superscript𝜂2\displaystyle=-\frac{t\log\sigma}{2}-\frac{t\log\eta}{2}-\frac{\sum_{\tau=1}^{% t}A_{\tau}}{2\sigma^{2}}-\frac{\sum_{\tau=1}^{t}B_{\tau}}{2\eta^{2}},= - divide start_ARG italic_t roman_log italic_σ end_ARG start_ARG 2 end_ARG - divide start_ARG italic_t roman_log italic_η end_ARG start_ARG 2 end_ARG - divide start_ARG ∑ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT italic_A start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT end_ARG start_ARG 2 italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG - divide start_ARG ∑ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT italic_B start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT end_ARG start_ARG 2 italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG , (21)

where Aτ,Bτsubscript𝐴𝜏subscript𝐵𝜏A_{\tau},B_{\tau}italic_A start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT , italic_B start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT are given by

Aτsubscript𝐴𝜏\displaystyle A_{\tau}italic_A start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT =E[(pextτ)2|ptradττ=1t]+E[(pextτ1)2|ptradττ=1t]+2E[pextτpextτ1|ptradττ=1t],absent𝐸delimited-[]conditionalsuperscriptsuperscriptsubscript𝑝𝑒𝑥𝑡𝜏2superscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝜏1𝑡𝐸delimited-[]conditionalsuperscriptsuperscriptsubscript𝑝𝑒𝑥𝑡𝜏12superscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝜏1𝑡2𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝜏superscriptsubscript𝑝𝑒𝑥𝑡𝜏1superscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝜏1𝑡\displaystyle=E[(p_{ext}^{\tau})^{2}|\langle p_{trad}^{\tau}\rangle_{\tau=1}^{% t}]+E[(p_{ext}^{\tau-1})^{2}|\langle p_{trad}^{\tau}\rangle_{\tau=1}^{t}]+2E[p% _{ext}^{\tau}p_{ext}^{\tau-1}|\langle p_{trad}^{\tau}\rangle_{\tau=1}^{t}],= italic_E [ ( italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT | ⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ] + italic_E [ ( italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ - 1 end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT | ⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ] + 2 italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ - 1 end_POSTSUPERSCRIPT | ⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ] , (22)
Bτsubscript𝐵𝜏\displaystyle B_{\tau}italic_B start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT =(ptradτ)2+E[(pextτ)2|ptradττ=1t]+2ptradτE[pextτ|ptradττ=1t].absentsuperscriptsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏2𝐸delimited-[]conditionalsuperscriptsuperscriptsubscript𝑝𝑒𝑥𝑡𝜏2superscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝜏1𝑡2superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝜏superscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝜏1𝑡\displaystyle=(p_{trad}^{\tau})^{2}+E[(p_{ext}^{\tau})^{2}|\langle p_{trad}^{% \tau}\rangle_{\tau=1}^{t}]+2p_{trad}^{\tau}E[p_{ext}^{\tau}|\langle p_{trad}^{% \tau}\rangle_{\tau=1}^{t}].= ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_E [ ( italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT | ⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ] + 2 italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT | ⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ] . (23)

Estimating the unknowns: We now estimate the market parameters σ,η𝜎𝜂\sigma,\etaitalic_σ , italic_η using the EM algorithm [37]. This can be done by first setting the terms Aτ,Bτsubscript𝐴𝜏subscript𝐵𝜏A_{\tau},B_{\tau}italic_A start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT , italic_B start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT using (22) and (23) with the expectations on the RHS calculated via forward and backward runs of the Kalman filter assuming an initial guess estimate of σ,η𝜎𝜂\sigma,\etaitalic_σ , italic_η. The forward runs of the algorithm involve computing E[pextτ|ptradτi=1τ]𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝜏superscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝑖1𝜏E[p_{ext}^{\tau}|\langle p_{trad}^{\tau}\rangle_{i=1}^{\tau}]italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT | ⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ] for all τ=1,,t𝜏1𝑡\tau=1,\cdots,titalic_τ = 1 , ⋯ , italic_t. These are estimates of the external price given only the data in the past. This can be done using the Kalman filter updates given in Algorithm 1. Next, we use the Rauch-Tung-Striebel smoother [61], an essentially backward run of the Kalman filter algorithm given all the statistics obtained from the forward run. This computes statistics such as E[pextτ|ptradτi=1t]𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝜏superscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝑖1𝑡E[p_{ext}^{\tau}|\langle p_{trad}^{\tau}\rangle_{i=1}^{t}]italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT | ⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ], that is, the estimate of the external price in the past given all of the observations till the present time slot. This evaluates all of the terms in Aτsubscript𝐴𝜏A_{\tau}italic_A start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT and Bτsubscript𝐵𝜏B_{\tau}italic_B start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT, and completes the E-step of the EM algorithm.

After that, we use (21) to find values of σ,η𝜎𝜂\sigma,\etaitalic_σ , italic_η that maximize the conditional log-likelihood function. This involves setting the gradient of the expected log likelihood function to zero

σE[logLt|ptradττ=1t]=0,ηE[logLt|ptradττ=1t]=0.formulae-sequencesubscript𝜎𝐸delimited-[]conditionalsubscript𝐿𝑡superscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝜏1𝑡0subscript𝜂𝐸delimited-[]conditionalsubscript𝐿𝑡superscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝜏1𝑡0\displaystyle\nabla_{\sigma}E[\log L_{t}|\langle p_{trad}^{\tau}\rangle_{\tau=% 1}^{t}]=0,\ \nabla_{\eta}E[\log L_{t}|\langle p_{trad}^{\tau}\rangle_{\tau=1}^% {t}]=0.∇ start_POSTSUBSCRIPT italic_σ end_POSTSUBSCRIPT italic_E [ roman_log italic_L start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT | ⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ] = 0 , ∇ start_POSTSUBSCRIPT italic_η end_POSTSUBSCRIPT italic_E [ roman_log italic_L start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT | ⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ] = 0 . (24)

While doing this, we ignore the dependence of Aτ,Bτsubscript𝐴𝜏subscript𝐵𝜏A_{\tau},B_{\tau}italic_A start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT , italic_B start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT on η,σ𝜂𝜎\eta,\sigmaitalic_η , italic_σ to obtain

σ=2τ=1tAτt,η=2τ=1tBτtformulae-sequencesuperscript𝜎2superscriptsubscript𝜏1𝑡subscript𝐴𝜏𝑡superscript𝜂2superscriptsubscript𝜏1𝑡subscript𝐵𝜏𝑡\displaystyle\sigma^{*}=\sqrt{2\frac{\sum_{\tau=1}^{t}A_{\tau}}{t}},\ \eta^{*}% =\sqrt{2\frac{\sum_{\tau=1}^{t}B_{\tau}}{t}}italic_σ start_POSTSUPERSCRIPT ∗ end_POSTSUPERSCRIPT = square-root start_ARG 2 divide start_ARG ∑ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT italic_A start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT end_ARG start_ARG italic_t end_ARG end_ARG , italic_η start_POSTSUPERSCRIPT ∗ end_POSTSUPERSCRIPT = square-root start_ARG 2 divide start_ARG ∑ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT italic_B start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT end_ARG start_ARG italic_t end_ARG end_ARG (25)

which completely specifies the M-step of the EM algorithm. This has been summarized in Algorithm 2.

Algorithm 2 Adaptive Kalman filter : EM algorithm estimating unknown parameters at time step t𝑡titalic_t
1:Trader data ptradττ=1tsuperscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝜏1𝑡\langle p_{trad}^{\tau}\rangle_{\tau=1}^{t}⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT, Error Tolerance ϵitalic-ϵ\epsilonitalic_ϵ
2:σ𝜎absent\sigma\leftarrowitalic_σ ← Initial guess σ0subscript𝜎0\sigma_{0}italic_σ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT
3:η𝜂absent\eta\leftarrowitalic_η ← Initial guess η0subscript𝜂0\eta_{0}italic_η start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT
4:i0𝑖0i\leftarrow 0italic_i ← 0
5:LogLikelihood =absent=-\infty= - ∞
6:while LogLikelihood <ϵabsentitalic-ϵ<-\epsilon< - italic_ϵ do
7:     E step: Set Aτ,Bτsubscript𝐴𝜏subscript𝐵𝜏A_{\tau},B_{\tau}italic_A start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT , italic_B start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT as per Equations (22) and (23), assuming guesses σ,η𝜎𝜂\sigma,\etaitalic_σ , italic_η
8:     M step: Set σ=2τ=1tAτ/t,η=2τ=1tBτ/tformulae-sequence𝜎2superscriptsubscript𝜏1𝑡subscript𝐴𝜏𝑡𝜂2superscriptsubscript𝜏1𝑡subscript𝐵𝜏𝑡\sigma=\sqrt{2\sum_{\tau=1}^{t}A_{\tau}/t},\eta=\sqrt{2\sum_{\tau=1}^{t}B_{% \tau}/t}italic_σ = square-root start_ARG 2 ∑ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT italic_A start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT / italic_t end_ARG , italic_η = square-root start_ARG 2 ∑ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT italic_B start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT / italic_t end_ARG
9:     LogLikelihood \leftarrow Equation (21)
10:     ii+1𝑖𝑖1i\leftarrow i+1italic_i ← italic_i + 1
11:end while

Managing computation, and adapting to a non-stationary market: While Algorithm 2 added on top of our AMM helps us estimate the unknown market parameters, its computational complexity keeps growing linearly with each additional trade. This is because every trade adds another term in the series that computes the log-likelihood function, hence increasing the number of iterations in both the forward and backward runs of the Kalman filter. Additionally, this algorithm also assumes there is no change in the market parameters η,σ𝜂𝜎\eta,\sigmaitalic_η , italic_σ with time, that is, the market conditions are stationary. We can make the algorithm less computationally heavy and adapt to non-stationarities by truncating the trading data to a recent history of ptradτsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏p_{trad}^{\tau}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT. This approach keeps track of all price estimates of the past, since they get refined with every backward run of the Adaptive Kalman algorithm, but only runs the algorithm on the recent history of price estimates and trading data.

5.3 Adversarial robustness

A prominent danger to the proper functioning of market making protocols is the presence of adversarial trader behavior. The model described so far and the optimal solutions presented remain valid only when traders interacting with the market are rational with respect to the external market. However, there is always the possibility that an AMM is being manipulated for profits extracted from other protocols (e.g. lenders[30], derivative markets, etc.) relying on the AMM as a price oracle [26]. Although any protocol using an AMM as a price oracle usually takes necessary precautions, such as ensuring a diverse portfolio of price signals, using outlier-robust statistics such as medians rather than means, etc. we show that our market making algorithms can be made robust to such market adversaries, when the proportion of such adversarial is less than half of all trading interactions.

Adversary model: The adversarial behavior we seek to guard against is the manipulation of ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT that the AMM observes and not the external price pexttsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡p_{ext}^{t}italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. We assume that the external price is inferred from a deep market that is not easily manipulated. We further assume that a proportion α𝛼\alphaitalic_α of the trader population is adversarial and the rest behave as per the rational model in Section 3. However, since the AMM does not know which trades are being manipulated by the adversary, we assign a sequence of learnable weights wτsubscript𝑤𝜏w_{\tau}italic_w start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT for all trade observations in the past ptradττ=1tsuperscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝜏1𝑡\langle p_{trad}^{\tau}\rangle_{\tau=1}^{t}⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. To successfully manipulate the price, the adversary needs to push ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT in a specific direction so as to induce a large discrepancy in the marginal prices of the AMM curve and pexttsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡p_{ext}^{t}italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT.

Robust adaptive curve algorithm: A simple modification of the EM algorithm enables us to distinguish adversarial trades from honest trades [33, 64]. We first rewrite the log-likelihood function of the AMM as

E[logLt|ptradττ=1t]𝐸delimited-[]conditionalsubscript𝐿𝑡superscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝜏1𝑡\displaystyle E[\log L_{t}|\langle p_{trad}^{\tau}\rangle_{\tau=1}^{t}]italic_E [ roman_log italic_L start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT | ⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ] =tlogσ2tlogη2+τ=1t(logwτ4Aτ2σ2wτBτ2η2),absent𝑡𝜎2𝑡𝜂2superscriptsubscript𝜏1𝑡subscript𝑤𝜏4subscript𝐴𝜏2superscript𝜎2subscript𝑤𝜏subscript𝐵𝜏2superscript𝜂2\displaystyle=-\frac{t\log\sigma}{2}-\frac{t\log\eta}{2}+\sum_{\tau=1}^{t}% \left(\frac{\log w_{\tau}}{4}-\frac{A_{\tau}}{2\sigma^{2}}-\frac{w_{\tau}B_{% \tau}}{2\eta^{2}}\right),= - divide start_ARG italic_t roman_log italic_σ end_ARG start_ARG 2 end_ARG - divide start_ARG italic_t roman_log italic_η end_ARG start_ARG 2 end_ARG + ∑ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ( divide start_ARG roman_log italic_w start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT end_ARG start_ARG 4 end_ARG - divide start_ARG italic_A start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT end_ARG start_ARG 2 italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG - divide start_ARG italic_w start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT italic_B start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT end_ARG start_ARG 2 italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG ) , (26)

which basically assumes that each datapoint has a different variance in noise η2/wτsuperscript𝜂2subscript𝑤𝜏\eta^{2}/w_{\tau}italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT / italic_w start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT. This implies that data with low weights have a higher variance, and are hence the adversarial outliers. We start our algorithm with an equal weight given to all datapoints, and then estimate Aτ,Bτsubscript𝐴𝜏subscript𝐵𝜏A_{\tau},B_{\tau}italic_A start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT , italic_B start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT assuming those weights and running the forward and backward runs of the Kalman Filtering algorithm. After that, we set new weights by getting the critical points for the log-likelihood maximization using

wτE[logLt|ptradττ=1t]=0wτsubscriptsubscript𝑤𝜏𝐸delimited-[]conditionalsubscript𝐿𝑡superscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝜏1𝑡0superscriptsubscript𝑤𝜏\displaystyle\nabla_{w_{\tau}}E[\log L_{t}|\langle p_{trad}^{\tau}\rangle_{% \tau=1}^{t}]=0\implies w_{\tau}^{*}∇ start_POSTSUBSCRIPT italic_w start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT end_POSTSUBSCRIPT italic_E [ roman_log italic_L start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT | ⟨ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ] = 0 ⟹ italic_w start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ∗ end_POSTSUPERSCRIPT =η22Bτ.absentsuperscript𝜂22subscript𝐵𝜏\displaystyle=\frac{\eta^{2}}{2B_{\tau}}.= divide start_ARG italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_ARG 2 italic_B start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT end_ARG . (27)

This completes the adversarially robust version of the Kalman filtering algorithm. We empirically demonstrate the effectiveness of the approach for α<0.5𝛼0.5\alpha<0.5italic_α < 0.5 compared to static curves, and a naive Kalman filtering approach (Section 7).

6 Implications for AMMs with static curves

If we view the market maker as a price oracle, then one can compare the performance of different algorithms based on how the mean squared error of the AMM changes with the incoming trades. In particular, one can compare how quickly the error goes down in the adaptive protocol proposed in Section 5.2 and a static curve such as Uniswap. This comparison has already been done for liquid markets [60], where we observe an exponential decay of the error for an adaptive protocol compared to a linear decay for a static one.

Error performance with trades: For our case, let us assume that we are comparing how Algorithm 1 performs in contrast to a static curve, if we assume that it is deployed on a blockchain with T𝑇Titalic_T trades in a block. Then, we can prove that the error decreases with number of trades for Algorithm 1 and stays constant for a static curve.

Theorem 6.1.

Let there be T𝑇Titalic_T trades in a single block of transactions, with the external price at the creation of the block being pextsubscript𝑝𝑒𝑥𝑡p_{ext}italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT. We denote by pKFTsuperscriptsubscript𝑝𝐾𝐹𝑇p_{KF}^{T}italic_p start_POSTSUBSCRIPT italic_K italic_F end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT and pSCTsuperscriptsubscript𝑝𝑆𝐶𝑇p_{SC}^{T}italic_p start_POSTSUBSCRIPT italic_S italic_C end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT the marginal prices of the Algorithm 1 and a static curve at the end of the block. Then, we have

E[(pextpKFT)2]𝐸delimited-[]superscriptsubscript𝑝𝑒𝑥𝑡superscriptsubscript𝑝𝐾𝐹𝑇2\displaystyle E[(p_{ext}-p_{KF}^{T})^{2}]italic_E [ ( italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT - italic_p start_POSTSUBSCRIPT italic_K italic_F end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ] =η2σ2Tσ2+η2absentsuperscript𝜂2superscript𝜎2𝑇superscript𝜎2superscript𝜂2\displaystyle=\frac{\eta^{2}\sigma^{2}}{T\sigma^{2}+\eta^{2}}= divide start_ARG italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_ARG italic_T italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG (28)
E[(pextpSCT)2]𝐸delimited-[]superscriptsubscript𝑝𝑒𝑥𝑡superscriptsubscript𝑝𝑆𝐶𝑇2\displaystyle E[(p_{ext}-p_{SC}^{T})^{2}]italic_E [ ( italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT - italic_p start_POSTSUBSCRIPT italic_S italic_C end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ] =η2absentsuperscript𝜂2\displaystyle=\eta^{2}= italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT (29)

Implied dynamics of static curves: We see that static curves are worse oracles because they do not use the realistic dynamical model to get the best estimate of the external price. The question then arises if there is any dynamical model that a particular static curve is optimal for. Note that the differential equation (10) can be viewed as an equation in βt(p)subscript𝛽𝑡𝑝\beta_{t}(p)italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) if the curve gt(p)subscript𝑔𝑡𝑝g_{t}(p)italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) is given. We now use this observation to work out the implied dynamical model underlying commonly used static curves. More formally, given the demand curve of a static AMM g(p)𝑔𝑝g(p)italic_g ( italic_p ), we can find the corresponding βt(p)subscript𝛽𝑡𝑝\beta_{t}(p)italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) function by solving the following differential equation

βt(p)(gt(p)x0t)+βt(p)gt(p)pgt(p)superscriptsubscript𝛽𝑡𝑝subscript𝑔𝑡𝑝superscriptsubscript𝑥0𝑡subscript𝛽𝑡𝑝superscriptsubscript𝑔𝑡𝑝𝑝superscriptsubscript𝑔𝑡𝑝\displaystyle\beta_{t}^{\prime}(p)(g_{t}(p)-x_{0}^{t})+\beta_{t}(p)g_{t}^{% \prime}(p)-pg_{t}^{\prime}(p)italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ( italic_p ) ( italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) - italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) + italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ( italic_p ) - italic_p italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ( italic_p ) =0absent0\displaystyle=0= 0 (30)

with the initial operating point p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT satisfying the constraint p=βt(p)𝑝subscript𝛽𝑡𝑝p=\beta_{t}(p)italic_p = italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ). We now solve this equation for some common CFMM curves to get the underlying implied price/trader dynamics.

Constant Sum Market Makers The demand curve for a constant sum market maker is given by

gt(p)={x0t+y0t/p0tifpp0t0ifp>p0tsubscript𝑔𝑡𝑝casessuperscriptsubscript𝑥0𝑡superscriptsubscript𝑦0𝑡superscriptsubscript𝑝0𝑡if𝑝superscriptsubscript𝑝0𝑡0if𝑝superscriptsubscript𝑝0𝑡\displaystyle g_{t}(p)=\begin{cases}x_{0}^{t}+y_{0}^{t}/p_{0}^{t}\ \ &\mathrm{% if\ }p\leq p_{0}^{t}\\ 0\ \ &\mathrm{if\ }p>p_{0}^{t}\\ \end{cases}italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) = { start_ROW start_CELL italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT + italic_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT / italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_CELL start_CELL roman_if italic_p ≤ italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_CELL end_ROW start_ROW start_CELL 0 end_CELL start_CELL roman_if italic_p > italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_CELL end_ROW (31)

where p0t=p0superscriptsubscript𝑝0𝑡subscript𝑝0p_{0}^{t}=p_{0}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT stays constant with time. Note that substituting the demand curve in (30) gives a trivial equation βt(p)=0superscriptsubscript𝛽𝑡𝑝0\beta_{t}^{\prime}(p)=0italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ( italic_p ) = 0. This, coupled with the condition on the initial operating point implies that βt(p)=p0subscript𝛽𝑡𝑝subscript𝑝0\beta_{t}(p)=p_{0}italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) = italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT for all t𝑡titalic_t. Clearly, this implies a dynamical model where Δpextt=Δptradt=0Δsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡Δsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡0\Delta p_{ext}^{t}=\Delta p_{trad}^{t}=0roman_Δ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = roman_Δ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = 0. In other words, a CSMM assumes that the external price stays constant with time and that the traders have a noiseless view of the price at all times.

Constant Mean Market Makers The demand curve for Constant Mean Market Makers is given by

gt(p)=cp1θ(θ1θ)1θsubscript𝑔𝑡𝑝𝑐superscript𝑝1𝜃superscript𝜃1𝜃1𝜃\displaystyle g_{t}(p)=\frac{c}{p^{1-\theta}}\left(\frac{\theta}{1-\theta}% \right)^{1-\theta}italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) = divide start_ARG italic_c end_ARG start_ARG italic_p start_POSTSUPERSCRIPT 1 - italic_θ end_POSTSUPERSCRIPT end_ARG ( divide start_ARG italic_θ end_ARG start_ARG 1 - italic_θ end_ARG ) start_POSTSUPERSCRIPT 1 - italic_θ end_POSTSUPERSCRIPT (32)

where the bonding curve for the constant mean market maker is of the form xθy1θ=constantsuperscript𝑥𝜃superscript𝑦1𝜃𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡x^{\theta}y^{1-\theta}=constantitalic_x start_POSTSUPERSCRIPT italic_θ end_POSTSUPERSCRIPT italic_y start_POSTSUPERSCRIPT 1 - italic_θ end_POSTSUPERSCRIPT = italic_c italic_o italic_n italic_s italic_t italic_a italic_n italic_t, where x,y𝑥𝑦x,yitalic_x , italic_y denote the reserves for the asset and numeraire respectively.

Substituting this in (30) and solving for βt(p)subscript𝛽𝑡𝑝\beta_{t}(p)italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) gives us the following function

βt(p)subscript𝛽𝑡𝑝\displaystyle\beta_{t}(p)italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) =1θθpθ(p0t)1θ1(p0t/p)θ1(p0t/p)1θabsent1𝜃𝜃superscript𝑝𝜃superscriptsuperscriptsubscript𝑝0𝑡1𝜃1superscriptsuperscriptsubscript𝑝0𝑡𝑝𝜃1superscriptsuperscriptsubscript𝑝0𝑡𝑝1𝜃\displaystyle=\frac{1-\theta}{\theta}p^{\theta}(p_{0}^{t})^{1-\theta}\frac{1-(% p_{0}^{t}/p)^{\theta}}{1-(p_{0}^{t}/p)^{1-\theta}}= divide start_ARG 1 - italic_θ end_ARG start_ARG italic_θ end_ARG italic_p start_POSTSUPERSCRIPT italic_θ end_POSTSUPERSCRIPT ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT 1 - italic_θ end_POSTSUPERSCRIPT divide start_ARG 1 - ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT / italic_p ) start_POSTSUPERSCRIPT italic_θ end_POSTSUPERSCRIPT end_ARG start_ARG 1 - ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT / italic_p ) start_POSTSUPERSCRIPT 1 - italic_θ end_POSTSUPERSCRIPT end_ARG (33)

which also satisfies βt(p0t)=p0tsubscript𝛽𝑡superscriptsubscript𝑝0𝑡superscriptsubscript𝑝0𝑡\beta_{t}(p_{0}^{t})=p_{0}^{t}italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) = italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. In particular, if we look at constant product market makers, we have θ=1/2𝜃12\theta=1/2italic_θ = 1 / 2, giving us βt(p)=p0tpsubscript𝛽𝑡𝑝superscriptsubscript𝑝0𝑡𝑝\beta_{t}(p)=\sqrt{p_{0}^{t}p}italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) = square-root start_ARG italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT italic_p end_ARG. For this βt(.)\beta_{t}(.)italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( . ) function, we have the following result.

Theorem 6.2.

The following price and trader behavior dynamics yields βt(p)subscript𝛽𝑡𝑝\beta_{t}(p)italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) which obeys (33). Equivalently, the following model has a constant mean market maker with weight parameter θ𝜃\thetaitalic_θ as its optimally efficient solution,

logpexttsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡\displaystyle\log p_{ext}^{t}roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT =logptradt1+ϵσtabsentsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡1superscriptsubscriptitalic-ϵ𝜎𝑡\displaystyle=\log p_{trad}^{t-1}+\epsilon_{\sigma}^{t}= roman_log italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t - 1 end_POSTSUPERSCRIPT + italic_ϵ start_POSTSUBSCRIPT italic_σ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT (34)
logptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡\displaystyle\log p_{trad}^{t}roman_log italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT =logpextt+ϵηt,absentsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡superscriptsubscriptitalic-ϵ𝜂𝑡\displaystyle=\log p_{ext}^{t}+\epsilon_{\eta}^{t},= roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT + italic_ϵ start_POSTSUBSCRIPT italic_η end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT , (35)

where ϵσ,ϵηsubscriptitalic-ϵ𝜎subscriptitalic-ϵ𝜂\epsilon_{\sigma},\epsilon_{\eta}italic_ϵ start_POSTSUBSCRIPT italic_σ end_POSTSUBSCRIPT , italic_ϵ start_POSTSUBSCRIPT italic_η end_POSTSUBSCRIPT are independent Gaussian random variables with zero mean and variances σ,η𝜎𝜂\sigma,\etaitalic_σ , italic_η respectively, where the variances satisfy the following conditions.

σ𝜎\displaystyle\sigmaitalic_σ 1much-less-thanabsent1\displaystyle\ll 1≪ 1 (36)
η𝜂\displaystyle\etaitalic_η =σ(1/θ1)absent𝜎1𝜃1\displaystyle=\sigma\left(\sqrt{1/\theta-1}\right)= italic_σ ( square-root start_ARG 1 / italic_θ - 1 end_ARG ) (37)

The above theorem sheds light on why static curves fail to prevent arbitrage loss as effectively - the implied dynamic model that they assume is mismatched with more realistic trader behavior. This mismatch manifests itself in the following ways, as indicated by (36) and (37).

Low latency blockchain: Firstly, static curves assume that the price jumps between consecutive trades have a very small variance. This is equivalent to assuming that the inter-block times on the underlying blockchain go to 00. This is because the standard deviation of price jumps σ𝜎\sigmaitalic_σ between blocks depends on the price volatility σsuperscript𝜎\sigma^{\prime}italic_σ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT as σ=σΔt𝜎superscript𝜎Δ𝑡\sigma=\sigma^{\prime}\sqrt{\Delta t}italic_σ = italic_σ start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT square-root start_ARG roman_Δ italic_t end_ARG, where ΔtΔ𝑡\Delta troman_Δ italic_t is the inter-block arrival time. This observation confirms the conclusion reached in [55] and the broader DeFi community [5], where the arbitrage loss (or LVR) is calculated for the special case of all of the trader population being arbitrageurs and concludes that this loss indeed approaches 00 as the inter-block time goes to 00.

Constraints on noise traders: Secondly, the noise in the price that the traders see obeys a specific structure - η2=σ2(1/θ1)superscript𝜂2superscript𝜎21𝜃1\eta^{2}=\sigma^{2}(1/\theta-1)italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT = italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ( 1 / italic_θ - 1 ). For a constant product market maker, this specifically assumes that the variance of price jumps is exactly the same as the variance of the noise in trader beliefs about the price. This implies additional restrictions on price and trader behaviour that might not always be true in real markets. However, these constraints can potentially help decide how toxic and non-toxic trade flow is guided in “DEX-aggregator” such as UniswapX [24], 1inch [1], CoWSwap [9], etc. to ensure that passive LPs (that invest in pools) get a fair price as defined by (3). The main threat that such aggregators pose to passive LPs is that much of the non-toxic (or uninformed, or noise) trades get satisfied internally without any trades flowing through the pools, while the surplus (usually toxic or informed) gets routed though the passive pools [25]. The equation (36) prescribes how much non-toxic flow should be “added in the mix” to ensure fairness to the passive pool LPs.

Dominance of DEXes: Thirdly, (34) highlights another key assumption - the external market also reacts to the price on the AMM. This is only true when the AMM has an amount of liquidity that is more than the external market, which is not true for most AMM pools or decentralized exchanges today [8]. This means that static curves are guaranteed to make a loss to arbitrageurs unless decentralized exchanges become the main sources of liquidity, and the inter-block arrival time on the underlying blockchain become negligible.

7 Empirical Results

In this section, we present the empirical performance of the algorithms discussed so far in this work111Code for running all experiments has been shared here.

Refer to caption
(a) Varying price volatility σ𝜎\sigmaitalic_σ
Refer to caption
(b) Varying trader noise η𝜂\etaitalic_η
Figure 1: Percentage monetary loss per trade of our market making algorithms (Kalman Filtering and Adaptive Kalman Filtering) is much less than a static Uniswap curve for a Gaussian price jump and trader noise models

Comparison with static curves We simulate the model described in Section 3 and compare the performance of the algorithms we proposed (Figure [1]). We see that adapting the AMM curve according to algorithms 1 and 2 give a much lower monetary loss per trade than a static constant product curve that is used in Uniswap. Furthermore, the Adaptive Kalman Filter algorithm estimates the unknown market parameters correctly, leading to it achieving close performance with the optimal Kalman Filtering algorithm.

Refer to caption
(a) Varying price volatility σ𝜎\sigmaitalic_σ
Refer to caption
(b) Varying trader noise η𝜂\etaitalic_η
Figure 2: Percentage monetary loss per trade of our market making algorithms (Kalman Filtering and Adaptive Kalman Filtering) is much less than a static Uniswap curve for a Lognormal price jump and trader noise models

The same observation holds for prices that follow a geometric Brownian motion, as seen in Figure [2].

Refer to caption
(a) Root Mean Squared Deviation of external price from the price recommended by the AMM
Refer to caption
(b) Percentage monetary loss compared across AMMs
Figure 3: If the AMM is treated as an oracle, then we can use the Robust Kalman Filtering to get a more accurate reading of the hidden external price

Robustness to adversarial traders In presence of adversarial traders, the Robust Kalman Filtering algorithm is used to change the curve of the AMM gives us a more accurate reading of the hidden external price in the presence of less than 50%percent5050\%50 % of the population of traders being adversarial (Figure [3]). The adversarial traders, in this case, are assumed to perform large buy trades (with price belief ptradtsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡p_{trad}^{t}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT about 5-7 standard deviations beyond normal trading size) to keep the AMM price above the external market. We also note that the monetary loss of the AMMs against the adversary stays in the profitable region for the adaptive curves, while the static curve suffers a loss to arbitrageurs even if the adversary is making trades that are irrational.

Refer to caption
(a) Varying Volatility of Volatility
Refer to caption
(b) Changing market conditions η,σ𝜂𝜎\eta,\sigmaitalic_η , italic_σ for a single sample path
Figure 4: Percentage monetary loss per trade of our market making algorithms (Kalman Filtering and Adaptive Kalman Filtering) is much less than a static Uniswap curve for continously changing market conditions

Robustness to non-stationary markets Figure [4] tests the truncated version of the adaptive Kalman algorithm for changing market conditions. This algorithm is compared with the Kalman Filter algorithm, that knows the underlying market parameters exactly at every time step, and the static Uniswap curve. The monetary loss incurred by the AMMs is measured against changing variability of market conditions, measured by the volatility of price jump variance and trader noise (termed as volatility of volatility ση,σsubscript𝜎𝜂𝜎\sigma_{\eta,\sigma}italic_σ start_POSTSUBSCRIPT italic_η , italic_σ end_POSTSUBSCRIPT). This metric measures the standard deviation of changing η,σ𝜂𝜎\eta,\sigmaitalic_η , italic_σ after every trade, with a sample path of these changing variables shown in Figure [4(b)] for ση,σ=0.04subscript𝜎𝜂𝜎0.04\sigma_{\eta,\sigma}=0.04italic_σ start_POSTSUBSCRIPT italic_η , italic_σ end_POSTSUBSCRIPT = 0.04. Recall that η,σ𝜂𝜎\eta,\sigmaitalic_η , italic_σ themselves govern how the external price is percieved by the traders and how it changes after every trade respectively. We see that the Adaptive Kalman Filter is able to perform almost as well as the Kalman Filter when the market changes are slow enough. However, the performance advantage over static curves vanishes as the changing market conditions become more erratic. This happens because the timescale over which market parameters suffer large changes becomes comparable to the timescale of the recent history considered by the truncated adaptive Kalman filter. This observation offers guidance to AMM designers on choosing the timescale over which adaptivity can offer an advantage over static markets.

8 On-chain System Implementation

Many prior works [34, 60] seek to implement adaptive market makers on a blockchain, where the adapting is done using machine learning algorithms that must be necessarily performed off-chain because of their computational load [16]. To that end, a group of protocol validators (separate from the validators of the underlying blockchain) are assumed, who run the bulk of the computation off-chain and post their results (such as satisfied orders, their prices, etc.) on-chain. However, recent developments in Layer 2 or rollup [50, 17] infrastructure, machine learning co-processors with zero-knowledge guarantees [3, 7], has given rise to several platforms that can be utilized directly to implement the adaptive market makers (or machine learning algorithms in general) we derived in the previous sections, without any need of additional validators. We draw upon these innovations for the blockchain implementation, and divide the approach into two parts. The overall design has been shown in Figure [5].

Hook Contract: The first part of such an implementation is the liquidity pool contract, which allows the canonical interactions with LPs and traders given a specific demand/bonding curve. In the Ethereum DeFi ecosystem, a recent proposal [23] by the Uniswap protocol (called Uniswap-v4) presents a highly customizable platform for adaptive market making. The main innovation is the introduction of a “hook” smart contract [15]. While prior versions [20, 21] of the protocol presented market making in a canonical manner where the exact bonding curve followed during trade execution was static and only gave freedoms to LPs in terms of the distribution of liquidity along that fixed curve, the new platform allows the LP to specify changes to the bonding curve just before/after every single trade via the hook contract. We use this functionality to execute trades and add/remove liquidity according to the curve xθty1θt=constantsuperscript𝑥subscript𝜃𝑡superscript𝑦1subscript𝜃𝑡𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡x^{\theta_{t}}y^{1-\theta_{t}}=constantitalic_x start_POSTSUPERSCRIPT italic_θ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_POSTSUPERSCRIPT italic_y start_POSTSUPERSCRIPT 1 - italic_θ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_POSTSUPERSCRIPT = italic_c italic_o italic_n italic_s italic_t italic_a italic_n italic_t. When traders/LPs put in canonical swap/liquidity addition transactions, they are first routed through the PoolManager contract. This maps a pool to a specific Hook contract that specifies all modifications to the curve before/after trade execution. All interactions with this contract are collected as input data by the second part of the system.

Refer to caption
Figure 5: System design for an on-chain implementation of our algorithms

Off-Chain Co-processor: The second part runs the algorithm used to change the demand/bonding curve given the history of trader interactions. This is done off-chain due to the high computational load of running the EM algorithm as part of Adaptive Kalman Filtering. For our implementation, we chose Axiom [3] as a platform to run this off-chain computation. The main part of this implementation is a typescript file ZKcircuit containing the details of Algorithm 2 implemented as a algebraic circuit, so that a zero-knowledge proof can be generated corresponding to the computation [2]. This file also verifiably collects data from the previous block, and runs the algorithm to come up with new estimates for the market parameters σ,η𝜎𝜂\sigma,\etaitalic_σ , italic_η and hence the curve parameter θ𝜃\thetaitalic_θ. The off-chain Axiom client [2] posts this in the next block and is verified by the on-chain Prover contract of Axiom. This also invokes a callback to the Hook where the changes to the curve parameters are finally implemented. We provide open access to all files used in our implementation 222Code for the proof-of-concept implementation has been shared here.

9 Conclusion and Future Work

Generalising to non-Gaussian and non-stationary behavior: Traders usually do not perfectly conform to the distributional assumptions we use to derive optimal solutions in Section 5.1. Our approach can be potentially be extended to such situations by the use of Neural Kalman Filters [58], which claim to work for non-Gaussian/non-stationary state space models.

Balancing toxic and non-toxic orderflow: The blockchain-level conditions for the optimality of static curves, as outlined in Section 6, provide guidance on how toxic/non-toxic orderflow, if discriminated correctly [5], should be allowed to use passive liquidity and still give LPs a fair price. Developing DEX aggregators that aware of these conditions would help limit the dangers to passive LPs in DeFi.

Extensions to other adaptive protocols: In this work, we have derived a correspondence between a dynamical model for prices and its optimal market making curve. This principle can be extended for stable control of other DeFi protocols, such as lending, that currently use static curves.

References

Appendix A Proof of Theorem 5.1

Proof A.1.

Note that, by definition, βt(p)=E[pextt|t1,ptradt=p]subscript𝛽𝑡𝑝𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1subscriptsuperscript𝑝𝑡𝑡𝑟𝑎𝑑𝑝\beta_{t}(p)=E[p_{ext}^{t}|\mathcal{H}_{t-1},p^{t}_{trad}=p]italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) = italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_p start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT = italic_p ]. If we further define a sequence of orthogonal random variables et=ptradtE[ptradt|t1]subscript𝑒𝑡superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡subscript𝑡1e_{t}=p_{trad}^{t}-E[p_{trad}^{t}|\mathcal{H}_{t-1}]italic_e start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_E [ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ], then we have

E[ptradt|t1]𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡subscript𝑡1\displaystyle E[p_{trad}^{t}|\mathcal{H}_{t-1}]italic_E [ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] =E[pextt|t1]+E[Δptradt|t1]=E[pextt|t1],absent𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1𝐸delimited-[]conditionalΔsuperscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡subscript𝑡1𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1\displaystyle=E[p_{ext}^{t}|\mathcal{H}_{t-1}]+E[\Delta p_{trad}^{t}|\mathcal{% H}_{t-1}]=E[p_{ext}^{t}|\mathcal{H}_{t-1}],= italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] + italic_E [ roman_Δ italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] = italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] , (38)

by the independence of trader noise. This gives us that et=ptradtE[pextt|t1]subscript𝑒𝑡superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1e_{t}=p_{trad}^{t}-E[p_{ext}^{t}|\mathcal{H}_{t-1}]italic_e start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ]. By orthogonality of the sequence eττ=1tsuperscriptsubscriptdelimited-⟨⟩subscript𝑒𝜏𝜏1𝑡\langle e_{\tau}\rangle_{\tau=1}^{t}⟨ italic_e start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT, we have

E[pextt+1|t]𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡1subscript𝑡\displaystyle E[p_{ext}^{t+1}|\mathcal{H}_{t}]italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t + 1 end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ] =τ=1tE[pextt+1eτ]E[eτ2]eτabsentsuperscriptsubscript𝜏1𝑡𝐸delimited-[]superscriptsubscript𝑝𝑒𝑥𝑡𝑡1subscript𝑒𝜏𝐸delimited-[]superscriptsubscript𝑒𝜏2subscript𝑒𝜏\displaystyle=\sum_{\tau=1}^{t}\frac{E[p_{ext}^{t+1}e_{\tau}]}{E[e_{\tau}^{2}]% }e_{\tau}= ∑ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT divide start_ARG italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t + 1 end_POSTSUPERSCRIPT italic_e start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT ] end_ARG start_ARG italic_E [ italic_e start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ] end_ARG italic_e start_POSTSUBSCRIPT italic_τ end_POSTSUBSCRIPT (39)
=E[pextt+1|t1]+E[pextt+1et]E[et2]etabsent𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡1subscript𝑡1𝐸delimited-[]superscriptsubscript𝑝𝑒𝑥𝑡𝑡1subscript𝑒𝑡𝐸delimited-[]superscriptsubscript𝑒𝑡2subscript𝑒𝑡\displaystyle=E[p_{ext}^{t+1}|\mathcal{H}_{t-1}]+\frac{E[p_{ext}^{t+1}e_{t}]}{% E[e_{t}^{2}]}e_{t}= italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t + 1 end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] + divide start_ARG italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t + 1 end_POSTSUPERSCRIPT italic_e start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ] end_ARG start_ARG italic_E [ italic_e start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ] end_ARG italic_e start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT (40)
=E[pextt|t1]+E[pextt+1et]E[et2](ptradtE[pextt|t1])absent𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1𝐸delimited-[]superscriptsubscript𝑝𝑒𝑥𝑡𝑡1subscript𝑒𝑡𝐸delimited-[]superscriptsubscript𝑒𝑡2superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1\displaystyle=E[p_{ext}^{t}|\mathcal{H}_{t-1}]+\frac{E[p_{ext}^{t+1}e_{t}]}{E[% e_{t}^{2}]}(p_{trad}^{t}-E[p_{ext}^{t}|\mathcal{H}_{t-1}])= italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] + divide start_ARG italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t + 1 end_POSTSUPERSCRIPT italic_e start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ] end_ARG start_ARG italic_E [ italic_e start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ] end_ARG ( italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] ) (41)
=(1E[pextt+1et]E[et2])E[pextt|t1]+E[pextt+1et]E[et2]ptradt.absent1𝐸delimited-[]superscriptsubscript𝑝𝑒𝑥𝑡𝑡1subscript𝑒𝑡𝐸delimited-[]superscriptsubscript𝑒𝑡2𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1𝐸delimited-[]superscriptsubscript𝑝𝑒𝑥𝑡𝑡1subscript𝑒𝑡𝐸delimited-[]superscriptsubscript𝑒𝑡2superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡\displaystyle=(1-\frac{E[p_{ext}^{t+1}e_{t}]}{E[e_{t}^{2}]})E[p_{ext}^{t}|% \mathcal{H}_{t-1}]+\frac{E[p_{ext}^{t+1}e_{t}]}{E[e_{t}^{2}]}p_{trad}^{t}.= ( 1 - divide start_ARG italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t + 1 end_POSTSUPERSCRIPT italic_e start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ] end_ARG start_ARG italic_E [ italic_e start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ] end_ARG ) italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] + divide start_ARG italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t + 1 end_POSTSUPERSCRIPT italic_e start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ] end_ARG start_ARG italic_E [ italic_e start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ] end_ARG italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT . (42)

Here, we know that E[pextt+1et]E[et2]:=Ktassign𝐸delimited-[]superscriptsubscript𝑝𝑒𝑥𝑡𝑡1subscript𝑒𝑡𝐸delimited-[]superscriptsubscript𝑒𝑡2subscript𝐾𝑡\frac{E[p_{ext}^{t+1}e_{t}]}{E[e_{t}^{2}]}:=K_{t}divide start_ARG italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t + 1 end_POSTSUPERSCRIPT italic_e start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ] end_ARG start_ARG italic_E [ italic_e start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ] end_ARG := italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT is the Kalman gain at time t𝑡titalic_t, that can be computed iteratively using the Kalman filtering algorithm [49]. Using this, the above equation (42) can be equivalently written as

E[pextt|t1,ptradt=p]𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1subscriptsuperscript𝑝𝑡𝑡𝑟𝑎𝑑𝑝\displaystyle E[p_{ext}^{t}|\mathcal{H}_{t-1},p^{t}_{trad}=p]italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_p start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT = italic_p ] =(1Kt)E[pextt|t1]+Ktp.absent1subscript𝐾𝑡𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1subscript𝐾𝑡𝑝\displaystyle=(1-K_{t})E[p_{ext}^{t}|\mathcal{H}_{t-1}]+K_{t}p.= ( 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] + italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT italic_p . (43)

Thus, we can solve the fixed point condition (11) for the initial operating point as

p𝑝\displaystyle pitalic_p =βt(p)absentsubscript𝛽𝑡𝑝\displaystyle=\beta_{t}(p)= italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) (44)
p𝑝\displaystyle pitalic_p =(1Kt)E[pextt|t1]+Ktpabsent1subscript𝐾𝑡𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1subscript𝐾𝑡𝑝\displaystyle=(1-K_{t})E[p_{ext}^{t}|\mathcal{H}_{t-1}]+K_{t}p= ( 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] + italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT italic_p (45)
p𝑝\displaystyle pitalic_p =E[pextt|t1],absent𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1\displaystyle=E[p_{ext}^{t}|\mathcal{H}_{t-1}],= italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] , (46)

which gives us a unique solution to the initial operating point p0tsuperscriptsubscript𝑝0𝑡p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT of the market. Thus, we can now write βt(p)=(1Kt)p0t+Ktpsubscript𝛽𝑡𝑝1subscript𝐾𝑡superscriptsubscript𝑝0𝑡subscript𝐾𝑡𝑝\beta_{t}(p)=(1-K_{t})p_{0}^{t}+K_{t}pitalic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) = ( 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT + italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT italic_p.

Substituting this in the differential equation (10) gives us

gt(p)(1Kt)(p0tp)+gt(p)Ktx0tKt=0superscriptsubscript𝑔𝑡𝑝1subscript𝐾𝑡superscriptsubscript𝑝0𝑡𝑝subscript𝑔𝑡𝑝subscript𝐾𝑡superscriptsubscript𝑥0𝑡subscript𝐾𝑡0\displaystyle g_{t}^{\prime}(p)(1-K_{t})(p_{0}^{t}-p)+g_{t}(p)K_{t}-x_{0}^{t}K% _{t}=0italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ( italic_p ) ( 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_p ) + italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT - italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = 0 (47)

which gives us the general solution

gt(p)=x0tCt(pp0t)Kt1Kt,subscript𝑔𝑡𝑝superscriptsubscript𝑥0𝑡subscript𝐶𝑡superscript𝑝superscriptsubscript𝑝0𝑡subscript𝐾𝑡1subscript𝐾𝑡\displaystyle g_{t}(p)=x_{0}^{t}-C_{t}(p-p_{0}^{t})^{\frac{K_{t}}{1-K_{t}}},italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) = italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_C start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p - italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT divide start_ARG italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_ARG start_ARG 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_ARG end_POSTSUPERSCRIPT , (48)

where the constant Ct>0subscript𝐶𝑡0C_{t}>0italic_C start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT > 0 is a solution to the boundary condition y0t=0p0tpgt(p)𝑑psuperscriptsubscript𝑦0𝑡superscriptsubscript0superscriptsubscript𝑝0𝑡𝑝superscriptsubscript𝑔𝑡𝑝differential-d𝑝y_{0}^{t}=-\int_{0}^{p_{0}^{t}}pg_{t}^{\prime}(p)dpitalic_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = - ∫ start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT italic_p italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ( italic_p ) italic_d italic_p. While this function is well defined for pp0t𝑝superscriptsubscript𝑝0𝑡p\geq p_{0}^{t}italic_p ≥ italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT, it is not well defined for p<p0t𝑝superscriptsubscript𝑝0𝑡p<p_{0}^{t}italic_p < italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. However, if we set Ct=0subscript𝐶𝑡0C_{t}=0italic_C start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = 0 by forcing gt(p)subscript𝑔𝑡𝑝g_{t}(p)italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) to be constant on either side of p=p0t𝑝superscriptsubscript𝑝0𝑡p=p_{0}^{t}italic_p = italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT, then we get the solution in the statement of the theorem.

Appendix B Proof of Theorem 5.2

Proof B.1.

As before, we derive an expression for βt(p)subscript𝛽𝑡𝑝\beta_{t}(p)italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) first. In this case, we have

βt(p)subscript𝛽𝑡𝑝\displaystyle\beta_{t}(p)italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) =E[pextt|t1,ptradt=p]absent𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝\displaystyle=E[p_{ext}^{t}|\mathcal{H}_{t-1},p_{trad}^{t}=p]= italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = italic_p ] (49)
=E[elogpextt|t1,ptradt=p]absent𝐸delimited-[]conditionalsuperscript𝑒superscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝\displaystyle=E[e^{\log p_{ext}^{t}}|\mathcal{H}_{t-1},p_{trad}^{t}=p]= italic_E [ italic_e start_POSTSUPERSCRIPT roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = italic_p ] (50)

We know that E[logpextt|t1,ptradt=p]=(1Kt)E[logpextt|t1]+Ktlogp𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝1subscript𝐾𝑡𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1subscript𝐾𝑡𝑝E[\log p_{ext}^{t}|\mathcal{H}_{t-1},p_{trad}^{t}=p]=(1-K_{t})E[\log p_{ext}^{% t}|\mathcal{H}_{t-1}]+K_{t}\log pitalic_E [ roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = italic_p ] = ( 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) italic_E [ roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] + italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT roman_log italic_p, where Ktsubscript𝐾𝑡K_{t}italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT is the Kalman gain corresponding to the process logptradττ=1tsuperscriptsubscriptdelimited-⟨⟩superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝜏𝜏1𝑡\langle\log p_{trad}^{\tau}\rangle_{\tau=1}^{t}⟨ roman_log italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_τ end_POSTSUPERSCRIPT ⟩ start_POSTSUBSCRIPT italic_τ = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT. Using the formula for change of variables of random variables, we get

E[elogpextt|t1,ptradt=p]𝐸delimited-[]conditionalsuperscript𝑒superscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝\displaystyle E[e^{\log p_{ext}^{t}}|\mathcal{H}_{t-1},p_{trad}^{t}=p]italic_E [ italic_e start_POSTSUPERSCRIPT roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = italic_p ] =exp(E[logpextt|t1,ptradt=p]+Pt|t2)absent𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝subscript𝑃conditional𝑡𝑡2\displaystyle=\exp\left(E[{\log p_{ext}^{t}}|\mathcal{H}_{t-1},p_{trad}^{t}=p]% +\frac{P_{t|t}}{2}\right)= roman_exp ( italic_E [ roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = italic_p ] + divide start_ARG italic_P start_POSTSUBSCRIPT italic_t | italic_t end_POSTSUBSCRIPT end_ARG start_ARG 2 end_ARG ) (51)
=exp((1Kt)E[logpextt|t1]+Ktlogp+Pt|t2).absent1subscript𝐾𝑡𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1subscript𝐾𝑡𝑝subscript𝑃conditional𝑡𝑡2\displaystyle=\exp\left((1-K_{t})E[\log p_{ext}^{t}|\mathcal{H}_{t-1}]+K_{t}% \log p+\frac{P_{t|t}}{2}\right).= roman_exp ( ( 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) italic_E [ roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] + italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT roman_log italic_p + divide start_ARG italic_P start_POSTSUBSCRIPT italic_t | italic_t end_POSTSUBSCRIPT end_ARG start_ARG 2 end_ARG ) . (52)

where Pt|tsubscript𝑃conditional𝑡𝑡P_{t|t}italic_P start_POSTSUBSCRIPT italic_t | italic_t end_POSTSUBSCRIPT is the variance of the estimate E[logpextt|t1]𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1E[\log p_{ext}^{t}|\mathcal{H}_{t-1}]italic_E [ roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ], and Ktsubscript𝐾𝑡K_{t}italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT is the Kalman gain corresponding to the same estimate. We can now use the fixed point condition (11) and get

p=exp((1Kt)E[logpextt|t1]+Ktlogp+Pt|t2),𝑝1subscript𝐾𝑡𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1subscript𝐾𝑡𝑝subscript𝑃conditional𝑡𝑡2\displaystyle p=\exp\left((1-K_{t})E[\log p_{ext}^{t}|\mathcal{H}_{t-1}]+K_{t}% \log p+\frac{P_{t|t}}{2}\right),italic_p = roman_exp ( ( 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) italic_E [ roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] + italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT roman_log italic_p + divide start_ARG italic_P start_POSTSUBSCRIPT italic_t | italic_t end_POSTSUBSCRIPT end_ARG start_ARG 2 end_ARG ) , (53)

which, when solved further, gives us the initial operating point of the curve as

p0tsuperscriptsubscript𝑝0𝑡\displaystyle p_{0}^{t}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT =exp(E[logpextt|t1]+Pt|t2(1Kt)).absent𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1subscript𝑃conditional𝑡𝑡21subscript𝐾𝑡\displaystyle=\exp{\left(E[\log p_{ext}^{t}|\mathcal{H}_{t-1}]+\frac{P_{t|t}}{% 2(1-K_{t})}\right)}.= roman_exp ( italic_E [ roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT ] + divide start_ARG italic_P start_POSTSUBSCRIPT italic_t | italic_t end_POSTSUBSCRIPT end_ARG start_ARG 2 ( 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) end_ARG ) . (54)

Defining κt=exp(Pt|t2(1Kt))subscript𝜅𝑡subscript𝑃conditional𝑡𝑡21subscript𝐾𝑡\kappa_{t}=\exp{\left(\frac{P_{t|t}}{2(1-K_{t})}\right)}italic_κ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = roman_exp ( divide start_ARG italic_P start_POSTSUBSCRIPT italic_t | italic_t end_POSTSUBSCRIPT end_ARG start_ARG 2 ( 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) end_ARG ), this leads to the following differential equation for the curve -

(κtpKtp)gt(p)+κtKtpKt1(gt(p)x0t)=0subscript𝜅𝑡superscript𝑝subscript𝐾𝑡𝑝superscriptsubscript𝑔𝑡𝑝subscript𝜅𝑡subscript𝐾𝑡superscript𝑝subscript𝐾𝑡1subscript𝑔𝑡𝑝superscriptsubscript𝑥0𝑡0\displaystyle(\kappa_{t}p^{K_{t}}-p)g_{t}^{\prime}(p)+\kappa_{t}K_{t}p^{K_{t}-% 1}(g_{t}(p)-x_{0}^{t})=0( italic_κ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT italic_p start_POSTSUPERSCRIPT italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_POSTSUPERSCRIPT - italic_p ) italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ( italic_p ) + italic_κ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT italic_p start_POSTSUPERSCRIPT italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT - 1 end_POSTSUPERSCRIPT ( italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) - italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) = 0 (55)

which has the solution

gt(p)=x0tCt(p1Ktκt)Kt1KtpKtsubscript𝑔𝑡𝑝superscriptsubscript𝑥0𝑡subscript𝐶𝑡superscriptsuperscript𝑝1subscript𝐾𝑡subscript𝜅𝑡subscript𝐾𝑡1subscript𝐾𝑡superscript𝑝subscript𝐾𝑡\displaystyle g_{t}(p)=x_{0}^{t}-C_{t}(p^{1-K_{t}}-\kappa_{t})^{\frac{K_{t}}{1% -K_{t}}}p^{K_{t}}italic_g start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) = italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT - italic_C start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p start_POSTSUPERSCRIPT 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_POSTSUPERSCRIPT - italic_κ start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT divide start_ARG italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_ARG start_ARG 1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_ARG end_POSTSUPERSCRIPT italic_p start_POSTSUPERSCRIPT italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_POSTSUPERSCRIPT (56)

The rest of the proof follows in a way similar to Theorem 5.1.

Appendix C Proof of Theorem 6.1

Proof C.1.

For a static curve, pSCT=ptradTsuperscriptsubscript𝑝𝑆𝐶𝑇superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑇p_{SC}^{T}=p_{trad}^{T}italic_p start_POSTSUBSCRIPT italic_S italic_C end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT = italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_T end_POSTSUPERSCRIPT, which gives us the MSE as η2superscript𝜂2\eta^{2}italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT by definition.

For Algorithm 1, we see that the variance of the estimate is P0|0=σ2subscript𝑃conditional00superscript𝜎2P_{0|0}=\sigma^{2}italic_P start_POSTSUBSCRIPT 0 | 0 end_POSTSUBSCRIPT = italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT. After that, we update the variance according to Line 12 in the algorithm. After trade t>1𝑡1t>1italic_t > 1, the Kalman gain is Kt=Pt1|t1Pt1|t1+η2subscript𝐾𝑡subscript𝑃𝑡conditional1𝑡1subscript𝑃𝑡conditional1𝑡1superscript𝜂2K_{t}=\frac{P_{t-1|t-1}}{P_{t-1|t-1}+\eta^{2}}italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = divide start_ARG italic_P start_POSTSUBSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUBSCRIPT end_ARG start_ARG italic_P start_POSTSUBSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUBSCRIPT + italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG, which implies that 1Kt=η2Pt1|t1+η21subscript𝐾𝑡superscript𝜂2subscript𝑃𝑡conditional1𝑡1superscript𝜂21-K_{t}=\frac{\eta^{2}}{P_{t-1|t-1}+\eta^{2}}1 - italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT = divide start_ARG italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_ARG italic_P start_POSTSUBSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUBSCRIPT + italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG. This gives us

Pt|tsubscript𝑃conditional𝑡𝑡\displaystyle P_{t|t}italic_P start_POSTSUBSCRIPT italic_t | italic_t end_POSTSUBSCRIPT =η2Pt1|t1+η2Pt1|t1,absentsuperscript𝜂2subscript𝑃𝑡conditional1𝑡1superscript𝜂2subscript𝑃𝑡conditional1𝑡1\displaystyle=\frac{\eta^{2}}{P_{t-1|t-1}+\eta^{2}}P_{t-1|t-1},= divide start_ARG italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_ARG italic_P start_POSTSUBSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUBSCRIPT + italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG italic_P start_POSTSUBSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUBSCRIPT , (57)

or, equivalently

1Pt|t1subscript𝑃conditional𝑡𝑡\displaystyle\frac{1}{P_{t|t}}divide start_ARG 1 end_ARG start_ARG italic_P start_POSTSUBSCRIPT italic_t | italic_t end_POSTSUBSCRIPT end_ARG =1η2+1Pt1|t1.absent1superscript𝜂21subscript𝑃𝑡conditional1𝑡1\displaystyle=\frac{1}{\eta^{2}}+\frac{1}{P_{t-1|t-1}}.= divide start_ARG 1 end_ARG start_ARG italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG + divide start_ARG 1 end_ARG start_ARG italic_P start_POSTSUBSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUBSCRIPT end_ARG . (58)

Writing the sum for t=T𝑡𝑇t=Titalic_t = italic_T till t=0𝑡0t=0italic_t = 0 gives us

1Pt|t1subscript𝑃conditional𝑡𝑡\displaystyle\frac{1}{P_{t|t}}divide start_ARG 1 end_ARG start_ARG italic_P start_POSTSUBSCRIPT italic_t | italic_t end_POSTSUBSCRIPT end_ARG =Tη2+1σ2,absent𝑇superscript𝜂21superscript𝜎2\displaystyle=\frac{T}{\eta^{2}}+\frac{1}{\sigma^{2}},= divide start_ARG italic_T end_ARG start_ARG italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG + divide start_ARG 1 end_ARG start_ARG italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG , (59)

which proves the desired result.

Appendix D Proof of Theorem 6.2

Proof D.1.

We can adapt the Kalman filter updates and apply them to Equations (34) and (35). Since ptradt1superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡1p_{trad}^{t-1}italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t - 1 end_POSTSUPERSCRIPT is observed exactly by the market maker, we have Pt1|t1=0subscript𝑃𝑡conditional1𝑡10P_{t-1|t-1}=0italic_P start_POSTSUBSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUBSCRIPT = 0. This gives us the Kalman gain as

Ktsubscript𝐾𝑡\displaystyle K_{t}italic_K start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT =Pt1|t1+σ2Pt1|t1+σ2+η2absentsubscript𝑃𝑡conditional1𝑡1superscript𝜎2subscript𝑃𝑡conditional1𝑡1superscript𝜎2superscript𝜂2\displaystyle=\frac{P_{t-1|t-1}+\sigma^{2}}{P_{t-1|t-1}+\sigma^{2}+\eta^{2}}= divide start_ARG italic_P start_POSTSUBSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUBSCRIPT + italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_ARG italic_P start_POSTSUBSCRIPT italic_t - 1 | italic_t - 1 end_POSTSUBSCRIPT + italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_η start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG (60)
=0+σ20+σ2+σ2(1/θ1)absent0superscript𝜎20superscript𝜎2superscript𝜎21𝜃1\displaystyle=\frac{0+\sigma^{2}}{0+\sigma^{2}+\sigma^{2}(1/\theta-1)}= divide start_ARG 0 + italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_ARG 0 + italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ( 1 / italic_θ - 1 ) end_ARG (61)
=θabsent𝜃\displaystyle=\theta= italic_θ (62)

The Kalman estimate then becomes

E[logpextt|t1,ptradt=p]𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝\displaystyle E[\log p_{ext}^{t}|\mathcal{H}_{t-1},p_{trad}^{t}=p]italic_E [ roman_log italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = italic_p ] =(1θ)logptradt1+θlogpabsent1𝜃superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡1𝜃𝑝\displaystyle=(1-\theta)\log p_{trad}^{t-1}+\theta\log p= ( 1 - italic_θ ) roman_log italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t - 1 end_POSTSUPERSCRIPT + italic_θ roman_log italic_p (63)

This implies that we can write βt(p)subscript𝛽𝑡𝑝\beta_{t}(p)italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) as

βt(p)subscript𝛽𝑡𝑝\displaystyle\beta_{t}(p)italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) =E[pextt|t1,ptradt=p]absent𝐸delimited-[]conditionalsuperscriptsubscript𝑝𝑒𝑥𝑡𝑡subscript𝑡1superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡𝑝\displaystyle=E[p_{ext}^{t}|\mathcal{H}_{t-1},p_{trad}^{t}=p]= italic_E [ italic_p start_POSTSUBSCRIPT italic_e italic_x italic_t end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT | caligraphic_H start_POSTSUBSCRIPT italic_t - 1 end_POSTSUBSCRIPT , italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = italic_p ] (64)
=exp((1θ)logptradt1+θlogp+σ22(1θ))absent1𝜃superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡1𝜃𝑝superscript𝜎221𝜃\displaystyle=\exp\left((1-\theta)\log p_{trad}^{t-1}+\theta\log p+\frac{% \sigma^{2}}{2(1-\theta)}\right)= roman_exp ( ( 1 - italic_θ ) roman_log italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t - 1 end_POSTSUPERSCRIPT + italic_θ roman_log italic_p + divide start_ARG italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_ARG 2 ( 1 - italic_θ ) end_ARG ) (65)

Note that, for static curves, the previous trader price is directly used as the initial operating point for the next trader. This means that p0t=ptradt1superscriptsubscript𝑝0𝑡superscriptsubscript𝑝𝑡𝑟𝑎𝑑𝑡1p_{0}^{t}=p_{trad}^{t-1}italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT = italic_p start_POSTSUBSCRIPT italic_t italic_r italic_a italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t - 1 end_POSTSUPERSCRIPT. Substituting this gives us

βt(p)subscript𝛽𝑡𝑝\displaystyle\beta_{t}(p)italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) =pθ(p0t)1θeσ22(1θ)absentsuperscript𝑝𝜃superscriptsuperscriptsubscript𝑝0𝑡1𝜃superscript𝑒superscript𝜎221𝜃\displaystyle=p^{\theta}(p_{0}^{t})^{1-\theta}e^{\frac{\sigma^{2}}{2(1-\theta)}}= italic_p start_POSTSUPERSCRIPT italic_θ end_POSTSUPERSCRIPT ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT 1 - italic_θ end_POSTSUPERSCRIPT italic_e start_POSTSUPERSCRIPT divide start_ARG italic_σ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_ARG 2 ( 1 - italic_θ ) end_ARG end_POSTSUPERSCRIPT (66)

We now compare (33) and (66) for σ1much-less-than𝜎1\sigma\ll 1italic_σ ≪ 1. By (34), we know that as σ0𝜎0\sigma\rightarrow 0italic_σ → 0, p0tp1superscriptsubscript𝑝0𝑡𝑝1\frac{p_{0}^{t}}{p}\rightarrow 1divide start_ARG italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT end_ARG start_ARG italic_p end_ARG → 1. Using this in the last term in (33) gives us

limp0t/p11(p0t/p)θ1(p0t/p)1θsubscriptsuperscriptsubscript𝑝0𝑡𝑝11superscriptsuperscriptsubscript𝑝0𝑡𝑝𝜃1superscriptsuperscriptsubscript𝑝0𝑡𝑝1𝜃\displaystyle\lim_{p_{0}^{t}/p\rightarrow 1}\frac{1-(p_{0}^{t}/p)^{\theta}}{1-% (p_{0}^{t}/p)^{1-\theta}}roman_lim start_POSTSUBSCRIPT italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT / italic_p → 1 end_POSTSUBSCRIPT divide start_ARG 1 - ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT / italic_p ) start_POSTSUPERSCRIPT italic_θ end_POSTSUPERSCRIPT end_ARG start_ARG 1 - ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT / italic_p ) start_POSTSUPERSCRIPT 1 - italic_θ end_POSTSUPERSCRIPT end_ARG =θ1θabsent𝜃1𝜃\displaystyle=\frac{\theta}{1-\theta}= divide start_ARG italic_θ end_ARG start_ARG 1 - italic_θ end_ARG (67)

which gives us βt(p)=pθ(p0t)1θsubscript𝛽𝑡𝑝superscript𝑝𝜃superscriptsuperscriptsubscript𝑝0𝑡1𝜃\beta_{t}(p)=p^{\theta}(p_{0}^{t})^{1-\theta}italic_β start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT ( italic_p ) = italic_p start_POSTSUPERSCRIPT italic_θ end_POSTSUPERSCRIPT ( italic_p start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_t end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT 1 - italic_θ end_POSTSUPERSCRIPT in (33). The same expression is also obtained from (66) as σ0𝜎0\sigma\rightarrow 0italic_σ → 0.