Skip to content
All library documents

Decentralized Crypto Market Making and Cross-Exchange Strategies

PDF Hummingbot docs

Summary

This paper explains why liquidity in digital asset markets is concentrated in a small number of assets and venues, then presents Hummingbot as open-source software intended to make automated market making more accessible. It describes quoting bids and asks, inventory exposure, arbitrage across venues, and cross-exchange market making. The latter places maker orders on one venue while using prices from another as a reference; the paper discusses implementation needs, including exchange APIs, order management, and inventory rebalancing.

The rationale is that fragmented markets, variable fees, and differing prices can create opportunities, while digital markets offer direct API access and fewer traditional barriers to entry. The paper supports this framing with historical market-volume figures and examples of exchange and infrastructure constraints, rather than controlled evidence of strategy profitability. It also emphasizes substantial risks: volatile prices, adverse selection, inventory imbalance, unreliable feeds or APIs, delayed execution, and the need to move assets between exchanges. Its analysis and market statistics date from 2018, so they should not be treated as current market conditions.

Key ideas

  • Market making supplies liquidity by quoting simultaneous buy and sell prices.
  • Digital asset liquidity is fragmented across many exchanges and concentrated in a small set of assets.
  • Cross-exchange market making uses one venue’s prices to guide quotes on another.
  • Market makers face inventory risk, adverse selection, execution delays, and exchange reliability problems.
  • Automated rebalancing can transfer assets between venues when balances cross specified thresholds.

Tags

Full text
# hummingbot



Hummingbot
Decentralized market making
CoinAlpha Inc.
https://www.coinalpha.com/
December 24, 2018
Abstract
Tokenization not only brings the promise of increased efficiency in the conveyance
of currently tradable assets, it also has the potential to unlock liquidity for previously non-tradable assets. However, one impediment to fully realizing this state is
the general lack of liquidity for all but a limited number of top digital assets trading
on centralized exchanges. The growth in the number of cryptocurrency exchanges as
well as digital assets has far surpassed the increase in the number of and capabilities
of cryptocurrency market makers, leading to liquidity fragmentation and inadequacy
across exchanges and assets. Contributing to the lack of liquidity for some trading
venues, in particular decentralized exchanges, is the increased technical complexity
of transacting through native blockchain protocols as well as a lack of technical standardization. Meanwhile, these inefficiencies also create market trading opportunities
for capable traders. With the goal of overcoming these limitations, we introduce
Hummingbot, open source software that enables users to create custom, automated
trading strategies that can transact on both centralized and decentralized exchanges.
Hummingbot’s objective is to enable a broader set of users to act as market makers, an activity previously limited to only sophisticated and highly technical market
participants, and promote the concept of decentralized market making.
1


Contents
1 BACKGROUND 4
1.1 Liquidity Is a Scarce Resource . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Market Making in Fiat Markets . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Market Making in Digital Markets . . . . . . . . . . . . . . . . . . . . . . . 5
2 DECENTRALIZED MARKET MAKING 6
2.1 Rationale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.1 Lower Cost of Capital . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.2 Fundamental Conviction . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Introducing Hummingbot . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.1 Related works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.2 Target Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3 STRATEGIES 9
3.1 Market making . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.1 Inventory Implications for Market Makers . . . . . . . . . . . . . . 11
3.1.2 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 Arbitrage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.2.1 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.3 Cross-Exchange Market Making . . . . . . . . . . . . . . . . . . . . . . . . 16
3.3.1 Cross-Exchange Market Making Implementation . . . . . . . . . . . 18
3.3.2 Inventory Risk and Implication for Strategy Applicability . . . . . . 20
4 THE HUMMINGBOT CLIENT 21
2


4.1 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.1.1 Reliability Engineering . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.1.2 Strategy Implementation . . . . . . . . . . . . . . . . . . . . . . . . 23
4.1.3 Rebalancing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3


1 BACKGROUND
1.1 Liquidity Is a Scarce Resource
Proponents of tokenization, the process of creating a digital asset transferrable on a public
distributed ledger, espouse its ability to unlock the liquidity premium in asset classes such
as startups, real estate, and private equity. This is supported by academic research, which
has shown that liquidity benefits market participants via efficient price discovery. Liquidity
improvement improves the availability of public information about a firm, and improved
information will lower the risk premium of the firm, thus decreasing its cost of capital [1].
Yet in practice, tokenization has led to extreme concentration of liquidity. There are
thousands of tradeable digital assets and hundreds of exchanges, but liquidity is heavily
concentrated in the top assets and venues. The top three digital assets have a combined
daily exchange trading volume of $12 billion, 72% of total daily exchange trading volume.
Of the more than 2,000 crypto assets listed in CoinMarketCap, 92% have less than $1
million in daily volume [2]. Factoring in over-the-counter trading (OTC) volume between
institutions, which deal almost exclusively in the largest digital assets, would likely further
increase liquidity concentration.
When the number of markets increases relative to the number of liquidity providers, a
power-law distribution for liquidity is the natural equilibrium state. In a hearing on capital
markets before the United State House of Representatives in 2011, Eric Noll from Nasdaq
spoke about the challenges faced by small-capitalization stocks after the rise of alternative
trading systems and dark pools for equities: “The unintended consequences of that market
fragmentation have been a lack of liquidity and price discovery in listed securities outside of
the top 100 traded names and a disturbing absence of market attention paid to small-growth
companies by all market participants, including exchanges [3].”
While tokenization enables assets to trade freely, it does not automatically confer liquidity
onto them. In order for the global financial system to fully realize the value of tokenization,
there needs to be sufficient actors who are both incentivized and equipped to provide
liquidity, especially for the long tail of tokenized assets.
1.2 Market Making in Fiat Markets
Providers of liquidity on financial markets are called market makers. Market makers play
a fundamental role in asset markets by simultaneously quoting bid (offers to buy) and
ask (offers to sell) prices for assets on an exchange. By quoting prices at which they stand
ready to buy and sell assets, they enable price discovery and liquid trading by other market
4


participants. In addition, by quoting prices on different trading venues and arbitraging away
inter-market dislocations across different markets, market makers increase overall market
efficiency.
In traditional securities markets such as equities, regulatory barriers prevent individuals and
small firms from filling the market maker role. On the New York Stock Exchange (NYSE),
only member organizations who have been granted approval to act as Designated Market
Makers and Supplemental Liquidity Providers are allowed to make markets. Similarly,
Nasdaq market makers are required to register with FINRA and apply to be a Nasdaq
member firm [4].
In addition, competitive barriers also prevent small participants from acting as market
makers. In a practice known as co-location, high frequency trading (”HFT”) firms pay
exchanges to place servers in close physical proximity to the exchange’s own servers, providing lower latency access to data feeds and trade execution. HFT firms have collectively
spent massive sums building networks of wireless towers, fiber optic lines and submarine
cables designed to provide millisecond-scale time advantages versus other market participants. Furthermore, fiat exchanges like NYSE and Nasdaq charge as much as $22,000 per
month for access to market data feeds [5].
Since HFT firms earn profits by performing a high volume of trades, they tend to focus on
making markets in large-capitalization stocks. In a 2011 House of Representatives hearing,
Joseph Mecane of NYSE Euronext said, “A lot of the spread compression and increased
competition that we have seen has been in the very large liquid stocks where you have
seen a lot of algorithmic type trading, high-frequency-type trading, which tends to narrow
the spread and make it very cheap and efficient and fast for the large-cap stocks to trade.
The unfortunate reality is those same trends haven’t occurred in the small- and mid-cap
part of the market. Those stocks don’t have sufficient liquidity for the high-frequencytype automated traders to traffic in those names, and as a result, you have not seen a
commensurate level of volume or liquidity or spread compression that you have seen in
some of the large-cap names [3].”
1.3 Market Making in Digital Markets
Digital markets remove the regulatory and competitive constraints that impede market
making in fiat markets. Individual traders have direct market access to digital asset exchanges, enabling them to provide price quotes and execute trades programmatically using
the same APIs as professional firms. Digital asset exchanges also provide market data feeds
free of charge.
While certain exchanges provide volume-based fee rebates that favor professional trading
firms, they generally do not offer co-location or other features that provide significant
5


competitive advantages to large players at the expense of smaller ones. In addition, since
the digital asset exchange landscape is highly competitive with hundreds of active, globally
accessible venues, exchanges who introduce anti-competitive features would likely lose business from individual traders and small firms who move their activities to other exchanges.
Yet despite the removal of the regulatory and competitive barriers to market making, there
remains relatively few market makers compared to the proliferation of digital assets and
exchanges, leading to the extreme concentration in liquidity mentioned earlier. Market
makers for digital assets, primarily quantitative hedge funds and trading firms, are in high
demand, evidenced by the compensation they receive from both exchanges and issuers.
Most exchanges charge higher commissions for takers (traders who fill existing price quotes)
and a lower or zero commission for makers (traders who provide price quotes). Some
exchanges also provide rebates to market makers that may exceed their total commissions.
Technical barriers prevent additional entrants from making markets for digital assets. Due
to the highly volatile nature of digital asset prices, market makers need to utilize an automated, algorithmic approach in order to stay competitive. Unlike in fiat markets where
the Financial Information eXchange (FIX) Protocol provides a standardized message format for electronic trading, digital asset exchange APIs vary in both format and reliability.
Market making algorithms need to handle edge cases such as stale data, trade execution
lag, and API downtime. Writing robust, reliable market making algorithms that can trade
on multiple exchanges requires significant specialized engineering resources.
2 DECENTRALIZED MARKET MAKING
When market making is the exclusive province of large institutions, both fiat and digital
markets show that liquidity becomes highly concentrated in the top assets and trading
venues. Yet for tokenization to succeed and inject liquidity into formerly illiquid assets,
there need to be liquidity providers who are both incentivized and equipped to make markets in a wide range of tokenized assets, not just the top ones.
While direct market access and the absence of competitive barriers like co-location allow for
new entrants in digital asset market making, technical barriers remain high. By lowering
these technical barriers and introducing new incentive mechanisms, we enable anyone to
act as a market maker for digital assets, a new model for liquidity provision that we call
decentralized market making.
6


2.1 Rationale
While market making has historically been exclusive to highly specialized professional trading firms, individuals and long-term investors may actually have structural advantages in
filling this function for digital assets.
2.1.1 Lower Cost of Capital
Since market makers need to hold inventory for each trading pair and venue on which they
provide price quotes, they need to factor in the opportunity cost of that inventory, which
may be more profitably utilized in a more profitable market. Moreover, since funds and
trading firms are capitalized by external investors, return on capital from market making
may need to exceed 20% or greater. In thinly traded markets without the volume to support
this return on capital threshold, it may not be economically rational for professional market
makers to participate.
In contrast, individuals and long-term investors have lower opportunity costs. Since borrowing and lending markets for digital assets are still nascent, most individuals and long-term
investors buy and hold them in wallets or exchanges and do not earn interest or other
incremental income from them. For these investors, their return on capital threshold is
0%, and assuming risk neutrality, they should be willing market makers for any market in
which they expect a positive return.
2.1.2 Fundamental Conviction
Professional market makers are less likely to have conviction on fundamental value for a
digital asset; they generally approach market making from a purely technical perspective.
This makes them ill-suited to make markets in illiquid, volatile assets without a lengthy
record of trading activity. When prices drop sharply and approach zero, their typical
recourse is liquidation.
Individual token holders and long-term investors, however, are more likely to have fundamental conviction. Since their price floor for an digital asset is utility value (in the case of
individuals) or investment valuation (in case of investors), they are better equipped to be
buyers of last resort and make markets for illiquid, volatile assets.
7


2.2 Introducing Hummingbot
As a first step toward enabling decentralized market making, we introduce Hummingbot,
an open source software client that allows users to create and customize automated, algorithmic trading bots for making markets on both centralized and decentralized digital
asset exchanges. Since Hummingbot needs to access sensitive digital asset private keys and
exchange API keys to operate automatically, we design it as a user-operated local or hosted
client, similar to a cryptocurrency mining node.
2.2.1 Related works
Hummingbot builds upon and extends the work of other open source market making tools
for digital assets. These include exchange-specific or asset-specific tools for BitMex [6],
MakerDAO’s DAI stablecoin [7], and the BitShares decentralized exchange [8].
Furthermore, other open source projects enable automated strategies for market making
[9], exchange arbitrage [10], and general algorithmic trading [11] of digital assets.
Hummingbot differs from these other tools in a following areas:
1. Exchange and asset agnostic: Hummingbot is designed to make markets across
all exchanges and all digital assets
2. DEX compatibility: Hummingbot supports market making on decentralized exchanges
3. Cross exchange market making: Hummingbot supports a strategy that profits
from differences from liquidity between exchanges that offer markets in the same
trading pair (see Strategies section for more details)
4. Simpler installation and configuration: Hummingbot is designed to be installed
and used by non-technical users
In addition, smart contract-based automated market makers such as Bancor Network and
Uniswap [12] provide liquidity for tokenized assets according to deterministic algorithms.
Given the dynamic nature of markets, we believe that a deterministic approach alone
may not provide a complete liquidity solution. We plan to integrate these services into
Hummingbot as additional channels for users to both source and provide liquidity.
8


2.2.2 Target Users
Individual Hobbyists
Hummingbot is aimed at cryptocurrency enthusiasts who want to actively participate
in strengthening blockchain-based networks while simultaneously earning passive income.
Similar to other software clients such as a mining node in proof-of-work blockchains, a
staking node in proof-of-stake blockchain, and a validator node in the Cosmos protocol,
Hummingbot enables users to perform a specialized service for profit.
Long-Term Fund Investors
In addition, Hummingbot enables crypto hedge funds and other long-term investors to
utilize their inventory of digital assets for market making. In addition to providing a new,
uncorrelated income stream, market making can have a positive halo effect on an existing
investment portfolio since improving liquidity for an asset tends to improve price discovery
and lower its risk premium.
For this user segment, we plan to offer services and paid modules that address their specific
needs, such as:
• Hosting, deployment, and maintenance
• Integrations with portfolio and execution management systems
• Access to historical order book data
• Custom market making strategies
3 STRATEGIES
Hummingbot will enable users to automatically run a set of market making bots based on
their custom parameters and strategies. In this section, we discuss the general categories
of strategies that Hummingbot helps users define, parametrize, and execute.
3.1 Market making
The basic action performed by a market maker is to quote tradable bid and ask prices on
a single trading venue which can be transacted by other market participants at any time
(Figure 1).
9


Figure 1: Market maker placing orders for 1 unit of Token
Market makers periodically update these bid and ask prices to reflect factors such as changes
in market conditions, trades executed, as well as inventory and resulting levels of risk
exposure.
Thus, a market maker encounters a decision problem as described in the Glosten-Milgrom
model [13] of dealer markets: because she must set prices in an environment where there
exist informed and uninformed traders, the market maker is at an information disadvantage.
In addition, a market maker acts as an intermediary between buyers and sellers, whose
orders may arrive asynchronously, resulting in fluctuating amounts of inventory and risk
exposure. In order to compensate for these risks, a market maker quotes a lower bid price
and higher ask price, with the difference in prices referred to as the bid-ask spread:
Pbid = Pref − δbid = market maker’s price to buy assets,
Pask = Pref + δask = market maker’s price to sell assets,
bid-ask spread = Pask − Pbid = δbid + δask,
where Pref = reference price,
δbid = spread from reference price to bid price,
δask = spread from reference price to ask price.
An example of a market maker transaction cycle is:
10
![figure](figures/p10_1.png)


1. A market maker simultaneously quotes both Pbid and Pask for 1 unit of Token A.
2. At some time t1, a trader fills a market maker’s bid order, selling Token A to the
market maker. This decreases the market maker’s U.S. dollar holdings by Pbid and
increases his inventory of Token A.
3. A market maker continues to hold the additional inventory of Token A for some
unknown period of time.
4. At some later time t2, a trader fills the market maker’s offer order, buying Token A
from the market maker. This increases the market maker’s holdings of U.S. dollars
by Pask
1 and decreases his inventory of Token A.
The market maker therefore assumes incremental inventory risk for an indeterminate period
of time, t2 − t1.
In the example above, the market maker’s profit is Pask −Pbid = bid-ask spread 2. A market
maker’s economic objective is to maximize the frequency of crossing trades, completing the
transaction cycles of buying assets and selling assets (or, conversely, for a market maker
with inventory, selling assets and re-buying those assets) in order to capture the bid-ask
spread.
Market makers bear risk because:
1. They have to maintain inventory of the quote currency in order to be able to quote
ask prices3, exposing them to negative price movements;
2. Their inventory of the quote currency may increase at any point in time in the event
that bid orders are filled;
3. The amount of time required to find an offsetting trade is unknown, during which
the value of held inventory may drop, and
4. They are exposed to information disadvantage, since their trade orders may be filled
at any time by any trader that may have more information than the market maker.
3.1.1 Inventory Implications for Market Makers
A market maker’s current amount of inventory and target level of exposure have implications on its bias for assuming more or less risk; naturally, the willingness of a market maker
1Assuming no change in prices between t1 and t2
2
Ibid
3
In a base case, where shorting assets is not available to the market maker.
11


managing for a target level of exposure is inversely proportional to its level of holdings.
The resulting bias can be expressed in the market maker’s quote through price (or spread),
order size, or both:
(qcurrent > qtarget) → [(δbid > δask ∨ sbid < sask)], (1a)
(qcurrent < qtarget) → [(δbid < δask ∨ sbid > sask)], (1b)
where sbid = bid order size,
sask = ask order size,
qcurrent = current level of inventory,
qtarget = target level of exposure.
For example, a risk averse market maker (as in the case of equation (1a), where a market
maker’s current holdings exceed target holdings) skews the parameters of its market orders
in order to decrease the probability and/or magnitude of acquiring more inventory relative
to selling inventory.
3.1.2 Implementation
Market making is a complex optimization problem [14], in which all information known
at a given point in time (including historical data) is used to generate market orders that
maximize expected returns of the strategy. The basic algorithm for a market maker is to
(1) establish a reference price for the asset, and then (2) set bid and ask prices, as well as
respective order sizes, for orders to be placed on the exchange.
There are multiple approaches for accomplishing both steps, and strategies must be customized to take into account characteristics of the asset as well as the market maker.
Market Maker Parameters
Asset price volatility Target asset exposure
Risk bias Risk exposure limits
Current amount of inventory Order duration
Margin thresholds Quote frequency
12


3.2 Arbitrage
Arbitrage trading is the strategy of capturing risk-free4 profits by simultaneously buying
an asset at a lower price and selling that same asset at a higher price (Figure 2). From
time to time, market dislocations may present such opportunities for a number of reasons.
Figure 2: Arbitrageur simultaneously buys and sells an
asset on different exchanges to capture $1 risk-free profit
Market Fragmentation in Digital Asset Markets
The relatively nascent digital asset markets makes it susceptible to pricing dislocations due
to significant market fragmentation. There are multiple exchanges with different pockets
of users: some users may have access to some exchanges, while others do not. In addition,
new exchanges continue to be created regularly.
4Arbitrage trading aims to eliminate market risk or price risk. However, there may be some residual
risks due to the logistics of executing or settling trades, for example risks inherent in the transfer of assets
between exchanges, or the risk of an order being filled or being canceled prior to the arbitrageur completing
that trade.
13
![figure](figures/p13_2.png)


Some of the broader factors resulting in fragmented cryptocurrency markets include:
• Centralized exchanges versus decentralized exchanges:
– Certain traders may not be able to trade on decentralized exchanges (e.g. due to
regulatory requirements or risk tolerance/reliability concerns) or they may not
have the technical expertise to transact in the native technologies of the decentralized exchanges, which currently are generally more complex than transacting
on centralized exchanges.
– Price quotes and trade execution on decentralized exchanges may be subject to
delays arising from dependencies on the underlying blockchain protocols.
• Geographically ring-fenced exchanges: exchanges in one country may not be
able to open accounts for non-nationals of that country. Multiple exchanges exist
that are geographically dispersed, with limited or no overlap in user bases.
• Exchange Proliferation: There currently exist over 200 cryptocurrency exchanges
globally[15] with different user and asset bases, and the ability to move assets from
one exchange to another (even for a user with accounts on each exchange) may require
complex, time-consuming processes and be subject to fees. Since exchanges may have
silo-ed user bases, each may have different supply and demand dynamics making them
prone to dislocations.
Since exchanges may have siloed user bases, each may have different supply and demand
dynamics making them prone to dislocations.
Information Asymmetry
There may be ephemeral opportunities arising from a delay in information spreading across
multiple markets, time zones, or exchanges. For example, if an account places a large buy
order in one exchange which drives prices higher on that exchange, a quick-acting trader
may be able to accumulate those assets at lower prices on other exchanges which have not
seen that buy order, and then sell those assets at the higher prices on the original exchange.
This may be observed across different geographies.
Structural Fragmentation
In some cases, there may be persisting reasons for market dislocations arising from structural or regulatory reasons. One example of this is is a persisting material pricing discrepancy in the Bitcoin market between Korea and the U.S. In fact, this led to a market “crash”
as CoinMarketCap removed the elevated Korean exchange prices from its calculations[16].
Korean cryptocurrency prices exceeded those on U.S. exchanges due to high internal demand for cryptocurrencies. However, this persisted because of the challenge for Korean
14


nationals to open accounts in other countries as well as currency controls limiting the
amount of cash sent overseas. In this example, a trader with access to both markets could
buy cryptocurrencies in the U.S. and sell them in Korea and capture risk-free, arbitrage
profits.
Trader / “Fat Finger” Errors
The decentralized and retail nature of cryptocurrencies coupled with the idiosyncratic pricing conventions and number systems used by cryptocurrencies gives rise to the possibility
of trade entry errors. In addition, the increasing adoption and use of algorithmic strategies
and programmatic, automated trading systems further adds to the likelihood of trade entry
errors. Such large errors have been witnessed in long-established, traditional markets such
as the stock markets (e.g. 2010 Flash Crash [17]). This creates the potential for arbitrage
opportunities resulting from pricing errors, as a trader accepting that order may be able
to offset the trade at a “normalized” price.
Challenges for Arbitrage Trading
Arbitrage trading is a very attractive trading strategy due to its guarantee of risk-free profit.
However, identifying arbitrage opportunities is challenging since (1) they should not exist,
as the market naturally works to eliminate such inefficiencies, (2) they are unpredictable,
non-recurring, and may be small in size, (3) typically short-lived, and (4) there is high
competition to identify and capture such mispricings while there can only be one winner.
Being able to consistently capture arbitrage profits depends on some form of advantage
which is difficult for other market participants to replicate. Examples of such advantages
may be high speed data connections between different exchanges or locations (such as “highfrequency traders” in the traditional financial markets), access to cryptocurrency exchange
accounts across multiple countries, or superior technologies for constantly monitoring and
detecting pricing dislocations across multiple exchanges coupled with the ability to reliably
respond and execute quickly. Unlike traditional financial markets such as the stock market,
the cryptocurrency market continuously trades without a defined market open or close.
Searching for arbitrage opportunities requires constant monitoring.
3.2.1 Implementation
Hummingbot arbitrage strategies will monitor multiple exchanges for any price dislocations
and transact whenever a profitable trading opportunity arises. When using an arbitrage
strategy, Hummingbot will act a market taker, filling the best available trade orders on
different exchanges.
Hummingbot will enable the execution of multiple strategies which will be released in
15


stages, such as:
1. Basic arbitrage strategies: singe trading pair on two exchanges
2. Multiple exchange strategy: increase likelihood of identifying arbitrage opportunities by monitoring multiple exchanges (more than two)
3. Multiple trading pair strategies / triangular arbitrage: a common strategy
in foreign exchange markets, using more than a single trading pair for capturing
arbitrage. Increased complexity and additional trading pairs increase the likelihood
of the occurrence of a pricing dislocation.
Some of the technologies that will be part of Hummingbot’s arbitrage strategy development
include:
• Integrations with different exchanges: retrieving order book and price data,
sending trade instructions, and (optional) rebalancing / transfers of assets between
exchanges.
• Exchange order book analysis: study multiple exchanges in order to try to identify highest potential for arbitrage opportunities.
Critical to the success of the arbitrage strategy will be the ability to reliably detect opportunities and respond quickly.
3.3 Cross-Exchange Market Making
Cross-exchange market making combines elements from both arbitrage trading and basic
market making in order to profit from differences in liquidity between trading pairs from
two (or more) different exchanges.
In cross-exchange market making, a market maker trades on two different exchanges and
uses the best available bid and asks (Figure 3) available on one exchange (“Exchange A”,
typically, a larger, highly active and liquid exchange) in order to make markets on another
exchange (“Exchange B”, a smaller, less actively-traded exchange). Any time the market
maker’s order is filled on Exchange B, the market maker can immediately offset this trade
by filling the corresponding order on Exchange A.
The market maker enters orders on Exchange B with a margin δask relative to the best
prices on Exchange A (Figure 4). For example, the best offer price on Exchange A is $101;
16


Figure 3: Asset is quoted on Exchange A
Figure 4: Market maker enters orders on Exchange B
the market maker can quote an offer of $101 + δask on Exchange B, which in the example
is $102.
When a trader fills the sell order on Exchange B, the market maker instantly offsets the
trade by buying the asset on Exchange A (Figure 5). Since the market maker sold the asset
at $102 on Exchange B and was able to simultaneously buy the asset from Exchange A for
a price of $101, the market maker realizes a risk-less profit of $1.
Use Cases
Cross-exchange market making allows market makers to take a more active role in pursuing
17
![figure](figures/p17_3.png)
![figure](figures/p17_4.png)


Figure 5: Buyer on Exchange B fills Market Maker Sell Order, Market Maker Simultaneously Buys the Asset on Exchange A
arbitrage opportunities. Whereas in pure arbitrage trading arbitrageurs search for, or wait
for, pricing dislocations, cross-exchange market making allows a market maker to actively
create the potential for capturing price differentials.
The strategy also enables market makers to “clone liquidity”5from one exchange to another
exchange, particularly in the case of replicating liquidity from a larger, more liquid exchange
to smaller, less liquid exchanges. One example of this would be bridging liquidity from
centralized exchanges to decentralized exchanges, where the user base is materially smaller.
3.3.1 Cross-Exchange Market Making Implementation
Inventory Equilibrium Model
The previous example explains cross-exchange market making in an efficient markets environment where transferring assets across exchanges is instant and friction-less. In practice,
inter-exchange transfer of assets may be inefficient, time-consuming, incur fees, and may
contribute to the existence of pricing dislocations in the first place. For example, transferring of any blockchain-based asset may require the transfer instruction being mined in a
5Cloning liquidity may also be referred to as remarketing.
18
![figure](figures/p18_5.png)


blockchain transaction and confirmed between exchanges. Since pricing dislocations may
exist only momentarily, any profitable opportunity may easily dissipate in the amount of
time it would take to transfer the assets and complete both sides of the transaction.
One way to address this inefficiency is for a market maker to maintain inventories on
multiple exchanges, allowing for the market maker to act immediately when presented with
a profitable trading opportunity. As in the example above, the sell order on Exchange A and
the buy order on Exchange B occur in the same manner as previously described, allowing
the market maker to complete offsetting trades. However, in a cross-exchange, inventory
equilibrium model that takes into account inter-exchange asset transfer inefficiency, the
market maker would maintain balances of both U.S. dollars (the assumed quote currency
of the example) and the asset on both exchanges. In executing the above transaction, no
assets are immediately transferred between Exchange A and Exchange B.
In the example shown in Figure 6, the market maker has a total inventory of USD 2,000
and 20 Token A assets, equally distributed between Exchange A and Exchange B.
Figure 6: Market maker maintains an inventory on both exchanges
When a buyer takes the market maker’s sell order on Exchange B for 1 unit of Token A, the
market maker simultaneously buys 1 unit of Token A on Exchange A. There is no transfer
of assets between exchanges, resulting in a change in the cross-exchange distribution of
the market maker’s assets. Following the trade, the market maker’s overall exposure has
remained unchanged: the market maker still has an aggregate balance of 20 units of Token
A, however, now with 11 units on Exchange A and 9 units on Exchange B. Meanwhile, the
market maker’s total cash balance has increased by the $1 profit captured, with a new total
19
![figure](figures/p19_6.png)


cash balance of $2,001, with $899 and $1,102 on Exchange A and B, respectively (Figure
7).
Figure 7: A buyer on Exchange B takes the market maker’s sell order; market maker
simultaneously buys the asset on Exchange A
3.3.2 Inventory Risk and Implication for Strategy Applicability
A fundamental difference between basic market making on a single exchange and crossexchange market making is the requirement to maintain some amount of inventory for
an indeterminate amount of time, whereas as previously discussed, basic market making
generally aims to minimize the amount of inventory and the duration of holdings. While
the potential to capture incremental arbitrage trading profits increases the expected value
of a portfolio, the market maker does retain market and price risk.
The ideal user for such a strategy would be a market maker that has a fundamental investment thesis for the asset and is a long-term holder of the asset. Deploying a cross-exchange
market making strategy can provide a market maker with incremental, additive returns
without a fundamental change in risk profile as compared to a passive, buy-and-hold strategy.
20
![figure](figures/p20_7.png)


4 THE HUMMINGBOT CLIENT
By encapsulating market making algorithms and a trade execution engine in an open-source
application available to non-technical users, Hummingbot enables a much wider range of
individuals and companies to potentially earn income from running market maker nodes
that provide liquidity to crypto-asset pairs that trade on various exchanges.
Hummingbot will effectively be a trading engine to execute transactions with the parameters provided by users, abstracting some the technical complexities of transacting with
centralized and decentralized exchanges, each with their own non-standardized technical
specifications. Hummingbot will facilitate trade execution and interaction with different
exchanges, performing actions such as price and order book retrieval, submission of trade
instructions, and, if specified by the user, handle asset transfers for functions such as rebalancing across different exchange accounts.
4.1 Architecture
The Hummingbot architecture and operation are similar to the operation of open-source,
blockchain protocol nodes (Figure 8).
1. Bot installation: users download the code from a public, open-source code repository and install the program locally, either on their local machine or on a cloud-hosted
remote server.
2. Program execution: users execute the Hummingbot program either through command line commands or a graphical user interface (GUI).
3. Private information (such as wallet private keys and exchange API keys): are
encrypted and stored locally on a user’s machine.
4. Bot activity and transaction logs: stored on a local database.
5. Data feeds: the program connects to blockchains, decentralized exchange APIs,
and centralized exchange APIs to retrieve data, such as market prices and order
book data, as well as user specific data such as asset balances, existing orders and
status.
6. Centralized exchange commands: the bot uses locally stored API keys to create
API requests for interacting with centralized exchanges for the retrieval of information
as well as for sending user instructions.
7. Decentralized exchange commands: the bot uses the locally stored wallet key
to sign transactions which are then sent to a blockchain node for execution.
21


Figure 8: Hummingbot Architecture
4.1.1 Reliability Engineering
Similar to the cryptocurrency market, its associated infrastructure is relatively nascent.
In recent months, there have been hundreds of new exchanges created, with limited track
records and deploying new, relatively untested technologies. A primary engineering task in
the development of Hummingbot is in making it reliable and capable of handling extrinsic
failures, some arising from idiosyncratic risks of the cryptocurrency market.
Risk Mitigation for Interexchange Trading When trading across different exchanges,
22
![figure](figures/p22_8.png)


it is critical to coordinate transactions across different exchanges, particularly when they are
related transactions, such as the offsetting transactions used in arbitrage trading and crossexchange market making. This is further complicated the use of decentralized exchanges,
where there is increased potential of delays in the execution of transactions (e.g. waiting
for block confirmations or block reorganizations). An example of the risk of coordination
is one leg of traded being executed on one exchange (Exchange B), while in the interim,
the offsetting hedging transaction on another exchange (Exchange A) on which that trade
was based has gone away (e.g. trade was filled by a third party or orders were withdrawn).
Risk mitigation:
• Increase spread buffer for transactions
• Analysis on speed of transactions on exchanges
• Order book depth analysis to optimize trade parameters and account for contingencies
(e.g. taking next best orders)
• Sourcing offsetting transactions from multiple exchanges
Exchange Reliability
Unlike the more established exchanges of financial markets, cryptocurrency exchanges have,
in their short history, experienced service disruptions. Even some of the major centralized
cryptocurrency exchanges have experienced service outages, some for as long as several
days [18]. For decentralized exchanges, one additional risk is the occurrence of blockchain
congestion [19], while technology changes (e.g. the change in API specifications) can disrupt
any software depending on those services.
Risk mitigation:
• Constant monitoring and reporting of exchange status
• Flexibility to relocate trading to different exchanges
• Information redundancy (e.g. multiple sources for asset price feeds)
4.1.2 Strategy Implementation
Phase 1
The initial release of Hummingbot will focus on the cross-exchange market making strategy
between a centralized exchange and a decentralized exchange.
23


Ongoing development will add additional features:
• Support for additional centralized exchanges
• Support for additional decentralized exchanges
• Centralized to centralized exchange market making
• Stand-alone arbitrage trading or overlay to market making strategy (e.g. execute
taker transactions whenever an trading opportunity exists)
• Support for multiple exchanges (more than two)
Phase 2
Pure market making strategies for making markets for a single asset on a single exchange.
Phase 3
Provide the capabilities for customized user strategies.
• Initial focus on cross-exchange market making for decentralized exchanges
• Add other strategies over time
• Custom strategies: users can also write their own strategies
4.1.3 Rebalancing
When employing a cross-exchange market making strategy, it is increasingly likely with
the passage of time that an imbalance in the direction of trading flows will accumulate.
In the example above, if higher price levels persist on Exchange B, there will come some
point in time where either the market maker’s holdings of Token A on Exchange B and US
Dollars on Exchange A will be depleted, or both. This creates the need to rebalance and
redistribute assets across exchanges.
Rebalancing can be automated and incorporated into the trading bot strategy, by specifying
minimum asset balance thresholds that trigger a rebalancing. Rebalancing is carried out
by the bot initiating asset transfers between exchanges.
24


References
[1] Johannes A Skjeltorp and Bernt Arne Ødegaard. Why do listed firms pay for market
making in their own stock? March 2013.
[2] All Cryptocurrencies. https://coinmarketcap.com/all/views/all/, 2018. [Online;
accessed 30-November-2018].
[3] Committee on Oversight and Government Reform. How Roadblocks in Public Markets
Prevent Job Creation on Main Street. House of Representatives, November 2011.
[4] How to Become a Market Maker. http://www.nasdaqtrader.com/Trader.aspx?id=
marketmakerprocess, 2018. [Online; accessed 20-November-2018].
[5] Gregory Meyer, Nicole Bullock and Joe Rennison. How high-frequency trading hit a
speed bump. Financial Times, January 2018.
[6] BitMex. https://github.com/BitMEX/sample-market-maker, 2018. [Online; accessed 17-December-2018].
[7] MakerDAO. https://github.com/makerdao/market-maker-keeper, 2018. [Online;
accessed 17-December-2018].
[8] Codaone. https://github.com/Codaone/DEXBot, 2018. [Online; accessed 17-
December-2018].
[9] Tribeca. https://github.com/michaelgrosner/tribeca, 2018. [Online; accessed
17-December-2018].
[10] Blackbird. https://github.com/butor/blackbird, 2018. [Online; accessed 17-
December-2018].
[11] Gekko. https://github.com/askmike/gekko, 2018. [Online; accessed 17-December2018].
[12] Cyrus Younessi. A Unique Exchange. https://medium.com/@cyrus.younessi/
uniswap-a-unique-exchange-f4ef44f807bf, 2018. [Online; accessed 17-December2018].
[13] L.R. Glosten and P.R. Milgrom. Bid, Ask and Transaction Prices in a Specialist Market
with Heterogeneously Informed Traders. Journal of Financial Economics, 14:71–100,
1985.
[14] Gu´eant, O., Lehalle, C.-A., & Fernandez-Tapia, J. Dealing with the inventory risk:
a solution to the market making problem. Mathematics and Financial Economics,
7(4):477–507, 2013.
25


[15] coin.market. Cryptocurrency Market Capitalizations. https://coin.market/coins/
info, 2018. [Online; accessed 17-December-2018].
[16] David Z. Morris. Cryptocurrency Markets Shocked as CoinMarketCap Removes
Korean Exchange Prices Without Warning. http://fortune.com/2018/01/08/
coinmarketcap-removes-korean-exchange-prices/, 2018. [Online; accessed 17-
December-2018].
[17] Wikipedia. 2010 Flash Crash. https://en.wikipedia.org/wiki/2010_Flash_
Crash. [Online; accessed 17-December-2018].
[18] Fortune. Kraken Bitcoin Exchange Reopens After Two Anxious Days. http://
fortune.com/2018/01/14/kraken-bitcoin-exchange-reopens/. [Online; accessed
24-December-2018].
[19] Coindesk. Loveable Digital Kittens Are Clogging
Ethereum’s Blockchain. https://www.coindesk.com/
loveable-digital-kittens-clogging-ethereums-blockchain. [Online; accessed
24-December-2018].
26

Shown in full with attribution under the source's licence. Licence: Apache-2.0

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.