<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://minsuk-sung.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://minsuk-sung.github.io/" rel="alternate" type="text/html" /><updated>2026-07-18T23:28:59+09:00</updated><id>https://minsuk-sung.github.io/feed.xml</id><title type="html">성민석의 블로그</title><subtitle>인공지능과 알고리즘 트레이딩을 좋아하는 사람</subtitle><author><name>성민석</name><email>minsuksung@korea.ac.kr</email></author><entry><title type="html">Guide to the Avellaneda &amp;amp; Stoikov Strategy</title><link href="https://minsuk-sung.github.io/blog/hummingbot-Avellaneda-Stoikov/" rel="alternate" type="text/html" title="Guide to the Avellaneda &amp;amp; Stoikov Strategy" /><published>2025-09-05T00:00:00+09:00</published><updated>2025-09-05T00:00:00+09:00</updated><id>https://minsuk-sung.github.io/blog/hummingbot-Avellaneda%E2%80%93Stoikov</id><content type="html" xml:base="https://minsuk-sung.github.io/blog/hummingbot-Avellaneda-Stoikov/"><![CDATA[<h1 id="avellaneda--stoikov-전략-가이드">Avellaneda &amp; Stoikov 전략 가이드</h1>

<p><img src="https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/cover.webp" alt="" /></p>

<p>Hummingbot 아카데미에 다시 오신 것을 환영합니다!</p>

<p>최신 Hummingbot 릴리스(0.38)에서는 고전적인 학술적 마켓 메이킹 모델에 기반한 흥미로운 전략을 선보입니다. 이 글에서는 2008년의 Avellaneda &amp; Stoikov 논문과 Hummingbot에서의 구현에 대해 자세히 알아보겠습니다.</p>

<p>심도 있는 과학 논문을 즐기시는 분들을 위해, 원본 논문은 온라인이나 <a href="https://www.researchgate.net/publication/24086205_High_Frequency_Trading_in_a_Limit_Order_Book">여기</a>에서 직접 찾아보실 수 있습니다.</p>

<p>오늘 우리가 살펴볼 내용은 다음과 같습니다:</p>

<ul>
  <li>Avellaneda &amp; Stoikov 마켓 메이킹 모델</li>
  <li>재고 위험 관리</li>
  <li>최적의 매수 및 매도 스프레드 결정</li>
  <li>Hummingbot에서의 구현</li>
</ul>

<!-- ========================================================================================== -->
<h2 id="1️⃣-avellaneda--stoikov-모델-이해하기">1️⃣ Avellaneda &amp; Stoikov 모델 이해하기</h2>
<!-- ========================================================================================== -->
<p>이 모델은 마켓 메이커의 두 가지 주요 관심사를 다룹니다:</p>

<ul>
  <li>재고 위험 관리</li>
  <li>최적의 매수 및 매도 스프레드 결정</li>
</ul>

<p>Avellaneda &amp; Stoikov는 마켓 메이커가 이러한 문제를 해결하는 데 도움이 되는 공식을 제안합니다.</p>

<p><strong>예약 가격 (Reservation price):</strong></p>

\[r(s, q, t) = s - q \gamma \sigma^2 (T - t)\]

<p><strong>최적 매수 및 매도 스프레드 (Optimal bid &amp; ask spread):</strong></p>

\[\delta^a + \delta^b = \gamma \sigma^2 (T - t) + \frac{2}{\gamma}\ln \left(1 + \frac{\gamma}{\kappa}\right)\]

<p>여기서 각 변수는 다음을 의미합니다:</p>
<ul>
  <li>$s$ = 현재 시장 중간 가격</li>
  <li>$q$ = 기준 자산의 재고 수량 (롱/숏 포지션에 따라 양수/음수)</li>
  <li>$\sigma$ = 시장 변동성</li>
  <li>$T$ = 정규화된 마감 시간 (1)</li>
  <li>$t$ = $T$에 대한 현재 시간의 비율</li>
  <li>$\delta^a, \delta^b$ = 대칭적인 매수/매도 스프레드</li>
  <li>$\gamma$ = 재고 위험 회피 매개변수</li>
  <li>$\kappa$ = 오더북 유동성 매개변수</li>
</ul>

<p>이 글에서는 이러한 공식과 그 의미를 간단하게 설명합니다. 더 기술적인 세부 사항을 다루는 후속 기사를 기대해 주세요.</p>

<!-- ========================================================================================== -->
<h2 id="2️⃣-예약-가격-설명">2️⃣ 예약 가격 설명</h2>
<!-- ========================================================================================== -->
<p><img src="/assets/images/2025-09-05/eq1.png" alt="" /></p>

<p>전통적인 마켓 메이킹은 시장 중간 가격을 중심으로 대칭적인(symmetrical) 매수 및 매도 주문을 내는 것을 포함합니다. 하지만 이는 재고 편향으로 이어질 수 있으며, 자산 가치가 불리하게 움직일 경우 트레이더를 위험에 빠뜨릴 수 있습니다.</p>

<p>예를 들어, BTC-USDT 하락 추세에서 대칭 전략을 사용하면 마켓 메이커는 결국 BTC를 축적하게 되어 총 재고 가치가 감소합니다.</p>

<p><img src="https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/btc_downtrend.png" alt="" /></p>

<p>Avellaneda &amp; Stoikov의 접근 방식은 다음을 고려하여 주문 배치를 위한 새로운 기준 가격을 계산합니다:</p>

\[r(s, q, t) = s - q \gamma \sigma^2 (T - t)\]

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="재고-포지션-편차-q">재고 포지션 편차 ($q$)</h3>
<!-- ------------------------------------------------------------------------------------------ -->
<blockquote>
  <p>How distant is the trader’s current inventory position is from the target position?</p>
</blockquote>

<p>공식에서 $q$의 값은 목표 재고로부터의 편차를 나타냅니다. 예를 들어:</p>
<ul>
  <li>$q = 0$일 때, 예약 가격은 시장 중간 가격과 같습니다.</li>
  <li>$q &lt; 0$일 때, 트레이더는 숏 포지션 상태이므로, 예약 가격을 높여 매수 주문을 선호하게 합니다.</li>
  <li>$q &gt; 0$일 때, 트레이더는 롱 포지션 상태이므로, 예약 가격을 낮춰 매도 주문을 선호하게 합니다.</li>
</ul>

<p><img src="/assets/images/2025-09-05/eq1-1.png" alt="" />
<img src="/assets/images/2025-09-05/eq1-2.png" alt="" /></p>

<p>Hummingbot은 사용자가 지정한 목표 재고 비율을 기반으로 $q$를 계산합니다.</p>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="재고-위험-감수도-gamma">재고 위험 감수도 ($\gamma$)</h3>
<!-- ------------------------------------------------------------------------------------------ -->
<blockquote>
  <p>How much inventory risk does the trader want to take?</p>
</blockquote>

<p>트레이더가 설정하는 이 매개변수는 재고 위험을 감수하려는 의지를 나타냅니다. $\gamma$가 0에 가까우면 예약 가격이 시장 중간 가격에 가까워져 대칭 전략과 유사해집니다. $\gamma$가 증가하면 예약 가격은 재고 목표에 맞추기 위해 더 공격적으로 조정됩니다.</p>

<p><img src="/assets/images/2025-09-05/eq1-3.png" alt="" /></p>

<p>Hummingbot에서는 $\gamma$를 수동으로 설정하거나 자동으로 계산할 수 있습니다.</p>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="남은-거래-세션-시간-t-t">남은 거래 세션 시간 ($T-t$)</h3>
<!-- ------------------------------------------------------------------------------------------ -->
<blockquote>
  <p>Time until the trading session ends</p>
</blockquote>

<p>거래 세션이 정해진 전통적인 금융 시장을 고려하여, 이 모델은 세션 종료가 다가올수록 예약 가격을 중간 가격에 더 가깝게 조정하여 재고 위험을 최소화합니다.</p>

<p><img src="/assets/images/2025-09-05/eq1-4.png" alt="" /></p>

<p>Hummingbot에서는 거래 세션 기간을 설정하여 24/7 운영되는 암호화폐 시장에 맞게 모델을 조정할 수 있습니다.</p>

<blockquote>
  <p>참고: Avellaneda &amp; Stoikov는 연속적인 시장에 더 적합한 무한 시간 모델(infinite horizon model)도 제안했으며, 이는 향후 릴리스에 포함될 계획입니다.</p>
</blockquote>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="시장-변동성sigma">시장 변동성($\sigma$)</h3>
<!-- ------------------------------------------------------------------------------------------ -->
<p>시장 변동성($\sigma$) 또한 예약 가격에 영향을 미치지만 트레이더가 정의하는 요소는 아닙니다. 변동성이 증가하면 예약 가격과 중간 가격 사이의 격차가 넓어집니다.</p>

<!-- ========================================================================================== -->
<h2 id="3️⃣-최적-스프레드-결정하기">3️⃣ 최적 스프레드 결정하기</h2>
<!-- ========================================================================================== -->
<p><img src="/assets/images/2025-09-05/eq2.png" alt="" /></p>

<p>모델의 두 번째 측면은 수익성을 위한 최적의 오더북 포지셔닝에 중점을 둡니다.</p>

\[\delta^a + \delta^b = \gamma \sigma^2 (T - t) + \frac{2}{\gamma}\ln\left(1+\frac{\gamma}{\kappa}\right)\]

<p>여기서는 예약 가격의 요소$\gamma$와 $T-t$가 다시 등장하며, 추가적으로 다음이 포함됩니다:</p>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="오더북-유동성-kappa">오더북 유동성 ($\kappa$)</h3>
<!-- ------------------------------------------------------------------------------------------ -->
<p>논문에서는 수학적 세부 사항을 깊이 다루지만, 핵심은 높은 $\kappa$ 값이 더 촘촘한 오더북을 의미하며 더 작은 스프레드가 필요하다는 것입니다. 반대로, 낮은 $\kappa$는 유동성이 적음을 시사하므로 더 넓은 스프레드를 허용합니다.</p>

<!-- ========================================================================================== -->
<h2 id="4️⃣-예약-가격과-최적-스프레드-결합하기">4️⃣ 예약 가격과 최적 스프레드 결합하기</h2>
<!-- ========================================================================================== -->
<p>모델의 실행 로직은 간단합니다:</p>

<ol>
  <li>목표 재고를 기반으로 예약 가격을 계산합니다.</li>
  <li>최적의 매수 및 매도 스프레드를 결정합니다.</li>
  <li>예약 가격을 중심으로 시장가 주문을 냅니다:
    <ul>
      <li>매수 가격 = 예약 가격 - 최적 스프레드의 절반</li>
      <li>매도 가격 = 예약 가격 + 최적 스프레드의 절반</li>
    </ul>
  </li>
</ol>

<p>이러한 동적인 움직임은 아래에 설명되어 있습니다:</p>

<p><img src="https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/strategy_in_action.png" alt="" /></p>

<p>계산된 예약 가격(녹색 선)은 종종 시장 중간 가격(파란색 선)과 다릅니다. 예약 가격은 재고에 따라 조정되며, 중간 가격 대비 주문 배치에 영향을 미칩니다.</p>

<!-- ========================================================================================== -->
<h2 id="5️⃣-매개변수-계산">5️⃣ 매개변수 계산</h2>
<!-- ========================================================================================== -->
<p>Avellaneda-Stoikov 모델의 핵심 요소는 다음과 같습니다:</p>

<ol>
  <li>재고 포지션 ($q$)</li>
  <li>남은 거래 세션 시간 ($T-t$)</li>
  <li>위험 계수 ($\gamma$)</li>
  <li>오더북 뎁스 ($\kappa$)</li>
</ol>

<p>각각에 해당하는 Hummingbot 매개변수는 다음과 같습니다:</p>

<ol>
  <li><strong>재고 거리 ($q$)</strong>: 현재 재고와 목표 재고 간의 차이를 반영합니다. Hummingbot에서 자산 재고 목표 비율을 설정하면 봇이 $q$를 계산합니다.</li>
  <li><strong>세션 시간 ($T-t$)</strong>: 멈추지 않는 암호화폐 시장의 특성에 맞게 모델을 조정합니다. Hummingbot에서 원하는 거래 세션 기간을 정의합니다.</li>
  <li><strong>위험 계수 ($\gamma$) 및 오더북 뎁스 ($\kappa$)</strong>: 논문에서는 이들의 계산법을 명시하지 않았지만, Hummingbot의 “이지 모드”는 원하는 스프레드 한도를 기반으로 자동으로 결정합니다. 또는 <code class="language-plaintext highlighter-rouge">parameters_based_on_spread</code>를 <code class="language-plaintext highlighter-rouge">False</code>로 설정하고 <code class="language-plaintext highlighter-rouge">order_book_depth_factor</code>와 <code class="language-plaintext highlighter-rouge">risk_factor</code>를 사용하여 수동으로 값을 입력할 수 있습니다.</li>
</ol>

<!-- ========================================================================================== -->
<h2 id="6️⃣-hummingbot-설정하기">6️⃣ Hummingbot 설정하기</h2>
<!-- ========================================================================================== -->
<p>Hummingbot에서 전략을 생성하려면 <code class="language-plaintext highlighter-rouge">create</code> 명령어를 사용하고 전략 이름으로 <code class="language-plaintext highlighter-rouge">avellaneda_market_making</code>을 지정해야 합니다.</p>

<p><img src="https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/config_1.png" alt="" /></p>

<p>거래소와 거래 페어를 선택한 후, Hummingbot이 위험 계수와 오더북 뎁스를 계산하도록 할지 결정합니다.</p>

<p><img src="https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/config_2.png" alt="" /></p>

<p>원하는 최대 및 최소 스프레드를 설정하여 계산된 최적 스프레드의 한도를 정의합니다.</p>

<p><img src="https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/config_3.png" alt="" /></p>

<p>위험 회피 매개변수는 재고 위험 선호도를 결정합니다. 1에 가까운 값은 보수적인 접근 방식을 나타냅니다.</p>

<p><img src="https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/config_4.png" alt="" /></p>

<p>마지막으로, 총 재고 중 기준 자산이 차지해야 할 비율을 결정하는 재고 목표 비율을 지정합니다.</p>

<p><img src="https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/config_5.png" alt="" /></p>

<p>Hummingbot의 추가 설정에는 <code class="language-plaintext highlighter-rouge">closing_time</code>(세션 기간)과 <code class="language-plaintext highlighter-rouge">volatility_buffer_size</code>(변동성 계산을 위한 데이터 기간)가 포함됩니다.</p>

<p><img src="https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/all_config.png" alt="" /></p>

<!-- ========================================================================================== -->
<h2 id="7️⃣-마지막-생각">7️⃣ 마지막 생각</h2>
<!-- ========================================================================================== -->
<p>최적의 마켓 메이킹 전략은 수십 년 동안 학술 연구의 초점이었습니다. 오늘날 시장에서 고빈도 매매(High-Frequency Trading, HFT)가 중요한 역할을 하는 만큼, 우리 팀이 탐구할 것이 많습니다. 제안할 흥미로운 모델이 있다면, 디스코드에서 저희와 함께하세요!</p>

<!-- ========================================================================================== -->
<h2 id="8️⃣-커뮤니티에-참여하세요">8️⃣ 커뮤니티에 참여하세요</h2>
<!-- ========================================================================================== -->
<p>저희 디스코드 채널에 참여하여 동료 마켓 메이커 및 차익거래자들과 교류하세요. 트위터와 레딧에서 저희를 팔로우하여 업데이트와 소식을 받아보세요. 저희 유튜브 채널에서 전문 트레이더와의 인터뷰를 포함한 마켓 메이킹에 대한 콘텐츠를 놓치지 마세요.</p>

<details>
<summary><a href="https://hummingbot.org/strategies/avellaneda-market-making">Show original (English)</a></summary>

# Guide to the Avellaneda &amp; Stoikov Strategy

![](https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/cover.webp)

Welcome back to the Hummingbot Academy!

The latest Hummingbot release (0.38) introduces an exciting strategy based on classical academic market-making models. This article will delve into the Avellaneda &amp; Stoikov paper from 2008 and its implementation in Hummingbot.

For those who enjoy in-depth scientific papers, the original publication is readily accessible online or directly [here](https://www.researchgate.net/publication/24086205_High_Frequency_Trading_in_a_Limit_Order_Book).

Today we will explore:

- The Avellaneda &amp; Stoikov market-making model
- Inventory risk management
- Optimal bid &amp; ask spread determination
- Implementation in Hummingbot

<!-- ========================================================================================== -->
## Understanding the Avellaneda &amp; Stoikov Model
<!-- ========================================================================================== -->

The model addresses two primary concerns of market makers: * Inventory risk management * Optimal bid and ask spread determination

Avellaneda &amp; Stoikov propose formulas aiding market makers in addressing these challenges.

Reservation price:

$$

r(s, q, t) = s - q \gamma \sigma^2 (T - t)

$$

Optimal bid &amp; ask spread:

$$

\delta^a + \delta^b = \gamma \sigma^2 (T - t) + \frac{2}{\gamma}\ln \left(1 + \frac{\gamma}{\kappa}\right)

$$

Where,

- $s$ = current market mid-price  
- $q$ = inventory quantity of base asset (positive/negative for long/short positions)  
- $\sigma$ = market volatility  
- $T$ = normalized closing time (1)  
- $t$ = current time as a fraction of \(T\)  
- $\delta^a$, $\delta^b$ = symmetrical bid/ask spread  
- $\gamma$ = inventory risk aversion parameter  
- $\kappa$ = order book liquidity parameter

This article simplifies these formulas and their meanings. Stay tuned for an upcoming article with more technical details.

<!-- ========================================================================================== -->
## Reservation Price Explained
<!-- ========================================================================================== -->
Traditional market making involves symmetrical bid and ask orders around the market's mid-price. However, this can lead to inventory skewing, potentially putting the trader at risk if the asset value moves unfavorably.

For example, in a BTC-USDT downtrend using a symmetrical strategy, the market maker ends up accumulating BTC, decreasing the total inventory value.

![](https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/btc_downtrend.png)

Avellaneda &amp; Stoikov's approach calculates a new reference price for order placement, considering:

$$

r(s, q, t) = s - q \gamma \sigma^2 (T - t)

$$

<!-- ------------------------------------------------------------------------------------------ -->
### Inventory Position Deviation ($q$)
<!-- ------------------------------------------------------------------------------------------ -->
The value of q in the formula represents the deviation from the target inventory. For example: * At $q = 0$, the reservation price equals the market mid-price; * At $q &lt; 0$, the trader is short, raising the reservation price to favor buy orders; * At $q &gt; 0$, the trader is long, lowering the reservation price to favor sell orders.

Hummingbot calculates $q$ based on your specified target inventory percentage.

<!-- ------------------------------------------------------------------------------------------ -->
### Inventory Risk Tolerance ($\gamma$)
<!-- ------------------------------------------------------------------------------------------ -->
This parameter, set by the trader, indicates willingness to take inventory risk. A near-zero $\gamma$ means the reservation price is close to the market mid-price, similar to a symmetrical strategy. As $\gamma$ increases, the reservation price adjusts more aggressively to match inventory targets.

In Hummingbot, $\gamma$ can be manually set or automatically calculated.

<!-- ------------------------------------------------------------------------------------------ -->
### Remaining Trading Session Time ($T-t$)
<!-- ------------------------------------------------------------------------------------------ -->
Considering traditional financial markets with defined trading sessions, this model adjusts the reservation price closer to the mid-price as the session end approaches, minimizing inventory risk.

Hummingbot allows setting the trading session duration, adapting the model for 24/7 cryptocurrency markets.

Note: Avellaneda &amp; Stoikov also propose an infinite horizon model, more suitable for continuous markets, which we plan to include in future releases.

Market volatility ($\sigma$) also influences the reservation price but is not a trader-defined factor. Increased volatility widens the gap between the reservation and mid-prices.

<!-- ========================================================================================== -->
## Determining the Optimal Spread
<!-- ========================================================================================== -->
The model's second aspect focuses on the optimal order book positioning for profitability.

$$ \delta^a | \delta^b = \gamma \sigma^2 (T - t) + \frac{2}{\gamma}ln(1+\frac{\gamma}{\kappa}) $$

Here, the reservation price factors ($\gamma$ and $(T-t)$) reappear, with the addition of:

<!-- ------------------------------------------------------------------------------------------ -->
### Order Book Liquidity ($\kappa$)
<!-- ------------------------------------------------------------------------------------------ -->
While the paper delves into mathematical details, the key takeaway is that a high $\kappa$ value indicates denser order books, requiring smaller spreads. Conversely, a low $\kappa$ suggests less liquidity, allowing for wider spreads.

<!-- ========================================================================================== -->
## Combining Reservation Price and Optimal Spread
<!-- ========================================================================================== -->
The model's execution logic is straightforward:

1. Calculate the reservation price based on target inventory.
2. Determine the optimal bid and ask spread.
3. Place market orders around the reservation price:
    - Bid price = reservation price - half of optimal spread
    - Ask price = reservation price + half of optimal spread

This dynamic is illustrated below:

![](https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/strategy_in_action.png)

The calculated reservation price (green line) often deviates from the market mid-price (blue line). The reservation price adjusts based on inventory, influencing order placement relative to the mid-price.

<!-- ========================================================================================== -->
## Parameter Calculations
<!-- ========================================================================================== -->
The key factors in the Avellaneda-Stoikov model are:

1. Inventory position ($q$)
2. Remaining trading session time ($T-t$)
3. Risk factor ($\gamma$)
4. Order book depth ($\kappa$)

For each, the associated Hummingbot parameter is:

1. Inventory Distance ($q$): Reflects the difference between current and target inventory. In Hummingbot, set your asset inventory target percentage, and the bot calculates $q$.
2. Session Time ($T-t$): Adapts the model for the non-stop nature of cryptocurrency markets. Define your desired trading session duration in Hummingbot.
3. Risk Factor ($\gamma$) &amp; Order Book Depth ($\kappa$): While the paper doesn't specify calculations for these, Hummingbot's "easy mode" automatically determines them based on desired spread limits. Alternatively, set config parameters_based_on_spread to False and manually input values using config order_book_depth_factor and config risk_factor.

<!-- ========================================================================================== -->
## Configuring Hummingbot
<!-- ========================================================================================== -->
Creating the strategy in Hummingbot involves the create command and specifying avellaneda_market_making as the strategy name.

![](https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/config_1.png)

After selecting the exchange and trading pair, decide whether to let Hummingbot calculate the risk factor and order book depth.

![](https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/config_2.png)

Set your maximum and minimum desired spreads, which define the limits for the calculated optimal spread.

![](https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/config_3.png)

The risk aversion parameter dictates your inventory risk preference. A value close to 1 indicates a conservative approach.

![](https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/config_4.png)

Finally, specify your inventory target percentage, determining how much of your total inventory should be in the base asset.

![](https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/config_5.png)

Additional configurations in Hummingbot include closing_time (session duration) and volatility_buffer_size (data timeframe for volatility calculation).

![](https://hummingbot.org/blog/guide-to-the-avellaneda-stoikov-strategy/all_config.png)

<!-- ========================================================================================== -->
## Final Thoughts
<!-- ========================================================================================== -->
Optimal market-making strategies have been a focus of academic research for decades. With high-frequency trading (HFT) playing a significant role in today's markets, there's much for our team to explore. If you have an intriguing model to suggest, join us on Discord!

<!-- ========================================================================================== -->
## Join Our Community
<!-- ========================================================================================== -->
Join our Discord channel to engage with fellow market makers and arbitrageurs. Follow us on Twitter and Reddit for updates and news. Don't miss our content on market making, including interviews with professional traders, on our Youtube Channel.

</details>

<h1 id="참고자료">참고자료</h1>
<ul>
  <li>https://hummingbot.org/strategies/avellaneda-market-making</li>
  <li>https://hummingbot.org/blog/guide-to-the-avellaneda–stoikov-strategy/</li>
  <li><a href="https://medium.com/hummingbot/a-comprehensive-guide-to-avellaneda-stoikovs-market-making-strategy-102d64bf5df6">A comprehensive guide to Avellaneda &amp; Stoikov’s market-making strategy</a></li>
  <li><a href="https://people.orie.cornell.edu/sfs33/LimitOrderBook.pdf">High-frequency trading in a limit order book</a></li>
</ul>]]></content><author><name>성민석</name><email>minsuksung@korea.ac.kr</email></author><category term="blog" /><category term="hummingbot" /><category term="market-making" /><category term="algorithm-trading" /><summary type="html"><![CDATA[Avellaneda &amp; Stoikov 전략 가이드]]></summary></entry><entry><title type="html">What is Inventory Risk?</title><link href="https://minsuk-sung.github.io/blog/hummingbot-what-is-inventory-risk/" rel="alternate" type="text/html" title="What is Inventory Risk?" /><published>2025-09-04T00:00:00+09:00</published><updated>2025-09-04T00:00:00+09:00</updated><id>https://minsuk-sung.github.io/blog/hummingbot-what-is-inventory-risk</id><content type="html" xml:base="https://minsuk-sung.github.io/blog/hummingbot-what-is-inventory-risk/"><![CDATA[<p><img src="https://hummingbot.org/blog/what-is-inventory-risk/cover.webp" alt="" /></p>

<p>안녕하세요, Hummingbot 커뮤니티 여러분!</p>

<p>오늘부터 저는 모든 종류의 트레이딩 작업에 포함되는 가장 중요한 요소라고 생각하는 것, 바로 리스크와 리스크 관리에 대해 이야기 시작하겠습니다.</p>

<p>우리 시대의 가장 위대한 투자자 중 한 명이 말했듯이:</p>

<p>“리스크는 당신이 무엇을 하고 있는지 모르는 데서 온다.” ~ 워런 버핏</p>

<p><img src="https://hummingbot.org/blog/what-is-inventory-risk/image3.png" alt="" /></p>

<p>모든 종류의 금융 활동에는 다양한 수준의 리스크가 있으며, 마켓 메이킹도 예외는 아닙니다.</p>

<p>미래의 이익을 상상하고 예측하며 차세대 워런 버핏이 되는 것을 공상하는 것이 더 흥미로워 보일 수 있지만, 투자의 현실적이고 덜 화려한 부분, 그리고 아마도 가장 중요한 부분은 무엇이 잘못될 수 있는지 파악하고 그로 인해 발생할 수 있는 손실을 완화하는 방법을 찾는 것입니다.</p>

<p>리스크와 리스크 관리에 대해 다룰 내용이 많지만, 오늘은 마켓 메이킹과 관련된 주요 리스크 중 하나인 <strong>재고 위험(inventory risk)</strong>에 초점을 맞추겠습니다.</p>

<p>오늘 글에서 다룰 내용은 다음과 같습니다:</p>

<ul>
  <li>재고 가치란 무엇인가?</li>
  <li>재고 위험이란 무엇인가?</li>
  <li>Hummingbot으로 재고 위험을 완화하는 방법</li>
</ul>

<p>그리고 언제나처럼, 저희 디스코드의 #trader-chat에 참여하여 커뮤니티와 함께 마켓 메이킹 전략을 개선하는 방법에 대해 논의하는 것을 환영합니다.</p>

<!-- ========================================================================================== -->
<h2 id="1️⃣-재고-위험이란-무엇인가">1️⃣ 재고 위험이란 무엇인가?</h2>
<!-- ========================================================================================== -->
<p>마켓 메이커로서, 당신의 주요 역할은 다른 시장 참여자들에게 <u>유동성을 제공</u>하는 것입니다.</p>

<p>당신은 다른 트레이더들에게 서비스를 제공하며, 다른 모든 사람들에게 자산을 사고팔겠다고 제안하고, 그 대가로 매수 호가와 매도 호가 사이의 스프레드 크기(낮게 사서 높게 파는 주문)를 통해 보상을 받습니다.</p>

<p>이 서비스를 제공하기 위해, 마켓 메이커는 주문을 생성하고 거래를 하기 위해 일정량의 자산을 재고로 보유해야 하며, 이 재고에는 그에 상응하는 가치가 있습니다.</p>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="재고-가치-inventory-value">재고 가치 (Inventory Value)</h3>
<!-- ------------------------------------------------------------------------------------------ -->

<p>모든 시장 참여자가 이미 알고 있듯이, 자산의 가격은 끊임없이 변하며, 모든 트레이더는 자신이 이익을 내고 있는지 아닌지를 추적할 방법이 있어야 합니다.</p>

<p>성과를 추적하는 한 가지 간단한 방법은 트레이더가 소유한 자산의 총 가치를 비교하는 것입니다.</p>

<p>예를 들어, 현재 당신이 0.46820424 BTC와 14.6426 ETH를 소유하고 있다고 가정해 봅시다:</p>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="1일차-재고">1일차 재고</h3>
<!-- ------------------------------------------------------------------------------------------ -->

<p><img src="https://hummingbot.org/blog/what-is-inventory-risk/table1.PNG" alt="" /></p>

<p>첫째 날, 당신의 자산의 현재 가치는 10,000달러입니다. 실제로 USD를 전혀 소유하고 있지 않고 BTC와 ETH만 소유하고 있더라도, 현재 시장 가격으로 BTC와 ETH를 10,000달러로 전환할 수 있는 능력이 있습니다.</p>

<p>재고 가치는 벤치마크 자산 대비 자산의 가치가 변할 수 있기 때문에 시장 가격의 변화에 따라 변동될 수 있습니다.</p>

<p>만약 당신이 거래하지 않았다면, 2일차에도 시작 포트폴리오와 동일한 양의 BTC와 ETH를 가지고 있을 것입니다.</p>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="2일차-재고">2일차 재고</h3>
<!-- ------------------------------------------------------------------------------------------ -->

<p><img src="https://hummingbot.org/blog/what-is-inventory-risk/table2.PNG" alt="" /></p>

<p>그러나 이 자산들의 USD 가격이 변했기 때문에, 재고 가치는 9,761.38달러로 하락했습니다. BTC 가치는 올랐지만, ETH 가치는 떨어졌습니다.</p>

<p>재고 가치는 포트폴리오에 보유된 모든 자산의 현재 가치로, 선택한 벤치마크 또는 기준 자산(예: USD)으로 정량화됩니다.</p>

<p>가치를 결정하기 위한 벤치마크 기준 자산 선택은 투자자마다 다릅니다. 예를 들어, 미국 투자자는 USD를 사용할 수 있지만, 유럽 투자자는 유로를 선택할 수 있습니다. 이는 적어도 현재로서는 그들의 비용(음식, 임대료) 대부분이 여전히 USD(또는 유로)로 표시되고, 법정화폐가 여전히 그들의 자산과 구매력의 벤치마크이기 때문입니다.</p>

<!-- ========================================================================================== -->
<h2 id="2️⃣-트레이딩에서의-재고-위험">2️⃣ 트레이딩에서의 재고 위험</h2>
<!-- ========================================================================================== -->
<p><u>마켓 메이커의 주요 목표는 시간이 지남에 따라 총 재고 가치를 높이는 것</u>입니다. 더 일반적이고 보편적인 투자 접근 방식은 미래에 가치가 상승할 자산을 사려고 노력하는 것입니다. 이것은 “방향성” 투자로, “저렴한” 자산을 사서 자산 가격이 결국 오를 것이라고 베팅하는 것입니다.</p>

<p>반면에, 마켓 메이커는 시간이 지남에 따라 점진적인 매수-매도 스프레드를 포착하고 축적함으로써 포트폴리오 가치를 높이려고 합니다. 마켓 메이커는 지속적으로 자산을 동시에 사고팔겠다고 제안하며, 팔려는 가격보다 약간 낮은 가격에 사겠다고 제안합니다. 마켓 메이커가 매수와 매도를 완료할 수 있다면, 그는 이 차이인 “매수-매도 스프레드”의 일부를 포착할 수 있습니다. 마켓 메이커가 이 매수-매도 사이클을 더 많이 완료할수록, 더 많은 이익을 축적할 수 있습니다.</p>

<p>첫 번째 아카데미 글에서 언급했듯이, <u>마켓 메이커에게 이상적인 상황은 가격이 추세 없이 움직일 때</u>입니다:</p>

<p><img src="https://hummingbot.org/blog/what-is-inventory-risk/image6.png" alt="" /></p>

<p>가격이 일정 범위 내에서 거래될 때, 마켓 메이커의 매수와 매도가 동일한 빈도로 체결될 가능성이 높아지고, 마켓 메이커가 점진적인 이익을 축적할 가능성이 높아집니다.</p>

<font color="red">문제는 가격이 한 방향으로 추세를 보이기 시작할 때 시작됩니다.</font>

<p>예를 들어, 가격이 하락 추세를 보이기 시작하면, 그의 매수 주문은 체결되기 시작하지만, 매도 주문은 체결되지 않습니다:</p>

<p><img src="https://hummingbot.org/blog/what-is-inventory-risk/image8.png" alt="" /></p>

<p>출처: 저희 커뮤니티 멤버 @Christian Feldmann</p>

<p>이 상황의 결과는 마켓 메이커가 가치를 잃고 있는 자산의 재고를 늘리기 시작하여, 시간이 지남에 따라 총 재고 가치가 감소하게 된다는 것입니다.</p>

<p>결국 가격이 수익성 있는 수준으로 돌아와 마켓 메이커가 자신의 재고를 수익성 있는 가격에 팔 수 있을 수도 있습니다. 하지만 문제는, 이 상황이 지속되고 가격이 계속 하락하면, 모든 마켓 메이커의 재고가 한쪽에 묶이게 된다는 것입니다.</p>

<p>어떤 시점에서, 마켓 메이커는 자신의 운영을 중단하고 더 나은 가격을 기다릴지, 아니면 운영을 계속하기 위해 손실을 보고 재고를 팔기 시작할지 결정해야 합니다.</p>

<p>이것은 소매점 관리자가 더 나은 가격에 공급업체로부터 더 많은 제품을 사서 재고를 늘리기 시작했지만, 그의 고객들은 그의 제품을 사는 데 별로 관심이 없는 것과 유사합니다.</p>

<p>마켓 메이커가 매수와 매도 주문을 모두 생성하더라도, 양쪽이 모두 체결될 것이라는 보장은 없습니다. 위 예시에서, 매수 주문은 계속 체결되지만 매도 주문은 결코 체결되지 않습니다. 이것은 또한 마켓 메이커를 보유 재고량의 변동 위험에 노출시킵니다. 예를 들어, 마켓 메이커는 가치를 잃고 있는 자산을 축적할 수 있습니다. 반대로, 가치가 상승하고 있는 자산을 팔아버릴 수도 있습니다.</p>

<blockquote>
  <p>재고 위험은 마켓 메이커가 자신의 재고에 대한 구매자를 찾지 못할 확률로, 정확히 잘못된 시점에 자산을 더 많이 보유하게 될 위험을 초래합니다. 예를 들어, 가격이 하락할 때 자산을 축적하거나 가격이 상승할 때 너무 일찍 파는 것입니다.</p>
</blockquote>

<!-- ========================================================================================== -->
<h2 id="3️⃣-hummingbot을-이용한-재고-위험-관리">3️⃣ Hummingbot을 이용한 재고 위험 관리</h2>
<!-- ========================================================================================== -->
<p>재고 위험은 마켓 메이킹의 주요 위험입니다. 이것이 Hummingbot이 재고 위험을 완화하기 위해 설계된 많은 전략 사용자 정의를 허용하는 이유이며, 우리 팀이 이와 관련된 더 많은 기능을 계속 개발하는 이유입니다.</p>

<p>이러한 유연성을 통해 마켓 메이커는 다양한 방법으로 운영 위험을 완화하고, 자신의 주요 전략에 맞는 조정을 할 수 있습니다.</p>

<p>재고 위험을 통제할 수 있는 몇 가지 예는 다음과 같습니다:</p>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="history-명령어">history 명령어</h3>
<!-- ------------------------------------------------------------------------------------------ -->
<p><code class="language-plaintext highlighter-rouge">history</code> 명령어는 과거 거래 내역과 봇 시작 이후 총 자산량의 변화 요약을 표시합니다.</p>

<p>각 측면의 재고가 얼마나 변했는지 시각화하고 총 가치와 비교하는 좋은 방법입니다.</p>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="인벤토리-스큐-inventory-skew">인벤토리 스큐 (Inventory skew)</h3>
<!-- ------------------------------------------------------------------------------------------ -->
<p><code class="language-plaintext highlighter-rouge">config inventory_skew_enabled</code>를 사용하면 봇이 매 새로운 주문마다 <code class="language-plaintext highlighter-rouge">order_amount</code>(주문 수량)를 변경하여 총 재고 크기를 재조정합니다.</p>

<p>재고에 있는 각 자산의 목표 비율은 <code class="language-plaintext highlighter-rouge">config inventory_target_base_pct</code> 명령어를 통해 정의할 수 있으며, 재고가 이 비율에서 얼마나 벗어날 수 있는지는 <code class="language-plaintext highlighter-rouge">config inventory_range_multiplier</code>를 사용하여 정의할 수 있습니다.</p>

<p><img src="https://hummingbot.org/blog/what-is-inventory-risk/image4.png" alt="" /></p>

<p>위에서 볼 수 있듯이, 재고에 USDT보다 BTC가 더 많으며, 봇은 사는 것보다 더 많이 팔고 있습니다.</p>

<p>이 매개변수는 재고 보호용으로 사용될 수 있습니다. 예를 들어, 마켓 메이커가 한 방향으로 추세가 형성되는 것을 발견하면: BTC 가격이 상승 추세라면, 마켓 메이커는 <code class="language-plaintext highlighter-rouge">config inventory_target_base_pct</code>를 70으로 설정하여 더 많은 BTC를 축적하기 시작할 수 있습니다.</p>

<p>또한, USD가 아닌 페어(예: ETH-BTC)를 거래하는 경우 특히 유용합니다. 트레이더는 각 자산의 가치를 USD와 비교하여 평가하고, 미래에 자산 중 하나의 가치가 더 높아질 것이라고 생각하면 인벤토리 스큐를 조정할 수 있습니다.</p>

<p><img src="https://hummingbot.org/blog/what-is-inventory-risk/image9.png" alt="" /></p>

<blockquote>
  <p>인벤토리 스큐는 끊임없는 시계추 균형잡기와 같습니다. 트레이더가 한 자산을 더 많이 축적하면, Hummingbot은 목표 보유량으로 돌아가기 위해 주문 크기를 조정(매수 축소, 매도 확대)하며, 그 반대의 경우도 마찬가지입니다.</p>
</blockquote>

<p>인벤토리 스큐는 재고량이 너무 많이 변동하는 위험을 최소화하는 것을 목표로 합니다. 50%와 같은 목표 비율을 유지하려고 노력하면 마켓 메이커가 계속해서 매수 및 매도 양쪽 호가를 제시하고 매수-매도 스프레드를 포착할 수 있도록 보장하는 데 도움이 됩니다.</p>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="체결-주문-지연-filled-order-delay">체결 주문 지연 (Filled Order Delay)</h3>
<!-- ------------------------------------------------------------------------------------------ -->
<p><code class="language-plaintext highlighter-rouge">filled_order_delay</code> 매개변수를 통해, 마켓 메이커는 이전 주문이 체결된 후 봇이 후속 새 주문을 생성하는 데 지연 시간을 설정할 수 있습니다.</p>

<p>예를 들어, <code class="language-plaintext highlighter-rouge">filled_order_delay</code> = 300으로 설정하면 봇이 생성한 주문이 체결될 때, 다음 주문 쌍은 300초 후에만 생성됩니다.</p>

<p>이것은 가격이 추세일 때 기간을 관리하는 데 도움이 됩니다. 예를 들어, 아래 다이어그램에서 가격이 하락 추세일 때, 주문이 새로고침될 때마다 매수 주문이 계속 체결됩니다.</p>

<p><img src="https://hummingbot.org/blog/what-is-inventory-risk/image10.png" alt="" /></p>

<p>이것이 반복되고 계속되면, 마켓 메이커는 단 몇 번의 주문 새로고침 주기 만에 빠르게 많은 양의 자산을 축적하게 될 수 있습니다. 위 예시에서, 트레이더는 자산을 5번 샀습니다.</p>

<p>체결된 주문과 새 주문 배치 사이에 지연을 도입함으로써, 이는 주문 간의 간격을 두고 자산의 잠재적 축적을 억제하며, 가격 추세가 안정될 시간을 벌어줍니다.</p>

<p><img src="https://hummingbot.org/blog/what-is-inventory-risk/image1.png" alt="" /></p>

<p>위에서 볼 수 있듯이, 1번 기간의 매수 주문이 체결되었기 때문에 봇은 2, 3, 4번 기간에 주문을 내지 않았습니다. 따라서 이 하락 가격 추세에서 봇은 두 번만(1번과 5번 기간) 샀지만, 체결 주문 지연이 활성화되지 않았을 때는 봇이 다섯 기간 모두에서 샀을 것입니다.</p>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="행잉-오더-hanging-orders">행잉 오더 (Hanging Orders)</h3>
<!-- ------------------------------------------------------------------------------------------ -->
<p>행잉 오더는 Hummingbot에게 동시에 생성된 매수와 해당 매도 주문을 한 쌍으로 취급하도록 지시하는 기능입니다. 한쪽이 체결되면, 봇은 쌍의 다른 쪽을 미체결 상태로 유지하여, 그쪽이 결국 체결될 기회와 가능성을 만듭니다:</p>

<p><img src="https://hummingbot.org/blog/what-is-inventory-risk/image7.png" alt="" /></p>

<p>위 예시에서, 1번 기간의 매수 주문이 체결되었습니다. 하지만 행잉 오더 모드가 활성화되었기 때문에, 1번 기간의 원래 매도 주문은 새로고침 주기(2번 기간) 동안 취소되지 않고 미체결 상태로 남아 있습니다. 그동안 봇은 새 주문을 생성하는 작업을 계속합니다(2번부터 5번 기간 참조). 예시에서 가격 방향이 바뀌었고, 결국 어느 시점에서 행잉 매도 주문이 5번 기간 즈음에 체결되었습니다.</p>

<p>이 전략의 이점은 쌍이 “완료”되고 균형을 이룰 가능성을 만든다는 것입니다. 위 예시에서, 행잉 오더를 통해 트레이더는 결국 매수와 매도를 일치시키면서 매수-매도 스프레드를 확정할 수 있습니다.</p>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="핑퐁-ping-pong">핑퐁 (Ping Pong)</h3>
<!-- ------------------------------------------------------------------------------------------ -->
<p>핑퐁 전략은 매수와 매도의 균형을 유지하려는 또 다른 전략입니다. 이는 체결된 주문의 반대쪽에만 주문을 생성함으로써 그렇게 합니다. 예를 들어:</p>

<p><img src="https://hummingbot.org/blog/what-is-inventory-risk/image5.png" alt="" /></p>

<p>1번 기간의 매수 주문이 체결되었기 때문에, 봇은 매수 주문 배치를 중단하고 매도 주문만 배치합니다(2-4번 기간). 매도 주문이 결국 체결될 때(4번 기간)에만 봇은 매수 및 매도 주문 생성을 재개합니다(5번 기간).</p>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="가격-추세를-따르기-위해-한쪽-스프레드-조정">가격 추세를 따르기 위해 한쪽 스프레드 조정</h3>
<!-- ------------------------------------------------------------------------------------------ -->
<p>보통 마켓 메이커들은 동일한 <code class="language-plaintext highlighter-rouge">bid_spread</code>와 <code class="language-plaintext highlighter-rouge">ask_spread</code>를 적용합니다. 이것은 횡보장에서 훌륭합니다. 왜냐하면 가격이 범위 내에서 움직일 것이고, 자연스럽게 재고는 50/50 비율을 유지하는 경향이 있으며, 마켓 메이커는 스프레드에서 이익을 얻을 것이기 때문입니다.</p>

<p>하지만 위에서 말했듯이, 추세장에서는 문제가 됩니다. 재고가 덜 가치 있는 자산 쪽으로 축적되기 시작할 수 있기 때문입니다.</p>

<p>이를 완화하는 한 가지 옵션은 한쪽의 스프레드를 좁혀서 해당 주문이 먼저 체결될 확률을 높이는 것입니다.</p>

<p>예시:</p>

<p>마켓 메이커인 마크는 BTC-USDT에서 <code class="language-plaintext highlighter-rouge">bid_spread</code> = 0.5와 <code class="language-plaintext highlighter-rouge">ask_spread</code> = 0.5로 운영을 시작했습니다. 하지만 가격이 상승 추세를 보이기 시작하여, 그는 매개변수를 <code class="language-plaintext highlighter-rouge">bid_spread</code> = 0.1과 <code class="language-plaintext highlighter-rouge">ask_spread</code> = 0.9로 변경했습니다.</p>

<p>그렇게 하면, 그의 총 스프레드는 여전히 동일하지만(1%), 그의 매수 제안은 이제 매도 제안보다 체결될 확률이 더 높아집니다.</p>

<!-- ------------------------------------------------------------------------------------------ -->
<p>스크립트 (Scripts)
<!-- ------------------------------------------------------------------------------------------ --></p>

<p>Hummingbot에는 내장된 스크립트 기능이 있어, 자신만의 맞춤 전략을 만들 수 있으며, 봇은 당신이 원하는 어떤 전략에든 기반하여 매개변수를 조정할 것입니다.</p>

<p>필요한 것은 파이썬으로 코딩하는 방법을 알고, Hummingbot 코드 베이스와 통합된 .py 파일을 만들고, <code class="language-plaintext highlighter-rouge">config script_enabled</code> 명령어를 통해 스크립트를 활성화하는 것뿐입니다(스크립트에 대한 더 많은 정보는 여기에서 찾을 수 있습니다).</p>

<p>이 레딧 유저가 물었던 것처럼, 자동화된 마켓 메이킹(AMM) 로직을 복제하는 스크립트를 만들 수도 있습니다.</p>

<p>저희 개발팀은 스크립트 모듈에 대한 많은 개선 작업을 하고 있습니다. 이것이 Hummingbot 사용자들이 자신들의 맞춤 전략을 구현할 수 있는 주요 방법이기 때문입니다.</p>

<!-- ========================================================================================== -->
<h2 id="4️⃣-마무리하며">4️⃣ 마무리하며</h2>
<!-- ========================================================================================== -->
<p>요즘 트레이더가 되는 것은 정말 쉽습니다.</p>

<p>하지만 좋은 트레이더가 되는 것은 또 다른 이야기입니다.</p>

<p>제가 금융 시장을 공부한 이 몇 년 동안 깨달은 것은, 좋은 트레이더와 나쁜 트레이더를 구분하는 주요한 것은 그들이 리스크에 대해 얼마나 알고 있고 그것을 어떻게 관리하는가 하는 것입니다.</p>

<p>좋은 전략은 돈을 버는 최선의 방법을 찾는 것뿐만 아니라, 시장이 당신의 계획과 반대로 움직일 때 무엇을 해야 할지 아는 것이기도 합니다.</p>

<p>각 유형의 트레이딩 작업과 관련된 위험을 이해하는 것은 지속 가능하고 수익성 있는 전략을 찾는 데 필수적입니다.</p>

<p>마켓 메이킹과 관련된 주요 위험은 재고 위험입니다. 어떤 시장에서든 마켓 메이커로 운영하려는 모든 사람에게 이것을 이해하고 완화하는 방법을 배우는 것이 우선순위가 되어야 합니다.</p>

<p>이 글은 이 주제에 대한 설명과 Hummingbot을 사용하여 이 위험을 관리하는 몇 가지 실용적인 방법을 다루었지만, 이것은 매우 중요한 주제여서 ‘<a href="https://arxiv.org/abs/1105.3115">Dealing with the Inventory Risk: A Solution to the Market Making Problem</a>‘이나 ‘<a href="http://apps.olin.wustl.edu/faculty/liuh/Papers/Bid_Ask_JET.pdf">Market making with asymmetric information and inventory risk</a>‘와 같은 방대한 양의 연구 논문이 있으며, 결국 가까운 미래에 이 주제에 대해 더 많이 이야기할 것입니다.</p>

<p>또한, 최근 자동화된 마켓 메이커 프로토콜(유니스왑과 같은 유동성 풀), 유동성 채굴, 그리고 탈중앙화 금융(DeFi)과 관련된 모든 것의 부상과 함께, 수동적인 마켓 메이커가 되려는 경우 위험을 이해하는 것이 정말 중요합니다.</p>

<p>그러니 저희 블로그를 계속 지켜봐 주세요. 곧 이들 프로토콜과 전통적인 오더북 마켓 메이킹의 주요 차이점을 비교하는 글을 게시할 예정입니다.</p>

<p>다음 주에 뵙겠습니다.</p>

<!-- ========================================================================================== -->
<h2 id="5️⃣-저희-커뮤니티에-참여하세요">5️⃣ 저희 커뮤니티에 참여하세요</h2>
<!-- ========================================================================================== -->
<p>더 배우고 싶다면, 매주 새로운 글이 올라오는 저희 블로그 업데이트를 꼭 팔로우하세요.</p>

<p>다음 글을 기다리는 동안, 저희 디스코드 서버에 참여하는 것을 잊지 마세요. 이곳은 우리 커뮤니티가 마켓 메이킹과 차익거래, 그리고 Hummingbot을 사용하여 트레이딩 전략을 개선할 수 있는 모든 가능한 방법에 대해 이야기하는 곳입니다.</p>

<p>또한, Hummingbot 아카데미에서 다루었으면 하는 특정 주제가 있다면, 디스코드에서 저희 팀에 연락하거나 academy@hummingbot.io로 이메일을 보내주세요.</p>

<p>곧 뵙겠습니다. 모두 수익성 있는 트레이딩 세션이 되시기를 바랍니다!</p>

<p>다음 주에 뵙겠습니다!</p>

<details>
<summary><a href="https://hummingbot.org/blog/what-is-inventory-risk/">Show original (English)</a></summary>

![](https://hummingbot.org/blog/what-is-inventory-risk/cover.webp)

Hello again Hummingbot community!

Today we will start to talk about what I consider the most important factor that is part of all types of trading operations: risk and risk management.

As one of the biggest investors of our time once said:

"Risk comes from not knowing what you're doing." ~ Warren Buffett

![](https://hummingbot.org/blog/what-is-inventory-risk/image3.png)

All kinds of financial operations have varying degrees of risk, and market making is no different.

While it seems more exciting to imagine and project future gains and fantasize about being the next Warren Buffet, the reality and less glamorous part of investing, and arguably the most important part, is trying to figure out what can go wrong and how to mitigate losses that can result.

There is a lot to cover about risk and risk management, but today we will focus on one major risk related to market making: inventory risk.

Here is what we’ll cover in today's article:

- What is inventory value?
- What is inventory risk?
- How to mitigate inventory risk with Hummingbot

And as always, you are welcome to join the #trader-chat on our Discord to discuss with the community how to improve your market making strategy.

<!-- ========================================================================================== -->
## 1️⃣ What is Inventory risk?¶
<!-- ========================================================================================== -->
As a market maker, your main role is to provide liquidity to other market participants.

You are providing a service to other traders, offering to buy and sell assets from and to everyone else, while getting paid to do so through the spread size between your bid and ask offers (orders to buy low, sell high).

To be able to provide this service, the market maker must hold some amount of assets in inventory in order to create orders and make trades, and this inventory has a value associated with it.

### Inventory Value

As any market participant already knows, the prices of assets are constantly changing, and all traders must have a way to track if they are making profit or not.

One simple way to track performance is to compare the total value of the assets owned by the trader.

For example, let’s assume that you currently own 0.46820424 BTC and 14.6426 ETH:

### Day 1 Inventory

![](https://hummingbot.org/blog/what-is-inventory-risk/table1.PNG)

On the first day, the current value of your assets is $10,000. Even though you don't actually own any USD and only own BTC and ETH, you have the ability to convert your BTC and ETH to $10,000 at current market prices.

Inventory value can fluctuate due to changes in market prices because the value of the assets relative to the benchmark asset can change

If you haven’t traded (HODL!), on day 2 you would still have the same amount of BTC and ETH from the starting portfolio.

### Day 2 Inventory

![](https://hummingbot.org/blog/what-is-inventory-risk/table2.PNG)

However, since the USD prices for these assets changed, the inventory value has gone down to $9,761.38. The BTC value went up, while the ETH value went down.

Inventory value is the current value of all assets held in a portfolio, quantified to some chosen benchmark or reference asset (e.g. USD).

Choosing the benchmark reference asset for determining value varies by investor. For example, investors from the U.S. may use USD, whereas an investor in Europe may choose Euro. This is because, at least currently, most of their costs (food, rent) are still denominated in USD (or Euro), and fiat is still the benchmark for their assets and buying power.

<!-- ========================================================================================== -->
## 2️⃣ Inventory risk in trading
<!-- ========================================================================================== -->
The main objective of a market maker is to increase his total inventory value over time. The more common and general approach to investing is trying to buy assets that will appreciate in value in the future. This is “directional” investing, buying “cheap” assets and betting that the price of an asset will eventually go up.

In contrast, a market maker tries to increase portfolio value over time by capturing incremental bid-ask spreads and accumulating them over time. The market maker continually offers to simultaneously buy and sell assets, offering to be at a slightly lower price than he is offering to sell. If the market maker is able to complete a buy and sell, they are able to capture some of this difference, the “bid-ask spread”. The more times a market-maker can complete this cycle of buy and sell, the more profits they are able to accumulate.

As I mentioned in the first academy article, the ideal situation for a market maker is when the price is moving without a trend:

![](https://hummingbot.org/blog/what-is-inventory-risk/image6.png)

When prices are trading within a range, the more likely a market maker's buys and sells being filled with equal frequency, and the more likely the market maker is able to accumulate incremental profits.

The trouble begins when the prices start to trend in one direction.

For example, if the price starts to trend downward, his buy orders will start to be filled, but not the sell orders:

![](https://hummingbot.org/blog/what-is-inventory-risk/image8.png)

Source: Our community member @Christian Feldmann

The consequence of this situation is that the market maker will begin to increase the inventory of the asset that is losing value, resulting in total inventory value decreasing over time.

Eventually, the price could come back to a profitable level and the market maker would be able to sell his inventory at a profitable price. But the problem is that, if this situation persists and the price keeps dropping, all the market maker inventory will be locked on one side.

At some point, the market maker will have to decide between stopping his operation and wait for better prices or start selling his inventory at a loss to keep his operation going.

This similar to a retail store manager started to increase his inventory, buying more products from suppliers at better prices, but his customers aren't very interested in buying his products.

Even though the market maker creates both buy and sell orders, there’s no guarantee that both sides will be filled. In the example above, the bids keep getting filled but the sells never get filled. This also exposes the market maker to the risk of swings in the amount of inventory held. For example, the market maker might accumulate assets losing value; conversely, the market maker might end up selling off assets that are appreciating in value.

&gt; Inventory risk is the probability a market maker can't find buyers for his inventory, resulting in the risk of holding more of an asset at exactly the wrong time, e.g. accumulating assets when prices are falling or selling too early when prices are rising.

<!-- ========================================================================================== -->
## 3️⃣ Inventory risk management with hummingbot
<!-- ========================================================================================== -->
Inventory risk is the main risk of market making. That’s why Hummingbot allows a lot of strategy customization designed to mitigate inventory risk and why our team continues to work on even more features around this.

This flexibility allows the market maker to mitigate his operational risks in a lot of different ways, and make adjustments that fit his major strategy.

Here are a few examples on how the inventory risk can be controlled:

<!-- ------------------------------------------------------------------------------------------ -->
### History command
<!-- ------------------------------------------------------------------------------------------ -->

The `history` command displays historical trades as well as a summary of changes in the total asset amounts since the bot started.

It's a good way to visualize how much the inventory changed on each side, and compare with the total value.

<!-- ------------------------------------------------------------------------------------------ -->
### Inventory skew
<!-- ------------------------------------------------------------------------------------------ -->

Using `config inventory_skew_enabled` the bot will change the `order_amount` on every new order, to rebalance the total inventory size.

The target proportion of each asset on the inventory can be defined through the command `config inventory_target_base_pct` and how much the inventory can deviate from this proportion using `config inventory_range_multiplier`.

![](https://hummingbot.org/blog/what-is-inventory-risk/image4.png)

As can be seen above, there is more BTC than USDT on the inventory, and the bot is selling more than buying.

This parameter can be used as inventory protection, for example, if the market maker spots a trend forming in one direction: if the BTC price is trending up, the market maker could start to accumulate more BTC, setting `config inventory_target_base_pct` to 70.

Also, it is particularly useful, if you are trading a non-USD pair, (ETH-BTC for example), where the trader can evaluate the value of each asset paired with USD, and adjust the inventory skewness, if you think one of the assets will have a higher value in the future.

![](https://hummingbot.org/blog/what-is-inventory-risk/image9.png)

&gt; Inventory skew is like an ongoing pendulum balancing act; once a trader accumulates more of one asset, Hummingbot adjusts order sizes (smaller buys, larger sells) to try to get back to the target holding amount, and vice versa.

Inventory skew aims to minimize the risk of inventory amounts swinging around too much. Trying to maintain a target ratio such as 50% helps to ensure that the market maker can continue to quote both bid and ask sides and capture bid-ask spreads.

<!-- ------------------------------------------------------------------------------------------ -->
### Filled Order Delay
<!-- ------------------------------------------------------------------------------------------ -->

Through the `filled_order_delay` parameter, the market maker is able to set a delay time for the bot to create subsequent new orders once a previous order has been filled.

For example, with a `filled_order_delay` = 300 when an order created by the bot is filled, the next pair of orders will only be created 300 seconds later.

This helps to manage periods when prices are trending. For example, in the diagram below, in a case when prices are trending down, bid orders keep getting filled once orders are refreshed.

![](https://hummingbot.org/blog/what-is-inventory-risk/image10.png)

If this is repeated and continues to go on, the market maker could quickly end up accumulating large amounts of the asset within a matter of just a few order refresh cycles. In the example above, the trader has bought assets 5 times.

By introducing a delay between filled orders and placing new orders, this spaces out orders and dampens the potential accumulation of assets, allowing for some time for price trends to stabilize.

![](https://hummingbot.org/blog/what-is-inventory-risk/image1.png)

You can see above, since the bid order in period 1 was filled, the bot didn’t place orders in periods 2, 3, and 4. So in this downward price trend, the bot only bought twice (periods 1 and 5) whereas when filled order delay was not enabled, the bot would have bought in all five periods.

<!-- ------------------------------------------------------------------------------------------ -->
### Hanging Orders
<!-- ------------------------------------------------------------------------------------------ -->

Hanging orders is a function that instructs Hummingbot to treat buys and corresponding sell orders created at the same time as a pairing. If one side gets filled, the bot keeps the other side of the pairing outstanding, creating the opportunity and possibility for that side to eventually get filled:

![](https://hummingbot.org/blog/what-is-inventory-risk/image7.png)

In the example above, the buy order for period 1 was filled. But since hanging orders mode was enabled, the original sell order from period 1 is not canceled during the refresh cycle (period 2) and remains outstanding. Meanwhile, the bot continues its operation of creating new orders (see periods 2 through 5). In the example, prices changed direction, and eventually at some point in the time, the hanging sell order was filled, around period 5.

The benefit of this strategy is that it creates the possibility of the pairings to be “completed” and balanced. In the example above, hanging orders allow the trader to match the buy and sell eventually, while locking in the bid-ask spread.

<!-- ------------------------------------------------------------------------------------------ -->
### Ping Pong
<!-- ------------------------------------------------------------------------------------------ -->

The ping pong strategy is another strategy that tries to keep buys and sells balanced. It does so by creating orders only on the opposite side of an order that has been filled. For example:

![](https://hummingbot.org/blog/what-is-inventory-risk/image5.png)

Because the buy order from period 1 was filled, the bot stops placing buy orders and only places sell orders (periods 2-4). Only when a sell order is eventually filled (period 4) will the bot resume creating both buy and sell orders (period 5).

<!-- ------------------------------------------------------------------------------------------ -->
### Adjust spread on one side to follow a price trend
<!-- ------------------------------------------------------------------------------------------ -->

Usually, the market makers apply the same `bid_spread` and `ask_spread`. This is great on sideways markets, because the price will be moving inside a range, and naturally the inventory will tend to be at a 50/50 rate, and the market maker will profit from the spread.

But like we said above, it gets problematic during a trending market, as the inventory may start to accumulate on the side of the less valuable asset.

An option to mitigate this is to tighten the spread on one side, to increase the probability of those orders being filled first.

Example:

Mark, the market maker started his operations on the BTC-USDT with `bid_spread` = 0.5 and `ask_spread` = 0.5. But the price started trending up, so he changed his parameters to `bid_spread` = 0.1 and `ask_spread` = 0.9.

That way, his total spread is still the same (1%), but his buy offers now have a higher chance to be filled before the sell offers.

Scripts

Hummingbot has a built-in script function, where you can create your own custom strategy, and the bot will adjust the parameters based on any strategy you want.

All you need is know how to code on Python, create a .py file integrated with Humminbot code base, and activate the script through config script_enabled command (you can find more information about scripts here.

You could even create a script that replicates an Automated Market Making logic, as this reddit user asked.

Our developer team is working on a lot of improvements for the scripts module, because this is the main way Hummingbot users will be able to implement their customized strategies.

<!-- ========================================================================================== -->
## 4️⃣ Wrapping up¶
<!-- ========================================================================================== -->
Becoming a trader these days is really easy.

But being a good trader, that’s another story.

What I realized after these years studying financial markets is that the main thing that separates good traders from bad traders is how much they know about risk and how they manage it.

A good strategy isn’t only about finding the best way to make money, but also about knowing what to do when the market moves against your plan.

Understanding the risks associated with each type of trading operation is essential to finding a sustainable and profitable strategy.

The major risk associated with market making is the inventory risk. Understanding and learning ways to mitigate it should be a priority for everyone looking to operate as a market maker on any market.

This article covered an explanation about the topic, and some practical ways to manage this risk using hummingbot, but this is such an important topic that there is a huge amount of research papers about it, like Dealing with the Inventory Risk: A Solution to the Market Making Problem and Market making with asymmetric information and inventory risk, and eventually, we will talk more about this topic in a close future.

Also, with the recent rise of the Automated Market Maker protocols (liquidity pools like Uniswap), liquidity mining, and everything related to Decentralized Finance (DeFi), it is really important to understand the risks if you are looking to be a passive market maker.

So, stay tuned on our blog, because soon we will publish an article comparing what are the key differences between these protocols and the traditional order book market making.

See you all next week.

<!-- ========================================================================================== -->
## 5️⃣ Join our community
<!-- ========================================================================================== -->
If you want to learn more, make sure to follow our blog updates for new articles every week.

While you wait for the next post, remember to join our Discord server, a place where our community talks about market making and arbitrage, and all the possible ways you can use Hummingbot to improve your trading strategies.

Also, if there is any specific topic you want us to cover on the Hummingbot Academy, contact our team on Discord, or send an email to academy@hummingbot.io.

See you soon, and I wish you all a profitable trading session!

See you all next week!

</details>

<p>여기까진 Hummingbot 블로그에서 말하는 인벤토리 리스크와 관련된 글이었습니다. 다만 재고 리스크는 단순히 보유 자산 가치가 흔들리는 문제를 넘어, 전략의 지속 가능성과 포트폴리오 전체 성과를 좌우하는 핵심 요소입니다. 예를 들어, 스프레드 수익을 꾸준히 쌓고 있다고 해도, 한쪽으로 치우친 재고가 급격한 가격 변동으로 평가손실을 키운다면 전체 PnL은 쉽게 음수로 돌아설 수 있습니다.</p>

<ul>
  <li>
    <p>정량적 지표 활용: <u>스프레드 수익과 가격 변동으로 인한 평가손익을 분리(PnL 분해)</u>해, 수익이 스프레드 덕분인지 방향성 변동 때문인지 파악하세요.</p>
  </li>
  <li>
    <p>동적 스프레드 조정: <a href="/_posts/2025-09-05-hummingbot-Avellaneda–Stoikov.md">Avellaneda–Stoikov</a> 같은 모델은 변동성·재고 수준에 따라 스프레드를 자동으로 조절하여, 재고 편향을 줄이고 예상치 못한 추세에 대응합니다. 이 내용은 다음 포스팅에서 이어서 할 예정입니다.</p>
  </li>
  <li>
    <p>헤징과 제한 설정: 현물 마켓 메이킹 시 선물이나 옵션으로 반대 포지션을 잡아 위험을 상쇄하거나, 최대 보유량과 손실 한도를 사전에 정의해두면 <strong>재고가 갇히는</strong> 상황을 완화할 수 있습니다.</p>
  </li>
  <li>
    <p>시장 환경 고려: 저유동성 코인이나 큰 뉴스 이벤트 직전에는 재고가 쉽게 묶일 수 있으므로, 변동성 지표(VIX, ATM IV)나 이벤트 캘린더를 참고해 포지션 규모를 조절하는 것이 좋습니다.</p>
  </li>
  <li>
    <p>심리적 관리: 손실 상태에서 무리한 물타기를 피하고, 주기적으로 봇 성과를 검토하는 프로세스를 갖추면 장기적으로 안정성을 높일 수 있습니다.</p>
  </li>
</ul>

<blockquote>
  <p>마켓 메이킹의 본질은 단기적인 거래를 반복하며 작은 스프레드를 포착하는 것이지만, 재고 리스크를 통제하는 능력이야말로 장기적으로 시장에서 살아남는 힘이 됩니다. 꾸준히 데이터를 기록·분석하고, 시장 상황과 전략을 함께 점검해 나간다면 더욱 탄탄한 트레이딩 운영이 가능할 것입니다.</p>
</blockquote>

<h1 id="참고자료">참고자료</h1>
<ul>
  <li>https://github.com/hummingbot/hummingbot</li>
  <li>https://hummingbot.org/blog/what-is-inventory-risk</li>
</ul>]]></content><author><name>성민석</name><email>minsuksung@korea.ac.kr</email></author><category term="blog" /><category term="hummingbot" /><category term="market-making" /><category term="algorithm-trading" /><summary type="html"><![CDATA[]]></summary></entry><entry><title type="html">What is Cross Exchange Market Making?</title><link href="https://minsuk-sung.github.io/blog/hummingbot-what-is-cross-exchange-market-making/" rel="alternate" type="text/html" title="What is Cross Exchange Market Making?" /><published>2025-09-03T00:00:00+09:00</published><updated>2025-09-03T00:00:00+09:00</updated><id>https://minsuk-sung.github.io/blog/hummingbot-what-is-cross-exchange-market-making</id><content type="html" xml:base="https://minsuk-sung.github.io/blog/hummingbot-what-is-cross-exchange-market-making/"><![CDATA[<h1 id="교차-거래소-마켓-메이킹이란-무엇인가요">교차 거래소 마켓 메이킹이란 무엇인가요?</h1>

<p><img src="https://hummingbot.org/blog/what-is-cross-exchange-market-making/cover.webp" alt="" /></p>

<p>저희 교육 센터에 다시 오신 것을 환영합니다. 이곳에서 저희는 여러분이 마켓 메이킹, 차익거래, 그리고 알고리즘 트레이딩과 관련된 모든 것을 배우는 데 도움을 드리고자 합니다.</p>

<p>오늘은 Hummingbot으로 사용할 수 있는 핵심 전략 중 하나인 <u>교차 거래소 마켓 메이킹(cross-exchange market making)</u>에 대해 이야기하겠습니다.</p>

<p>이 글의 목표는 여러분이 다음을 이해하도록 돕는 것입니다:</p>

<ul>
  <li>교차 거래소 마켓 메이킹 전략이란 무엇인가?</li>
  <li>교차 거래소 마켓 메이킹과 차익거래의 차이점은 무엇인가?</li>
  <li>교차 거래소 마켓 메이킹은 순수 마켓 메이킹과 어떻게 다른가?</li>
  <li>왜 그리고 언제 이 전략을 사용해야 하는가?</li>
</ul>

<p>만약 여러분이 이미 차익거래와 순수 마켓 메이킹이 어떻게 작동하는지 이해하고 있다면, 교차 거래소 마켓 메이킹(“XEMM”)은 정말 간단해집니다: 이것은 단순히 두 전략의 하이브리드입니다.</p>

<p><img src="https://hummingbot.org/blog/what-is-cross-exchange-market-making/guitars.jpg" alt="" /></p>

<!-- ========================================================================================== -->
<h2 id="1️⃣-교차-거래소-마켓-메이킹이란-무엇일까요">1️⃣ 교차 거래소 마켓 메이킹이란 무엇일까요?</h2>
<!-- ========================================================================================== -->
<font color="green">교차 거래소 마켓 메이킹</font>
<p>개념에 대한 간단한 설명은 다음과 같습니다:</p>

<ol>
  <li>제 친구 앨리스는 기타를 팔고 싶어 하고 100달러에 내놓았습니다.</li>
  <li>
    <font color="green">저는 다른 모든 친구들에게 가서 제가 110달러에 기타를 팔고 있다고 말합니다.</font>
  </li>
  <li>만약 제 친구 중 한 명인 밥이 동의하면, 저는 즉시 앨리스에게서 100달러에 기타를 사서 밥에게 110달러에 팝니다.</li>
</ol>

<p>꽤 괜찮죠? 저는 제가 소유하지도 않은 물건을 연속적인 동시 매수 및 매도를 통해 10달러의 이익을 얻었습니다.</p>

<p>잠깐만요… 이건 차익거래와 매우 비슷하게 들리는데, 차이점이 뭘까요?</p>

<p>좋습니다, 이 상황이 <font color="orange">차익거래</font>라면 어떻게 될지 보여드리겠습니다:</p>

<ol>
  <li>제 친구 앨리스는 기타를 팔고 싶어 하고 100달러에 내놓았습니다.</li>
  <li>
    <font color="orange">저는 돌아다니면서 누군가가 100달러보다 높은 가격에 기타를 사겠다는 제안을 하는지 찾아봅니다. 둘러본 후, 다른 친구 캐럴이 올린 광고를 발견합니다. 그녀는 기타를 사고 싶어 하고 110달러를 지불할 의향이 있습니다.</font>
  </li>
  <li>좋습니다, 저는 즉시 앨리스에게서 100달러에 기타를 사서 캐럴에게 110달러에 팝니다.</li>
</ol>

<p>미묘한 차이를 눈치채셨나요? <font color="green">교차 거래소 마켓 메이킹의 2단계</font>에서, 저는 제가 팔 물건이 있다고 사람들에게 적극적으로 알리고 가격을 설정하는 사람이었습니다. 이 개념이 익숙하게 들리나요? 밥과의 거래에서, 저는 메이커(maker)였고 밥은 테이커(taker)였습니다.</p>

<p>반면에, <font color="orange">차익거래의 2단계</font>에서, 저는 단순히 다른 누군가가 이미 더 높은 가격에 기타를 사고 싶다고 말했는지 찾아다녔습니다. 차익거래 시나리오에서, 캐럴이 메이커였고, 제가 테이커였습니다.</p>

<p>두 시나리오에서 앨리스와의 거래에서 저는 테이커였습니다: 저는 그녀의 기타 제안과 가격을 받아들였습니다.</p>

<blockquote>
  <p>💡 차익거래자는 “테이커(Taker)/테이커(Maker)”로 행동합니다. 그는 매수와 매도 거래 모두에서 테이커입니다. 차익거래는 더 수동적인데, 왜냐하면 차익거래자는 단지 가격을 모니터링하고 행동할 기회를 찾기 때문입니다. 반면에, <u>교차 거래소 마켓 메이커는 "메이커/테이커"로 행동</u>합니다. 그는 거래의 한쪽에서 메이커 주문을 생성하여 적극적으로 거래 기회를 만들려고 합니다.</p>
</blockquote>

<!-- ========================================================================================== -->
<h2 id="2️⃣-이것이-마켓-메이킹과-무슨-관련이-있나요">2️⃣ 이것이 마켓 메이킹과 무슨 관련이 있나요?</h2>
<!-- ========================================================================================== -->
<p>저희의 이전 <a href="/_posts/2025-09-18-hummingbot-what-is-market-making.md">Pure Makret Making (PMM)</a>에 대한 글에서, 우리는 마켓 메이커가 거래를 촉진하기 위해 매수(bid)와 매도(ask) 주문을 모두 내는 사람이라고 설명했습니다. 위의 교차 거래소 마켓 메이킹 예시에서, 제가 기타를 팔겠다고 제안하고 가격을 명시하며 메이커 역할을 하는 것을 볼 수 있습니다. 이것이 마켓 메이커가 하는 일의 절반입니다.</p>

<p>하지만 저는 매수 측에서도 동일한 거래를 할 수 있습니다. 제 다른 친구 데이브는 기타를 사고 싶어 하지만, 그는 단지 95달러만 지불할 의향이 있습니다. 이 가격에서는 그와 앨리스는 거래할 수 없습니다. 왜냐하면 그의 예산 95달러는 앨리스의 요구 가격 100달러보다 낮기 때문입니다. 제가 데이브에게 기타를 팔 수 있다는 것을 알기 때문에, 앨리스의 기타를 팔려고 돌아다니는 동시에, 데이브에게 팔 수 있는 다른 기타를 사겠다고 제안하며 돌아다닐 수 있습니다.</p>

<p>이제 저는 양쪽을 다 가졌습니다: 저는 85달러에 기타를 사겠다고 제안하고 110달러에 기타를 팔 수 있습니다. 저는 이제 마켓 메이커 역할을 하고 있습니다. 여러분이 눈치챘을지도 모르는 교차 거래소 마켓 메이킹의 흥미로운 점은 다음과 같습니다:</p>

<ul>
  <li>애초에 <font color="red">저는 기타를 소유하고 있지도 않습니다.</font> 누군가 저에게서 기타를 사고 싶어 하면, 저는 그냥 앨리스의 것을 사서 그들에게 팔면 됩니다.</li>
  <li>매수 측에서 <font color="red">기타를 살 돈이 필요하지도 않습니다.</font> 누군가 저에게 85달러에 기타를 팔고 싶어 하면, 저는 그 기타를 즉시 데이브에게 팔아서 그 구매 대금을 지불할 수 있습니다!</li>
</ul>

<blockquote>
  <p>💡 교차 거래소 마켓 메이킹에서, 트레이더는 한 거래소(“메이커 거래소”)에서 일반적인 마켓 메이커 역할을 하며 매수 및 매도 주문을 생성합니다. 그러나 트레이더는 다른 거래소(“테이커 거래소”)를 사용하여 메이커 거래소에서 체결된 모든 거래를 동시에 상쇄(또는 “헤지”)함으로써 일반적으로 마켓 메이킹과 관련된 <u>재고 위험을 제거</u>합니다.</p>
</blockquote>

<p>이것이 우리가 앞서 교차 거래소 마켓 메이킹이 순수 마켓 메이킹 + 차익거래의 조합처럼 보인다고 언급한 이유입니다.</p>

<!-- ========================================================================================== -->
<h2 id="3️⃣-그렇다면-이것이-오더북-시장에서는-어떻게-적용될까요">3️⃣ 그렇다면 이것이 오더북 시장에서는 어떻게 적용될까요?</h2>
<!-- ========================================================================================== -->
<p>동일한 자산이 다른 시장에서 거래되는 금융 환경은 소위 시장 비효율성에 취약하며, 여기서 자산의 가치에 대한 정보가 모든 거래소에 퍼지는 데 시간이 걸립니다.</p>

<p>이것은 특정 시점에 두 다른 거래소의 BTC/USDT 오더북 스크린샷에서 볼 수 있듯이, 각 오더북에서 제공되는 매수 및 매도 가격의 차이를 보면 쉽게 알 수 있습니다:</p>

<p><img src="https://hummingbot.org/blog/what-is-cross-exchange-market-making/image2.png" alt="" /></p>

<p>매수 가격:</p>
<ul>
  <li>
    <font color="orange">거래소 A</font>
    <p>: <font color="pink">$10,475.97</font></p>
  </li>
  <li>
    <font color="green">거래소 B</font>
    <p>: <font color="red">$10,476.40</font></p>
  </li>
</ul>

<p>매도 가격</p>
<ul>
  <li>
    <font color="orange">거래소 A</font>
    <p>: <font color="skyblue">$10,475.98</font></p>
  </li>
  <li>
    <font color="green">거래소 B</font>
    <p>: <font color="blue">$10,476.60</font></p>
  </li>
</ul>

<p>위 상황에 교차 거래소 마켓 메이킹 개념을 적용하면 다음과 같습니다:
(역주: 위 상황을 조금 더 이해하기 쉽게 그림으로 표현하면 아래와 같습니다.)</p>

<ol>
  <li>저는 한 거래소(거래소 A)를 저의 <font color="orange">테이커 거래소</font>로 사용합니다. 위 예시에서 앨리스와 데이브가 집합적으로 저의 “테이커 거래소” 역할을 했습니다. 기본적으로, 다른 사람들이 만든 매수 및 매도 주문이 있는 거래소가 하나 필요합니다. 위 상황을 사용하면, 거래소 A에서 토큰 A에 대한 최적 매수 가격은 현재 <font color="pink">$10,475.97</font>이고 최적 매도 가격은 <font color="skyblue">$10,475.98</font>입니다. (역주: 본문 내용상 매수 가격이 $10,475.97, 매도 가격이 $10,475.98이 맞습니다.)</li>
</ol>

<p><img src="/assets/images/2025-09-20/example.png" alt="" /></p>

<ol>
  <li>다른 거래소(거래소 B)에서, 저는 <font color="green">메이커 역할</font>을 하며 주문을 생성합니다. 제가 거래소 A에서 시장가 테이커로 $10,475.97에 팔고 $10,475.98에 살 수 있다는 것을 알기 때문에, 저는 <u>거래소 B에 BTC에 대해 $10,474.97에 매수 주문을, $10,476.98에 매도 주문</u>을 냅니다.</li>
</ol>

<p><img src="/assets/images/2025-09-20/example2.png" alt="" /></p>

<ol>
  <li>만약 거래소 B에서의 제 매수 주문이 체결되면, 저는 즉시 거래소 A에서 토큰 A를 팔아 $1.00의 이익을 얻습니다. 만약 거래소 B에서의 제 매도 주문이 체결되면, 저는 즉시 거래소 A에서 BTC를 사서 $1.00의 이익을 얻습니다.</li>
</ol>

<p><img src="/assets/images/2025-09-20/example3.png" alt="" /></p>

<p>제가 여기서 설정한 유일한 조건은 저의 이윤 $1이라는 것을 볼 수 있습니다. 제가 거래소 B에 내는 주문의 가격은 항상 거래소 A에서 제공되는 시장 가격을 기반으로 합니다.</p>

<p>예를 들어, 거래소 A의 매도 호가가 $10,400.00으로 떨어지면, 저는 거래소 B에서의 제 매도 호가 제안을 $10,401.00 (= $10,400.00 + $1)으로 조정할 것입니다:</p>

<p>(거래소 B 메이커 가격) = (거래소 A 테이커 가격) + (이윤)
$1이 현실적인 이윤이 아닐 수도 있다는 점에 유의하세요. 더 가능성 있는 이윤은 낮은 백분율이나 심지어 백분율의 일부일 것입니다. 하지만 더 낮은 이윤에서도, 왜 이 전략이 작동할까요?</p>

<blockquote>
  <p>💡 차익거래와 마찬가지로, 교차 거래소 마켓 메이킹 전략을 통해 “무위험” 이익을 창출할 수 있는 잠재력은 시장 비효율성 때문에 발생합니다. 암호화폐 시장의 매우 파편화된 특성(CEX/DEX와 같은 다른 유형, 다른 지역/관할권, 수많은 다른 거래소)은 훨씬 더 많은 시장 비효율성을 야기합니다.</p>
</blockquote>

<!-- ========================================================================================== -->
<h2 id="4️⃣-거래소-a의-가격이-더-좋은데-왜-누군가-거래소-b에서-거래할까요-다시-말해-무엇이-교차-거래소-마켓-메이킹을-가능하게-할까요">4️⃣ 거래소 A의 가격이 더 좋은데 왜 누군가 거래소 B에서 거래할까요? 다시 말해, 무엇이 교차 거래소 마켓 메이킹을 가능하게 할까요?</h2>
<!-- ========================================================================================== -->
<p>몇 가지 예는 다음과 같습니다:</p>

<ul>
  <li>어떤 사람들은 거래소 A에 계좌를 개설할 수 없거나 개설하고 싶지 않을 수 있습니다(시장 단편화): 예를 들어, 거래소 A는 KYC를 요구하는 중앙화 거래소일 수 있고, 거래소 B는 DEX일 수 있습니다. 거래소 B의 사용자들은 더 나쁜 가격을 받고 있다는 것을 알 수도 있지만, 단지 거래소 A에 계좌를 설정하는 번거로움을 겪고 싶지 않을 뿐입니다.</li>
  <li>거래소 B는 거래소 A만큼 빨리 정보를 얻지 못합니다: 암호화폐 시장은 매우 빠르게 움직일 수 있으며, 항상 모든 거래소에 동시에 도달하지는 않습니다. 거래소 A에서는 가격이 움직였지만 거래소 B의 트레이더들은 아직 그것을 모를 수 있습니다. 예를 들어, 거래소 B가 온체인 오더북을 가진 DEX인 경우입니다. 블록체인 트랜잭션을 통해 오더북을 업데이트하면 지연이 발생할 수 있습니다.</li>
</ul>

<!-- ========================================================================================== -->
<h2 id="5️⃣-실질적인-고려사항-금융-시장에-교차-거래소-마켓-메이킹-전략-배포하기">5️⃣ 실질적인 고려사항: 금융 시장에 교차 거래소 마켓 메이킹 전략 배포하기</h2>
<!-- ========================================================================================== -->
<p>이제 교차 거래소 마켓 메이킹의 기본 개념을 이해했으니, 이 전략을 실제 세계에 배포할 때의 실질적인 의미를 고려해 보겠습니다. 이 글의 시작 부분의 예시는 다음을 가정합니다:</p>

<ul>
  <li>제가 기타나 토큰 A를 사람들 사이나 거래소 간에 즉시 쉽게 이동시킬 수 있고,</li>
  <li>제가 아직 물건을 가지고 있지 않아도 주문을 낼 수 있습니다 (즉, 아직 모르는 기타를 팔겠다고 제안하거나, 돈이 없어도 기타를 사겠다고 제안할 수 있습니다).</li>
</ul>

<p>그러나 금융 시장에서는 거래소 간 자산 이동에 시간이 걸리고(예: 암호화폐의 경우 특정 수의 블록 확인 필요), 주문을 내기 위해서는 거래소에 자산이 있어야 합니다(적어도 현재 현물 시장에서는).</p>

<p>“무위험” 차익거래 기회를 포착하는 것은 매우 경쟁이 치열하므로, 이러한 기회는 드물고 일반적으로 매우 짧은 시간 동안만 존재합니다. 우리가 기회를 식별하고, 한 거래소에서 거래하고, 다른 거래소로 자산을 이전한 다음, 거래의 두 번째 부분(“헤지”)을 수행할 때쯤에는, 기회가 이미 사라졌을 가능성이 매우 높습니다. 그렇다면 이 문제를 어떻게 해결할까요?</p>

<!-- ========================================================================================== -->
<h2 id="6️⃣-재고-균형-모델-inventory-equilibrium-model">6️⃣  재고 균형 모델 (Inventory equilibrium model)</h2>
<!-- ========================================================================================== -->
<p>이러한 운영 비효율성을 해결하는 한 가지 방법은 <font color="red">두 거래소에 재고를 유지하는 것</font>입니다.</p>

<p>이것은 교차 거래소 마켓 메이킹 전략의 목표 중 하나가 재고 위험에 대한 노출을 피하는 것이기 때문에 위 예시에서 설명된 것과 모순적으로 들릴 수 있지만, 더 설명해 드리겠습니다.</p>

<p><img src="https://hummingbot.org/blog/what-is-cross-exchange-market-making/image3.png" alt="" /></p>

<p>위 그림은 마켓 메이커가 운영을 시작하는 순간의 계정 상태를 보여줍니다. 보시다시피, 그는 총 20 단위의 토큰 A 재고를 두 거래소에 나누어 시작합니다.</p>

<p>이를 통해 트레이더는 거래소 B 오더북에 포지션을 생성하고, 최소 이익을 1%로 고정할 수 있습니다 (101 * 1.01 = 102.01).</p>

<blockquote>
  <p>💡 알림: 만약 거래소 A의 최적 매도 호가가 변경되면, 마켓 메이커는 1%의 이익을 보장하기 위해 거래소 B의 매도 호가 제안 가격을 변경할 것입니다. 만약 거래소 A에서 가격이 105로 오르면, 그는 거래소 B의 매도 호가를 106으로 변경할 것입니다.</p>
</blockquote>

<p>이제, 그의 매도 제안이 다른 구매자에 의해 체결되는 순간에 어떤 일이 일어나는지 보겠습니다:</p>

<p><img src="https://hummingbot.org/blog/what-is-cross-exchange-market-making/image4.png" alt="" /></p>

<p>그의 메이커 주문이 거래소 B에서 체결되는 바로 그 순간, 그는 거래소 A의 최적 매도 호가를 테이커가 될 것입니다. 위 그림에서 볼 수 있듯이, 두 거래소의 총 토큰 A 양은 여전히 동일하지만(20), 그의 총 USD 잔액은 $1 증가했습니다.</p>

<!-- ========================================================================================== -->
<h2 id="7️⃣리밸런싱-rebalancing">7️⃣ 리밸런싱 (Rebalancing)</h2>
<!-- ========================================================================================== -->
<p>교차 거래소 마켓 메이커는 때때로 거래소 간 자산을 재조정(리밸런싱)해야 할 수도 있습니다. 위 예시에서, 만약 시장이 계속 같은 방향으로 거래되고 이 거래가 9번 더 발생한다면, 마켓 메이커는 결국 거래소 A에는 토큰만, 거래소 B에는 USD만 가지게 될 것입니다. 이러한 경우, 트레이더는 전략을 계속 실행하기 위해 일부 토큰을 거래소 A에서 거래소 B로, 일부 USD를 거래소 B에서 거래소 A로 이전해야 합니다.</p>

<!-- ========================================================================================== -->
<h2 id="8️⃣-거래-및-자산-이전-수수료">8️⃣ 거래 및 자산 이전 수수료</h2>
<!-- ========================================================================================== -->
<p>교차 거래소 마켓 메이커는 거래에 대한 목표 이윤을 설정할 때 거래 및 자산 이전 수수료를 고려해야 합니다.</p>

<!-- ========================================================================================== -->
<h2 id="9️⃣-교차-거래소-마켓-메이킹의-위험">9️⃣ 교차 거래소 마켓 메이킹의 위험</h2>
<!-- ========================================================================================== -->
<blockquote>
  <p>⚠️차익거래와 교차 거래소 마켓 메이킹은 종종 “무위험”으로 간주되고 설명되는데, 이는 이들 전략이 마켓 메이킹과 관련된 주요 위험인 재고 위험(inventory risk)을 크게 완화하기 때문입니다. 남아있는 주요 위험은 실행 위험(execution risk)입니다.</p>
</blockquote>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="실행-위험-execution-risk">실행 위험 (Execution risk)</h3>
<!-- ------------------------------------------------------------------------------------------ -->

<p>시장은 매우 빠르게 움직입니다. 차익거래 작업에서 일어나는 것과 마찬가지로, 트레이더는 거래 주문 실행의 속도와 신뢰성을 고려해야 합니다. 위 예시에서, 그의 거래가 거래소 B에서 체결되자마자, 그는 다른 누군가가 그 주문을 가져가기 전이나 그 마켓 메이커가 가격을 조정하기 전에 즉시 거래소 A에서 상쇄 거래를 수행해야 합니다.</p>

<p>따라서 실행 위험은 트레이더 터미널과 거래소 간의 연결이 얼마나 빠르고 신뢰할 수 있는지에 달려 있습니다.</p>

<p>이 위험은 더 나은 인프라(예: 신뢰할 수 있는 연결을 가진 클라우드) 사용, 트레이딩 봇 신뢰성 보장을 위한 많은 테스트, 그리고 신뢰할 수 있는 거래소 선택을 통해 완화될 수 있습니다.</p>

<!-- ------------------------------------------------------------------------------------------ -->
<h3 id="시장변동성-위험-순수-마켓-메이킹에-비해-제한적">시장/변동성 위험: 순수 마켓 메이킹에 비해 제한적</h3>
<!-- ------------------------------------------------------------------------------------------ -->

<p>위에서 설명했듯이, 거래 기회에 대응하기 위해 거래소에 자산을 보유하기 위해 재고 균형 모델을 배포해야 합니다. 이는 교차 거래소 마켓 메이커가 어느 정도의 재고를 보유해야 하므로 어느 정도의 시장 위험을 야기합니다.</p>

<p>그러나 교차 거래소 마켓 메이킹이 순수 마켓 메이킹 전략과 다른 주요 차이점은 재고 노출이 시간이 지나도 일정하게 유지된다는 것입니다. 위 예시에서 마켓 메이커는 일정한 양의 토큰 A 잔액(20 토큰)을 유지하지만, 이 잔액을 마켓 메이커의 USD 잔액을 늘리기 위한 도구로 사용합니다.</p>

<blockquote>
  <p>💡 실제 세계에서 교차 거래소 마켓 메이킹 전략을 배포하려면 일정량의 고정된 재고가 필요하므로, 이는 마켓 메이커를 어느 정도의 시장 위험에 노출시킵니다. 그러나 재고량이 고정되고 유한하기 때문에, 교차 거래소 마켓 메이킹은 매수 후 보유(buy-and-hold) 전략과 유사한 위험 프로필을 가집니다. 하지만 매수 후 보유와 달리, 이 재고는 위험 프로필의 근본적인 변화 없이 점진적이고 부가적인 수익을 창출하기 위해 배포됩니다.</p>
</blockquote>

<p>이는 교차 거래소 마켓 메이커가 큰 재고량 변동을 피하기 때문에 순수 마켓 메이킹에 비해 위험을 실질적으로 낮춥니다.</p>

<blockquote>
  <p>🐦Hummingbot에서 교차 거래소 마켓 메이킹 전략을 생성하려면, <code class="language-plaintext highlighter-rouge">create</code> 명령어 다음에 <code class="language-plaintext highlighter-rouge">cross_exchange_market_making</code>을 사용하세요.</p>
</blockquote>

<!-- ========================================================================================== -->
<h2 id="-유동성-미러링-교차-거래소-마켓-메이킹의-또-다른-적용">🔟 유동성 미러링: 교차 거래소 마켓 메이킹의 또 다른 적용</h2>
<!-- ========================================================================================== -->
<p>위에서 언급했듯이, 암호화폐 시장에는 많은 단편화가 있으며, 이는 유동성의 큰 격차로 이어졌습니다. 예를 들어, 일부 거래소는 훨씬 더 활동적이고 유동성이 높을 수 있는 반면(예: 중앙화 또는 확립된, 널리 사용되는 거래소), 다른 거래소는 그렇지 않을 수 있습니다(예: 탈중앙화 거래소 또는 새로 생성된 거래소).</p>

<p>예를 들어, 바이낸스 DEX에서 가장 많이 거래되는 토큰인 트라발라(AVA)를 살펴보고, 코인게코에 표시된 대로 중앙화된 바이낸스닷컴과 그 매수-매도 시장 스프레드를 비교해 보겠습니다:</p>

<p><img src="https://hummingbot.org/blog/what-is-cross-exchange-market-making/image5.png" alt="" /></p>

<p>바이낸스 DEX는 바이낸스닷컴보다 유동성과 거래량이 적으며, 이는 바이낸스 DEX의 매수-매도 스프레드가 바이낸스닷컴의 거의 5배에 달하는 것으로 나타납니다.</p>

<p>교차 거래소 마켓 메이커는 이 상황을 이용하여, 자신의 메이커 스프레드를 지배적인 매수-매도 시장 스프레드보다 낮게 설정하여 바이낸스 DEX에 호가를 게시할 수 있습니다. 이렇게 하면 그의 주문이 좋은 위치에 놓이고 다른 참여자들에게 가장 먼저 체결될 수 있습니다.</p>

<p>예를 들어, 마켓 메이커가 자신의 매수-매도 스프레드를 4%로 설정했다고 가정해 봅시다:</p>

<ul>
  <li>바이낸스 DEX 메이커 매도 스프레드 = 2%</li>
  <li>바이낸스 CEX 시장 매도 스프레드 = 0.6%</li>
</ul>

<p>만약 다른 참여자가 바이낸스 DEX에서 마켓 메이커의 매도 호가를 받아들인다면(자산을 판다면), 그는 같은 순간에 바이낸스 CEX에서 제공되는 최적 매도 주문을 받아들여(더 낮은 가격에 자산을 다시 사서), 즉시 (2%-0.6%) = 1.4%의 이익을 확정할 것입니다.</p>

<blockquote>
  <p>💡 이 전략은 또한 유동성이 더 높은 거래소에서 유동성을 ‘이전’하여(주문을 체결하여 유동성 제거) 유동성이 낮은 거래소로 옮기고(주문을 생성하여 유동성 증가) 스프레드를 줄이는 효과도 있습니다. 교차 거래소 마켓 메이킹은 “유동성 미러링” 또는 “유동성 포팅”으로도 알려져 있습니다.</p>
</blockquote>

<!-- ========================================================================================== -->
<h2 id="-전략-비교">✅ 전략 비교</h2>
<!-- ========================================================================================== -->
<p>오늘의 글로, 우리는 Hummingbot으로 구현할 수 있는 세 가지 전략(순수 마켓 메이킹, 차익거래, 교차 거래소 마켓 메이킹)을 모두 제시했으며, 각각은 고유한 특성, 장점, 단점을 가지고 있습니다.</p>

<p>다음은 이들 전략 간의 비교입니다:</p>

<table>
  <thead>
    <tr>
      <th>구분</th>
      <th>순수 마켓메이킹</th>
      <th>차익거래</th>
      <th>교차거래</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><strong>필요 거래소 수</strong></td>
      <td>1</td>
      <td>2</td>
      <td>2 (메이커 + 테이커)</td>
    </tr>
    <tr>
      <td><strong>주문 유형</strong></td>
      <td>메이커</td>
      <td>테이커</td>
      <td>메이커 + 테이커</td>
    </tr>
    <tr>
      <td><strong>수익성 기준</strong></td>
      <td>사용자 정의 스프레드</td>
      <td>거래소 간 가격 차이</td>
      <td>테이커 거래소 + 사용자 정의 수익성</td>
    </tr>
    <tr>
      <td><strong>시장 중립 전략 여부</strong></td>
      <td>✅</td>
      <td>✅</td>
      <td>✅</td>
    </tr>
    <tr>
      <td><strong>인벤토리(재고) 리스크</strong></td>
      <td>✅</td>
      <td>❌</td>
      <td>❌</td>
    </tr>
    <tr>
      <td><strong>시장 방향성 리스크</strong></td>
      <td>✅</td>
      <td>❌</td>
      <td>❌</td>
    </tr>
    <tr>
      <td><strong>체결 리스크</strong></td>
      <td>❌</td>
      <td>✅</td>
      <td>✅</td>
    </tr>
    <tr>
      <td><strong>유동성 채굴 활용 가능 여부</strong></td>
      <td>✅</td>
      <td>❌</td>
      <td>✅</td>
    </tr>
  </tbody>
</table>

<p>Hummingbot 아카데미에서는 각 전략의 세부 사항과 내부 작동 원리를 다루어 여러분의 트레이딩 계획에 더 잘 맞는 전략을 찾고 만드는 데 도움을 줄 더 많은 콘텐츠가 계획되어 있으니, 매주 업데이트되는 저희 블로그를 꼭 확인해 주세요.</p>

<!-- ========================================================================================== -->
<h2 id="-저희-커뮤니티에-참여하세요">✅ 저희 커뮤니티에 참여하세요</h2>
<!-- ========================================================================================== -->
<p>더 배우고 싶다면, 매주 새로운 글이 올라오는 저희 블로그 업데이트를 꼭 팔로우하세요.</p>

<p>다음 글을 기다리는 동안, 저희 디스코드 서버에 참여하는 것을 잊지 마세요. 이곳은 우리 커뮤니티가 마켓 메이킹과 차익거래, 그리고 Hummingbot을 사용하여 트레이딩 전략을 개선할 수 있는 모든 가능한 방법에 대해 이야기하는 곳입니다.</p>

<p>또한, Hummingbot 아카데미에서 다루었으면 하는 특정 주제가 있다면, 디스코드에서 저희 팀에 연락하거나 academy@hummingbot.io로 이메일을 보내주세요.</p>

<p>곧 뵙겠습니다. 모두 수익성 있는 트레이딩 세션이 되시기를 바랍니다!</p>

<details>
<summary><a href="https://hummingbot.org/blog/what-is-cross-exchange-market-making/">Show original (English)</a></summary>

![](https://hummingbot.org/blog/what-is-cross-exchange-market-making/cover.webp)

Welcome back to our Educational Center, where we aim to help you to learn more about market making, arbitrage, and everything related to algorithmic trading.

Today we will talk about one of the core strategies that can be used with hummingbot: cross-exchange market making.

The objective of this article is to help you understand:

- What is the cross-exchange market making strategy?
- What is the difference between cross-exchange market making and arbitrage?
- How is cross-exchange market making different from pure market making?
- Why and when should I use this strategy?

If you already understand how arbitrage and pure market making work, cross-exchange market making ("XEMM") becomes really simple: it's simply a hybrid of the two.

![](https://hummingbot.org/blog/what-is-cross-exchange-market-making/guitars.jpg)

<!-- ========================================================================================== -->
## ✅ So what is cross-exchange market making?
<!-- ========================================================================================== -->
Here's a simple explanation of the concept of cross-exchange market making:

1. My friend Alice wants to sell her guitar and she's offering it for $100.
2. I go around to all of my other friends and tell them that I am selling a guitar for $110
3. If one of my friends, say Bob, agrees, I immediately buy the guitar from Alice for $100 and sell it to Bob for $110.

Pretty neat right? I made $10 of profit selling something I didn't own by simply doing a back-to-back, simultaneous buy and sell of the guitar.

Wait... that sounds a lot like arbitrage, so what's the difference?

OK, here's how this situation would be for arbitrage:

1. My friend Alice wants to sell her guitar and she's offering it for $100.
2. I go around and try to find if someone, anyone, is offering to buy a guitar for some price higher than $100. After looking around, I find an ad posted by my other friend Carol; she wants to buy a guitar and is willing to pay $110.
3. Great, I immediately buy the guitar from Alice for $100 and sell it Carol for $110.

Did you notice the subtle difference? For step #2 in cross-exchange market making, I was the one proactively telling people I had something to sell and I was setting my price. Does this concept sound familiar? In the transaction with Bob, I was the maker and Bob was the taker.

On the other hand, for step #2 in arbitrage, I was simply going around and searching to find if someone else had already said they wanted to buy a guitar at a higher price. In the arbitrage scenario, Carol was the maker, and I was the taker.

In my transaction with Alice in both scenarios, I was a taker: I accepted her offer for a guitar and her price.

&gt; 💡 An arbitrageur acts as "taker/taker"; he is the taker on the buy and the sell transaction. Arbitrage is more passive because an arbitrageur just monitors prices and searches for opportunities to act on. On the other hand, a cross-exchange market maker acts as "maker/taker"; he proactively tries to create trade opportunities by creating maker orders on one side of the trade.

## What does this have to do with market making?

In our previous article on [pure market making](/_posts/2025-09-18-hummingbot-what-is-market-making.md), we explained that a market maker is someone who places both bid and ask orders in order to facilitate trading. You can see that in the cross-exchange market making example above, I am acting as a maker, offering a guitar to sell and specifying a price. So that's one half of what a market maker does.

But I can also do the same transaction for the buy side. I have another friend, Dave, who wants to buy a guitar, but he is only willing to pay $95. At this price, he and Alice can't trade, because his budget of $95 is below Alice's asking price of $100. Since I know that I can sell a guitar to Dave, at the same time I'm going around trying to sell Alice's guitar, I can go around offering to buy another guitar that I can sell to Dave.

Now I have both sides: I can offer to buy a guitar for $85 and sell a guitar for $110. I am now acting as a market maker. The interesting thing about cross-exchange market making that you may have noticed is:

- I don't even own a guitar in the first place; if someone wants to buy a guitar from me, I just buy the one from Alice to sell them and,
- I don't even need to have the money to buy a guitar on the buy side; if someone wants to sell me a guitar for $85, I can pay for that purchase by selling that same guitar immediately to Dave!

&gt; 💡 In cross-exchange market making, a trader acts as a normal market maker on one exchange (the "maker exchange"), creating buy and sell orders. However, the trader eliminates the inventory risk usually associated with market making by using another exchange (the "taker exchange") to simultaneously offset (or "hedge") any trades filled on the maker exchange.

That is why we mentioned earlier that cross-exchange market making kind of looks like a combination of pure market making + arbitrage.

<!-- ========================================================================================== -->
## ✅ So how does this translate to order book markets?
<!-- ========================================================================================== -->
A financial environment where the same asset is traded in different marketplaces is susceptible to what is known as market inefficiency, where the information about the value of the asset takes some time to dissipate to all the exchanges.

This can be easily noticed by looking at the differences between bid and ask prices offered on each order book, as can be seen on the screenshot of the BTC/USDT order book on two different exchanges at the moment in time:

![](https://hummingbot.org/blog/what-is-cross-exchange-market-making/image2.png)

Bid prices:
- Exchange A: $10,475.97
- Exchange B: $10,476.40

Ask Prices
- Exchange A: $10,475.98
- Exchange B: $10,476.60

Applying the cross-exchange market making concept on the situation above:

1. I use one exchange (Exchange A) as my taker exchange. In the example above, Alice and Dave, collectively, acted as my "taker exchange". Basically, I need one exchange where there are buy and sell orders created by other people. Using the above situation, the best bid price on Exchange A for Token A is currently $10,475.98 and the best sell price is $10,475.98.
2. On another exchange (Exchange B), I act as maker and create orders. Since I know that I can sell as a market taker for $10,475.97 and buy for $10,475.98 on Exchange A, I place a buy order for BTC for $10,474,97 and sell order for $10,476.98 on Exchange B.
3. If my buy order on Exchange B is filled, then I immediately sell Token A on Exchange A for a $1.00 profit. If my sell order on Exchange B is filled, then I immediately buy BTC on Exchange A for a $1.00 profit.

You can see that the only term I set here is my profit margin of $1. The price of the order I place on Exchange B will always be based on the market price offered on Exchange A.

For example, if the ask price on Exchange A falls to $10,400.00, then I would adjust my price ask offer on Exchange B to $10,401.00 (= $10,400.00 + $1):

(Exchange B maker price) = (Exchange A taker price) + (profit margin)¶
Notice that $1 may not be a realistic margin; more likely margins would be more in the low percentages or even fractions of percentages. But even at lower margins, why would this strategy work?

&gt; 💡 As with arbitrage, the potential to generate "risk-free" profits through cross-exchange market making strategies happens due to market inefficiencies. The highly fragmented nature of the crypto markets (different types such as CEX/DEX, different regions/jurisdictions, the sheer number of different exchanges) lends itself to even more market inefficiencies.

<!-- ========================================================================================== -->
## ✅ Why would anyone trade on Exchange B if the prices on Exchange A are better? In other words, what makes cross-exchange market making possible?
<!-- ========================================================================================== -->
Here are some examples:

- Some people may not be able to open an account or don't want to open an account on Exchange A (market fragmentation): for example, Exchange A might be a centralized exchange requiring KYC, while Exchange B is a DEX. Users of Exchange B may even know that they are getting worse pricing, but they just don't want to go through the hassle of setting up an account on Exchange A
- Exchange B doesn't get information as quickly as Exchange A: the crypto markets can move awfully quickly, and it doesn't always reach every exchange at the same time. Prices may have moved on Exchange A but traders on Exchange B don't yet know about it. As an example, exchange B is a DEX with on-chain order books. Updating order books through blockchain transactions may result in lag.

<!-- ========================================================================================== -->
## ✅ Practical considerations: deploying cross-exchange market making strategy in the financial markets
<!-- ========================================================================================== -->
Now that you understand the fundamental concept of cross-exchange marketing making, we now consider the practical implications of deploying this strategy in the real-world. The example at the beginning of this article assumes that:

- I can easily move the guitar or Token A between people or exchanges instantaneously and,
- I can place orders for something even if I didn't yet have the item (i.e., I can offer to sell a guitar I didn't know yet, or I could offer to buy a guitar even though I didn't have the money).

However, in financial markets, moving assets between exchanges take time (e.g. requiring a certain number of block confirmations in the case of cryptocurrencies) and you need to have assets on the exchange in order to place orders (at least currently, in the spot market).

Capturing "risk-free" arbitrage opportunities is highly competitive, so these opportunities may be few and far between and are typically very short-lived. By the time we identified an opportunity, transacted on one exchange, transferred assets to another exchange, and then did the second part of the trade (the "hedge"), it's highly likely the opportunity may have already disappeared. So how do we solve this?

<!-- ========================================================================================== -->
## ✅  Inventory equilibrium model
<!-- ========================================================================================== -->
One way to address this operational inefficiency is to maintain an inventory on both exchanges.

This might sound contradictory to what was explained in the above examples since one of the goals of the cross-exchange market making strategy is to avoid exposure to inventory risk, but let me explain it further.

![](https://hummingbot.org/blog/what-is-cross-exchange-market-making/image3.png)

The figure above shows the state of the market maker's account at the moment he starts the operation. As you can see, he begins with a total inventory of 20 units of the Token A, split across two exchanges.

This will allow the trader to create a position on the Exchange B order book, locking his minimum profit at 1% (101 * 1.01 = 102.01).

&gt; 💡 Reminder: If the Best Offer price on Exchange A changes, the market maker will change his Ask Offer price on Exchange B, to guarantee the 1% profit. If on Exchange A the price rises to 105, he would change his Ask price on Exchange B to 106.

Now, let's see what happens the moment his sell offer is taken by another buyer:

![](https://hummingbot.org/blog/what-is-cross-exchange-market-making/image4.png)

At the exact moment his maker order is filled on the Exchange B, he will become a taker of the Best Offer on Exchange A. As you can see in the figure above, the total amount of Token A on both exchanges is still the same (20), while his total USD balance has increased by $1.

<!-- ========================================================================================== -->
## ✅  Rebalancing
<!-- ========================================================================================== -->
A cross-exchange market maker from time to time may also need to rebalance his assets between exchanges. In the example above, if the market keeps trading in this same direction and the trade occurs 9 more times, the market maker would end up having only tokens on Exchange A and only USD on exchange B. In such a case, the trader would have to transfer some tokens from Exchange A to Exchange B, and some USD from Exchange B to Exchange A in order to continue running the strategy.

<!-- ========================================================================================== -->
## ✅ Trading and asset transfer fees
<!-- ========================================================================================== -->
A cross-exchange market maker needs to account for trading and asset transfer fees when setting his target profit margin for trades.

<!-- ========================================================================================== -->
## ✅ Risks of cross-exchange market making
<!-- ========================================================================================== -->

&gt; ⚠️Arbitrage and cross-exchange market making are often considered and described as "risk-free" because these strategies largely mitigate the main risk associated with market making: inventory risk. The main risk that remains is execution risk.

### Execution risk

The markets move pretty fast. As with what happens on arbitrage operations, the trader has to consider the speed and reliability of executing his trade orders. In the example above, as soon as his trade is filled and Exchange B, he needs to immediately perform the offsetting trade on Exchange A before someone else takes that order or before that market maker adjusts his or her price.

Therefore, the execution risk lies on how fast and how reliable is the connection between the trader terminal and the exchanges.

This risk can be mitigated by using better infrastructure (e.g. cloud with reliable connections), lots of testing to ensure trading bot reliability, and choosing reliable exchanges.

### Market/volatility risk: although limited as compared to pure market making.

As explained above, we need to deploy an inventory equilibrium model in order to have assets available on exchanges in order to take action on trading opportunities. This introduces some amount of market risk because a cross-exchange market maker does have to have some amount of inventory.

However, the main difference in cross-exchange market making, vs. pure market making strategy, is that the inventory exposure will stay constant over time. In the example above, the market maker keeps a constant amount of Token A balance (20 tokens) but uses this balance as a tool to try to grow the market maker's USD balance.

&gt; 💡 Because deploying a cross-exchange market making strategy in the real-world requires some fixed amount of inventory, it does expose the market maker to some amount of market risk. However, since the inventory amount is fixed and finite, cross-exchange market making has a similar risk profile as a buy-and-hold strategy; but unlike buy-and-hold, the inventory is deployed to try to generate incremental, additive returns without a fundamental change in risk profile.

This materially lowers the risk as compared to pure market making, because a cross-exchange market maker is avoiding large swings in inventory amounts.

&gt; 🐦To create a cross-exchange market making strategy on hummingbot, use the command create followed by cross_exchange_market_making.

<!-- ========================================================================================== -->
## ✅ Liquidity mirroring: another application of cross-exchange market making
<!-- ========================================================================================== -->
As mentioned above, there is a lot of fragmentation in the cryptocurrency markets, which has led to large disparities in liquidity. For example, some exchanges may be much more active and liquid (such as centralized or established, widely-used exchanges) versus others (such as decentralized exchanges, or newly created exchanges).

Let's take a look, for example, at Travala (AVA) the most traded token on Binance DEX, and compare its bid-ask market spread with the centralized Binance.com, as shown on Coingecko:

![](https://hummingbot.org/blog/what-is-cross-exchange-market-making/image5.png)

Binance DEX has less liquidity and lower trade volume than Binance.com which is reflected in a bid-ask spread on Binance DEX that is nearly 5x that on Binance.com.

A cross-exchange market maker could take advantage of this situation by posting offers on Binance DEX with his maker spread lower than the prevailing bid-ask market spread. This would put his orders in a good position and first in line to be taken by other participants.

For example, let's say the market maker set his bid-ask spread at 4%:

- Binance DEX maker ask spread = 2%
- Binance CEX market ask spread = 0.6%

If another participant takes the market maker ask offer on Binance DEX (selling the asset), he will, at the same moment, take the best ask order offered on Binance CEX (re-buying the asset at a lower price), locking an instant profit of (2%-0.6%) = 1.4%

&gt; 💡 This strategy also has the effect of 'transferring liquidity' from a more liquid exchange (remove liquidity by taking orders) to a less liquid exchange (increasing liquidity by making orders) and reduce spreads. Cross-exchange market making is also known as "liquidity mirroring" or "liquidity porting".

<!-- ========================================================================================== -->
## ✅ Comparing strategies
<!-- ========================================================================================== -->
With today's article, we presented all three strategies that can be implemented with Hummingbot (pure_market_making, arbitrage, cross_exchange_market_making), and each one has its own characteristics, advantages, and disadvantages.

Here is a comparison between these strategies:

![](https://hummingbot.org/blog/what-is-cross-exchange-market-making/image6.png)

There is still a lot more content planned for the Hummingbot Academy that will cover the details and inner workings of each one, helping you find and create a strategy that fits better with your trading plans, so make sure to check our blog for updates every week.

<!-- ========================================================================================== -->
## ✅ Join our community
<!-- ========================================================================================== -->
If you want to learn more, make sure to follow our blog updates for new articles every week.

While you wait for the next post, remember to join our Discord server, a place where our community talks about market making and arbitrage, and all the possible ways you can use Hummingbot to improve your trading strategies.

Also, if there is any specific topic you want us to cover on the Hummingbot Academy, contact our team on Discord, or send an email to academy@hummingbot.io.

See you soon, and I wish you all a profitable trading session!

</details>

<h1 id="참고자료">참고자료</h1>
<ul>
  <li>https://github.com/hummingbot/hummingbot</li>
  <li>https://hummingbot.org/blog/what-is-cross-exchange-market-making</li>
</ul>]]></content><author><name>성민석</name><email>minsuksung@korea.ac.kr</email></author><category term="blog" /><category term="hummingbot" /><category term="market-making" /><category term="algorithm-trading" /><summary type="html"><![CDATA[교차 거래소 마켓 메이킹이란 무엇인가요?]]></summary></entry><entry><title type="html">What is Arbitrage?</title><link href="https://minsuk-sung.github.io/blog/hummingbot-what-is-arbitrage/" rel="alternate" type="text/html" title="What is Arbitrage?" /><published>2025-09-02T00:00:00+09:00</published><updated>2025-09-02T00:00:00+09:00</updated><id>https://minsuk-sung.github.io/blog/hummingbot-what-is-arbitrage</id><content type="html" xml:base="https://minsuk-sung.github.io/blog/hummingbot-what-is-arbitrage/"><![CDATA[<h1 id="차익거래란-무엇인가요">차익거래란 무엇인가요?</h1>

<p><img src="https://hummingbot.org/blog/what-is-arbitrage/cover.webp" alt="" /></p>

<p>지난주 저희는 Hummingbot 아카데미의 <a href="/_posts/2025-09-18-hummingbot-what-is-market-making.md">첫 번째 글</a>로 마켓 메이킹에 대한 소개를 다루었으며, 오늘은 다음 질문에 답하기 위해 차익거래(Arbitrage)에 대해 논의합니다:</p>

<ul>
  <li>차익거래란 무엇인가요?</li>
  <li>차익거래자들은 무슨 일을 하나요?</li>
  <li>차익거래는 어떻게 운영하나요?</li>
  <li>나만의 차익거래 로봇은 어떻게 만드나요?</li>
</ul>

<p>저희 Hummingbot 아카데미의 목표는 여러분이 마켓 메이킹과 차익거래에 대해 더 많이 배우고, 저희의 무료 오픈소스 로봇을 사용하여 자신만의 전략을 구현하는 방법을 돕는 것입니다.</p>

<!-- ========================================================================================== -->
<h2 id="-차익거래가-무엇일까요">✅ 차익거래가 무엇일까요?</h2>
<!-- ========================================================================================== -->
<p>차익거래의 개념은 매우 간단합니다:</p>

<blockquote>
  <p><strong>차익거래</strong>는 시장 간의 자산 가격 차이로부터 이익을 얻기 위해 자산을 구매하고 판매하는 행위입니다.</p>
</blockquote>

<p>차익거래가 정확히 어떻게 발생하는지 더 잘 설명하기 위해, 바나나에 대해 이야기해 보겠습니다. 네, 바나나입니다.</p>

<p><img src="https://hummingbot.org/blog/what-is-arbitrage/banana_market.png" alt="" /></p>

<p>경제의 상당 부분이 바나나 생산에 기반을 둔 작은 마을을 상상해 보세요. 많은 농장들이 현지 시장에서 자신들의 작물을 판매합니다.</p>

<p>이로 인해 현지에서 많은 바나나가 판매되고, 자연스럽게 높은 공급으로 인해 가격이 매우 저렴합니다. kg당 0.50달러라고 가정해 봅시다.</p>

<p>몇 킬로미터 떨어진 곳에는 큰 도시가 있지만, 그 경제는 대부분 산업에 기반을 두고 있어 주변에 바나나 농장이 많지 않습니다.</p>

<p>하지만 그 큰 도시의 시민들은 건강을 위해 여전히 과일을 먹고 싶어 하고, 이는 바나나에 대한 큰 수요를 만들어내며, 기꺼이 kg당 0.65달러를 지불하려고 합니다.</p>

<p>여기에 기회가 있다는 것이 꽤 명확하게 보입니다. 한 상인은 작은 마을에서 바나나를 사서 큰 도시에서 팔고, 운송된 킬로그램당 <strong>0.15달러(운송 비용 제외)</strong>의 이익을 얻을 수 있습니다.</p>

<p>이 경우 상인(차익거래자)은 차익거래를 하고 있는 것입니다: 한 시장에서 바나나(자산)를 사서 다른 시장으로 운송하여 이익을 남기고 팔면서, 거래의 양쪽이 동시에 체결되면 이익을 확정하여 위험을 줄입니다.</p>

<!-- ========================================================================================== -->
<h2 id="-마켓-메이킹과-차익-거래는-같은-것-아닌가요">✅ 마켓 메이킹과 차익 거래는 같은 것 아닌가요?</h2>
<!-- ========================================================================================== -->
<p><u>마켓 메이킹과 차익 거래의 기본 개념</u>은 <font color="red">낮은 가격에 사서 높은 가격에 팔아 작은 이윤을 남기는 것</font>으로 매우 유사하지만, <u>핵심적인 차이점</u>은 마켓 메이커와 차익거래자가 거래를 찾는 <font color="red">'장소'</font>에 있습니다.</p>

<blockquote>
  <p>💡 <strong>전당포 주인과 같은</strong> 마켓 메이커는 단일 장소에서 운영하며, 동일한 시장에서 매수 및 매도 제안을 합니다. (도시 간에 상품을 운송하는 상인과 같은) 차익거래자는 하나 이상의 장소에서 운영하며, 두 개(또는 그 이상)의 다른 시장에서 매수 및 매도 제안을 가져옵니다.</p>
</blockquote>

<p>각각이 시장에 미치는 영향도 다릅니다. <u>마켓 메이커</u>는 유동성을 제공하고, 매수-매도 스프레드와 슬리피지를 줄이는 반면, <u>차익거래자</u>는 두 시장(보통 유동성이 높은 시장과 낮은 시장)에서 유동성을 제거하지만, 두 장소의 가격이 같은 수준으로 수렴하도록 만듭니다.</p>

<!-- ========================================================================================== -->
<h2 id="-시장-비효율성과-금융-시장에서의-차익거래">✅ 시장 비효율성과 금융 시장에서의 차익거래</h2>
<!-- ========================================================================================== -->
<p>전 세계적으로 다양한 자산이 매일 거래되는 많은 다른 금융 시장이 있습니다.</p>

<p>모든 주요 도시나 국가는 보통 자체 금융 거래소를 가지고 있으며, 이곳에서 모든 종류의 투자자들이 만나 다양한 금융 상품을 사고팝니다.</p>

<p>뉴욕에는 나스닥(NASDAQ)과 뉴욕증권거래소(NYSE), 시카고에는 CME와 CBOE, 일본에는 JPX, 중국에는 SSE, 독일에는 FRA, 브라질에는 B3 등이 있으며, 이 목록은 계속됩니다.</p>

<p>그리고 정보 기술에 큰 발전이 있었음에도 불구하고, 수많은 거래소와 각 거래소 간의 거리는 여전히 소위 시장 비효율성(market inefficiencies)을 낳습니다.</p>

<p>이를 설명하기 위해, 두 다른 시장에서의 달러-엔(USD-JPY) 가격을 살펴보겠습니다.</p>

<p>어떤 시점에서 뉴욕과 일본 거래소의 오더북이 정확히 동일하다고 가정해 봅시다:</p>

<p><img src="https://hummingbot.org/blog/what-is-arbitrage/spread1.png" alt="" /></p>

<p>그때, 한 투자자가 일본 거래소에서 시장가로 360엔을 매수하는 주문을 보냅니다.</p>

<p>다음에 일어날 일은 일본 거래소 오더북에 새로운 매도 호가(Ask price)가 생기는 것이고, 보통 마켓 메이커들은 그 주문으로 인해 생긴 스프레드 격차를 메우기 위해 오더북에 새로운 매수 주문(Bid orders)을 생성할 것입니다:</p>

<p><img src="https://hummingbot.org/blog/what-is-arbitrage/spread2.png" alt="" /></p>

<p>이때 차익거래자가 움직입니다. 뉴욕 거래소에서 106.207의 가격으로 100엔을 사고, 즉시 일본 거래소에서 106.29에 팔아, 거래에서 총 8.70달러(0.082%)의 이익을 얻습니다.</p>

<p>결국, 더 많은 차익거래가 발생함에 따라 뉴욕 거래소의 매도 호가는 일본 거래소의 매도 호가와 일치할 때까지 올라갈 것입니다.</p>

<blockquote>
  <p>💡 전통적인 금융 시장에서는 엄청난 양의 차익거래 경쟁이 있으며, 수익성은 밀리초(milliseconds) 단위로 결정됩니다. 이를 수행하는 회사들은 보통 차익거래 알고리즘의 속도를 높이기 위해 기술과 인프라에 막대한 투자(수십억 달러)를 합니다.</p>
</blockquote>

<!-- ========================================================================================== -->
<h2 id="-암호화폐와-차익거래-기회">✅ 암호화폐와 차익거래 기회</h2>
<!-- ========================================================================================== -->
<p>지난 10년간 암호화폐 가치가 상승함에 따라 거래소 환경도 이 성장을 따라갔고, 오늘날 <a href="coinmarketcap.com">Coinmarketcap.com</a>은 총 311개의 거래소에 6,974개의 다른 암호화폐가 거래될 수 있다고 목록에 올리고 있습니다.</p>

<p>이것은 모든 거래소에 걸쳐 다양한 거래량, 유동성, 스프레드가 존재하기 때문에 여전히 존재하는 큰 시장 비효율성으로 인해 엄청난 양의 차익거래 기회를 만들어냅니다.</p>

<p>하지만 암호화폐 거래 환경에는 가능성의 추가적인 층을 더하는 새롭고 흥미로운 요소가 있습니다: 탈중앙화 거래소입니다.</p>

<blockquote>
  <p>💡 <strong>중앙화 거래소 (CEX)</strong>: 모든 자산이 거래소의 관리 하에 있으며, 사용자의 잔액은 거래소에 의해 통제됩니다. (e.g. 바이낸스, 바이비트, 업비트, 빗썸 등)</p>
</blockquote>

<blockquote>
  <p>💡 <strong>탈중앙화 거래소 (DEX)</strong>: 모든 자산이 소유자의 관리 하에 있으며, 거래소는 구매자와 판매자가 개인 지갑 간에 거래를 실행할 수 있는 방법으로 기능합니다. (e.g. 유니스왑, 팬페이크스왑 등)</p>
</blockquote>

<p>CEX 모델은 전통적인 금융 시장에 이미 존재하는 것을 반영한 것이며, 이러한 검증된 서비스는 암호화폐 공간에서 매우 오랫동안 제공되어 왔습니다. 특히 대형 거래소들 사이에서는 이미 많은 차익거래 경쟁이 벌어지고 있으며, 시간이 지남에 따라 좋은 기회를 찾기가 점점 더 어려워지고 있습니다.</p>

<p>반면에, DEX의 개념은 비교적 새롭고, 다양한 모델과 분산화 수준을 가진 많은 프로젝트들이 개발되고 있습니다.</p>

<p>사실, 유니스왑(Uniswap)과 같은 <u>AMM(자동화된 마켓 메이커)</u> 탈중앙화 프로토콜은 실제로 차익거래자들이 내부 가격을 다른 외부 거래소와 일치시키도록 조정하는 데 의존합니다.</p>

<p>이것은 수익성 있는 차익거래를 위한 다양한 기회를 열어줍니다.</p>

<p>따라서 이러한 기회를 찾고 있다면, 오늘날 운영 중인 탈중앙화 거래소들을 꼭 확인해 보세요.</p>

<blockquote>
  <p>💡 보통 모든 거래소는 각 거래 작업에 수수료를 부과하므로, 차익거래 전략을 계획할 때 거래 실행 비용을 반드시 고려해야 합니다. DEX는 또한 고려해야 할 추가적인 비용 층을 제시하는데, 트랜잭션이 어떻게 처리되는지에 따라 블록체인 트랜잭션 수수료와 같은 추가 비용이 발생할 수 있습니다.</p>
</blockquote>

<!-- ========================================================================================== -->
<h2 id="-자동화된-거래와-차익거래">✅ 자동화된 거래와 차익거래</h2>
<!-- ========================================================================================== -->
<p>수익성 있는 차익거래를 완료하는 데에는 두 가지 핵심 요소가 있습니다:</p>

<ul>
  <li>수익성 있는 가격 불일치가 있는 두 시장을 찾기;</li>
  <li>다른 사람보다 먼저 오더북에 있는 시장 제안을 가져오기.</li>
</ul>

<p>이론적으로는 다른 거래소에서 자산 가격을 확인하고 주문 크기와 가격을 입력하여 거래를 체결하는 수동 프로세스를 통해 차익거래 기회를 활용하는 것이 가능합니다.</p>

<p>하지만 거래를 완료하기 위해 버튼을 클릭할 준비가 되었을 때쯤에는, 당신이 보고 있던 주문을 다른 사람이 이미 가져갔을 가능성이 높고, 거래는 더 이상 수익성이 없을 것입니다.</p>

<p>알고리즘 트레이드 로봇의 사용은 위에서 언급한 두 가지 요소를 실행할 수 있는 속도 때문에 오늘날 시장에서 차익거래의 필수적인 구성 요소가 되었습니다. 로봇은 끊임없이 수익성 있는 거래를 찾고 감지되는 즉시 실행합니다.</p>

<blockquote>
  <p>🐦 Hummingbot에서는 <code class="language-plaintext highlighter-rouge">create</code> 명령어를 사용하여 차익거래 전략을 만들 수 있으며, 어떤 전략을 사용할지 물었을 때 <code class="language-plaintext highlighter-rouge">arbitrage</code>를 입력하면 됩니다.</p>
</blockquote>

<!-- ========================================================================================== -->
<h2 id="-차익거래의-위험">✅ 차익거래의 위험</h2>
<!-- ========================================================================================== -->
<p>차익거래의 개념은 정말 간단합니다: 한 시장에서 싸게 사서, 다른 시장에서 동시에 비싸게 파는 것입니다.</p>

<p>성공하면, 이 작업은 투자에 있어서 하나의 큰 위험인 <strong>변동성 위험(volatility risk)</strong>을 제거합니다.</p>

<p>차익거래자들은 가격 움직임에 대해 걱정하거나 시장 방향을 찾으려고 노력할 필요가 없으며, 한 곳에서 더 낮은 가격에 사서 다른 곳에서 즉시 더 높은 가격에 팔 수 있다는 것을 알 때만 거래할 것입니다.</p>

<p>하지만 모든 트레이딩 전략과 마찬가지로, 차익거래도 완전히 위험이 없는 것은 아닙니다.</p>

<font color="red">위험의 대부분은 거래 실행(다른 사람보다 얼마나 빨리 거래를 체결할 수 있는지)과 시장 유동성(거래하려는 가격의 주문이 시장에 충분하지 않음)에 있습니다.</font>

<p>바나나 상인을 생각해 보면, 한 도시에서 다른 도시로 이동하는 동안 문제(느린 트럭, 펑크 난 타이어 등)가 발생할 수 있으며, 그가 큰 도시에 도착했을 때 사람들이 지불하려던 가격이 낮아져 그의 이익이 줄어들거나 심지어 손실을 보고 거래를 마감할 수도 있습니다.</p>

<p>어느 정도까지, 차익거래자들은 실행 위험을 완화하고, 예를 들어 신뢰할 수 있는 인프라에 막대한 투자를 하거나, 거래소 서버에 더 가까이 운영을 옮기는 등의 이점을 만들 수 있습니다.</p>

<p>또한, 차익거래 경쟁이 치열해질수록 기회를 찾기가 점점 더 어려워집니다. 차익거래자들은 장기간 기회를 찾을 수 있지만, 그것을 찾을 것이라는 보장은 없습니다.</p>

<p>다른 모든 유형의 거래와 마찬가지로, 자산을 위험에 빠뜨리기 전에 위험을 이해하고 전략을 테스트해야 합니다.</p>

<blockquote>
  <p>🐦 Hummingbot에서는 <code class="language-plaintext highlighter-rouge">paper_trading</code> 명령어를 사용하여 모의 투자 모드를 활성화할 수 있습니다. 이를 통해 자본을 위험에 빠뜨릴 필요 없이 실시간 시뮬레이션 환경에서 전략을 테스트할 수 있습니다.</p>
</blockquote>

<p>고려해야 할 또 다른 중요한 위험은 거래를 실행하는 장소와 관련이 있습니다:</p>

<ul>
  <li>
    <p>중앙화 거래소 (CEX)는 당신의 자산을 보관하고 있으며, 어떤 이유로든(해킹, 사기 등) 자산에 대한 접근이 거부될 수 있으므로, 거래소의 평판과 보안 시스템을 반드시 조사해야 합니다.</p>
  </li>
  <li>
    <p>탈중앙화 거래소 (DEX) 운영은 거래 흐름을 제어하기 위해 스마트 계약에 의존하며, 코드의 버그나 결함은 자금이 잠기거나 도난당하는 것과 같은 큰 문제로 이어질 수 있으므로, DEX 이면의 프로그램에 주요 결함이 없는지 이해하는 것이 중요합니다. 코드 언어를 이해하지 못하더라도, 웹에서 가능한 취약점에 대한 정보를 찾아보세요.</p>
  </li>
</ul>

<!-- ========================================================================================== -->
<h2 id="-저희-커뮤니티에-참여하세요">✅ 저희 커뮤니티에 참여하세요</h2>
<!-- ========================================================================================== -->
<p>이것으로 시장 비효율성을 활용하여 수익성 있는 거래를 찾는 정말 간단한 전략인 차익거래에 대한 소개를 마칩니다. 다음 주에는 마켓 메이킹과 차익거래의 혼합인 <strong>교차 거래소 마켓 메이킹(Cross-exchange market making)</strong>을 다룰 것입니다.</p>

<p>더 배우고 싶다면, 매주 새로운 글이 올라오는 저희 블로그 업데이트를 꼭 팔로우하세요.</p>

<p>다음 글을 기다리는 동안, 저희 디스코드 서버에 참여하는 것을 잊지 마세요. 이곳은 우리 커뮤니티가 마켓 메이킹과 차익거래, 그리고 Hummingbot을 사용하여 트레이딩 전략을 개선할 수 있는 모든 가능한 방법에 대해 이야기하는 곳입니다.</p>

<p>또한, Hummingbot 아카데미에서 다루었으면 하는 특정 주제가 있다면, 디스코드에서 저희 팀에 연락하거나 academy@hummingbot.io로 이메일을 보내주세요.</p>

<p>곧 뵙겠습니다. 모두 수익성 있는 트레이딩 세션이 되시기를 바랍니다!</p>

<details>
<summary><a href="https://hummingbot.org/blog/what-is-arbitrage/">Show original (English)</a></summary>

![](https://hummingbot.org/blog/what-is-arbitrage/cover.webp)

# Welcome to Hummingbot Academy!

Last week we published the [first article](/_posts/2025-09-18-hummingbot-what-is-market-making.md) of the Hummingbot Academy, covering an introduction to what is Market Making, and today we discuss Arbitrage in order to answer the following questions:

- What is arbitrage?
- What do arbitrageurs do?
- How to run arbitrage operations?
- How do I create my arbitrage robot?

Here at Hummingbot Academy our goal is to help you learn more about market making and arbitrage, and how to use our free open-source robot to implement your own strategy.

## But what is arbitrage?

The concept of arbitrage is pretty simple:

&gt; **Arbitrage** is the purchase and sale of an asset in order to profit from a difference in the asset's price between markets.

To better explain exactly how an arbitrage operation happens, let's talk about bananas. Yes, bananas.

![](https://hummingbot.org/blog/what-is-arbitrage/banana_market.png)

Picture a small town, where a big part of its economy is based on bananas production, with a lot of farms selling their crop on the local market.

This result in a lot of bananas being sold locally, and naturally due to the high offer, they are pretty cheap to buy, let's say for $0.50/kg.

A few kilometers away lies a big city, but most of its economy is based on industry, therefore there aren't many banana farms surrounding it.

But citizens of that big city still want to eat fruit to have good health, which creates a big demand for bananas, and they are willing to pay $0.65/kg.

It's pretty clear to see there is an opportunity here, and a merchant could buy bananas from the small town, sell on the big city, and profit $0.15 (without accounting the transportation costs) for each transported kilogram.

The merchant (arbitrageur) in this case is doing an arbitrage operation: buying and transporting bananas (the asset) from one market and selling it on another market for a profit, while reducing his risk by locking his profits if both sides of the deal are closed at the same time.

## Isn't it the same as a market making operation?

Although the basic concept of both operations is pretty similar (buy low and sell high with a small profit margin), the key difference is the 'where' the market maker and the arbitrageur look for deals.

&gt; 💡 The market maker **like a pawnshop owner** operates on a single place, making buy and sell offers on the same market. The arbitrageur (like a merchant transporting goods between towns), operates on more than one place, taking buy and sell offers from two (or more) different markets.

The way each one affects the markets is also different because while a market maker is providing liquidity, reducing bid-ask spread and slippage, while the arbitrageur is removing liquidity from two markets (usually from a high-liquidity market and a low-liquidity market), but pushing the prices to converge on the same level on both places.

## Markets inefficiencies and arbitrage on financial markets

Around the world, there are a lot of different financial markets where a variety of assets are being traded on a daily basis.

Every major city or country usually has its own financial exchange were all kind of investors meet to buy and sell different financial instruments.

We have NASDAQ and NYSE on New York, CME and CBOE on Chicago, JPX on Japan, SSE on China, FRA in Germany, B3 in Brazil, and the list goes on and on.

And even though there was a huge evolution in the information technology, the sheer amount of exchanges and the distance between each one still leads to so-called market inefficiencies.

To illustrate this, we will take a look at the Dollar-Yen (USD-JPY) prices on two different markets.

Let's assume that at some point in time, the order book of a New York and a Japan exchanges are exactly the same:

![](https://hummingbot.org/blog/what-is-arbitrage/spread1.png)

Then, an investor decides to send a order to buy 360 JPY on the Japan Exchange at market price.

What will happen next is that there will be a new Ask price on the Japan Exchange book, and usually, the Market Makers will create new Bid orders on the book to fill the spread gap that was created by that order:

![](https://hummingbot.org/blog/what-is-arbitrage/spread2.png)

This is when the arbitrageur makes his move, buying 100 JPY at the New York exchange at the price 106.207 and selling them immediately on the Japan Exchange for 106.29, netting a total profit of 8.70 USD (0.082%) on the trade.

Eventually, as more arbitrage operations happen, the Ask price on the NY exchange will go up until it matches the Ask price on the Japan Exchange.

&gt; 💡 In the traditional financial markets, there is a huge amount of arbitrage competition, with profitability being determined by milliseconds. The companies doing it usually make big investments (billions of dollars) in technology and infrastructure to increase the speed of arbitrage algorithms.

## Cryptocurrencies and arbitrage opportunities

With the rise of cryptocurrencies value over the last 10 years, the exchanges landscape followed this growth, and today [Coinmarketcap.com](coinmarketcap.com) lists a total of 311 exchanges where 6,974 different cryptocurrencies can be traded.

This creates a huge amount of opportunities for arbitrage operations, due to the big market inefficiency that still exists between all these exchanges with a wide range of volume, liquidity, and spread across all of them.

But there is a new and interesting factor in the cryptocurrency trading environment that adds an extra layer of possibilities: decentralized exchanges.

&gt; 💡 **Centralized Exchange (CEX)**: All the assets in the custody of the exchange, and the user's balance is controlled by the exchange.

&gt; 💡 **Decentralized Exchange (DEX)**: All the assets are in the custody of their owners, and the exchange function as a way for buyers and sellers to execute a trade between their private wallets.

The CEX model is a reflection of what already exists in the traditional financial markets and this kind of tried-and-true service has been offered in the cryptocurrency space for a very long time. We can say that there is already a lot of competition doing arbitrage operations, especially among the bigger exchanges, and as time goes by, it is getting harder to find good opportunities.

On the other hand, the concept of a DEX is relatively new and there are a lot of projects with different models and levels of decentralization being developed.

As a matter of fact, AMM (Automated Market Makers) decentralized protocols like Uniswap actually rely on arbitrageurs to adjust their internal prices to match other external exchanges.

This opens up a wide array of opportunities for profitable arbitrage.

So, if you are looking for these opportunities, be sure to check the of the decentralized exchanges that are operational today.

&gt; 💡 Usually, all exchanges charge a fee on each trade operation, so be sure to consider the cost of executing the trade when planning your arbitrage strategy. DEXes also present an extra layer of cost to be considered, because depending on how the transactions are processed, there might be some added cost like blockchain transaction fees.

## Automated trade and arbitrage

There are two key components on completing a profitable arbitrage trade:

- Find two markets with profitable price discrepancies;
- Take the market offers listed on the book before anyone else.

In theory, it is possible to capitalize on arbitrage opportunities through the manual process of checking the price of an asset across different exchanges and type your order size and price to close the deal.

But by the time you are ready to click the button to complete the trade, it is most likely that another person already took the order you were looking at, and the trade won't be profitable anymore.

The use of algorithmic trade robots has become an essential component of arbitrage operations in today's markets because of the speed it can execute both components listed above, by constantly looking for profitable trades and executing them at the exact moment they are detected.

&gt; 🐦 You can create an arbitrage strategy on Hummingbot using the create command and then typing arbitrage when asked what is the strategy you want to use.

## The risks of arbitrage

The concept of arbitrage operations is really simple: buy low on one market, sell high on another at the same time.

When successful, this operation eliminates one big risk when it comes to investing: volatility risk.

Arbitrageurs don't have to worry about the price movements or try to find the market direction, and they will only trade if they know they can buy in one place at a lower price and immediately sell it at another place at a higher price.

But as it happens with all trading strategies, arbitrage isn't completely risk-free.

The majority of the risk lies upon the trade execution (how fast can you close the trade before someone else) and the market liquidity (not enough orders available on the markets with the price you are looking to trade).

If you think about the banana's merchant, he could have problems while traveling from one city to another (slow truck, flat tire, etc), and by the time he reaches the big city, the price people were willing to pay could be lower, reducing his profits or even close the trade at a loss.

To some degree, arbitrageurs can mitigate the execution risk and create some advantages, for example by investing heavily in reliable infrastructure, or moving his operation closer to the exchange servers.

Also, as arbitrage gets increasingly competitive, opportunities become increasingly hard to come by. Arbitrageurs may search for opportunities for long periods of time but are not guaranteed to find them.

As with any other type of trade, be sure to understand the risks and test your strategy before putting your assets at risk.

&gt; 🐦 With Hummingbot you can enable the paper trading mode using the command paper_trading, which allows you to test your strategy in a real-time simulated environment, without the need to put your capital at risk.

Another important risk you must consider is related to where you are executing your trades:

- Central Exchanges have the custody of your assets, and your access to them can be denied for any reason (hacks, scams, etc), so be sure to research the exchange reputation and security systems;

- Decentralized Exchanges operations rely on the smart contracts to control the trade flow and bugs or flaws on the code can lead to big problems like funds being locked or stolen, therefore it is important to understand the if the program behind the DEX doesn't have major flaws. Even if you don't understand the code language, look around the web for information about possible vulnerabilities.

## Join our community

And this concludes our introduction to arbitrage, a really simple strategy that take advantage of market inefficiencies to find profitable trades. Next week we will cover Cross-exchange market making, which is a mix of market making and arbitrage.

If you want to learn more, make sure to follow our blog updates for new articles every week.

While you wait for the next post, remember to join our Discord server, a place where our community talks about market making and arbitrage, and all the possible ways you can use Hummingbot to improve your trading strategies.

Also, if there is any specific topic you want us to cover on the Hummingbot Academy, contact our team on Discord, or send an email to academy@hummingbot.io.

See you soon, and I wish you all a profitable trading session!

</details>

<h1 id="참고자료">참고자료</h1>
<ul>
  <li>https://github.com/hummingbot/hummingbot</li>
  <li>https://hummingbot.org/blog/what-is-arbitrage</li>
</ul>]]></content><author><name>성민석</name><email>minsuksung@korea.ac.kr</email></author><category term="blog" /><category term="hummingbot" /><category term="arbitrage" /><category term="algorithm-trading" /><summary type="html"><![CDATA[차익거래란 무엇인가요?]]></summary></entry><entry><title type="html">What is Market Making?</title><link href="https://minsuk-sung.github.io/blog/hummingbot-what-is-market-making/" rel="alternate" type="text/html" title="What is Market Making?" /><published>2025-09-01T00:00:00+09:00</published><updated>2025-09-01T00:00:00+09:00</updated><id>https://minsuk-sung.github.io/blog/hummingbot-what-is-market-making</id><content type="html" xml:base="https://minsuk-sung.github.io/blog/hummingbot-what-is-market-making/"><![CDATA[<h1 id="마켓메이킹이란-무엇인가요">마켓메이킹이란 무엇인가요?</h1>

<p><img src="https://hummingbot.org/blog/what-is-market-making/cover.webp" alt="" /></p>

<p>이 페이지에 오셨다면, 아마도 다음 질문 중 하나를 해보셨을 가능성이 높습니다:</p>

<ul>
  <li>마켓 메이커란 무엇인가요?</li>
  <li>마켓 메이커는 무슨 일을 하나요?</li>
  <li>어떻게 마켓 메이커가 될 수 있나요?</li>
  <li>마켓 메이킹 로봇은 어떻게 만드나요?</li>
  <li>그렇다면, 제대로 찾아오셨습니다!</li>
</ul>

<p>저희 <a href="">Hummingbot</a>의 목표는 여러분이 마켓 메이킹에 대해 더 많이 배우고, 저희의 무료 오픈소스 로봇을 사용하여 자신만의 전략을 구현하는 방법을 돕는 것입니다.</p>

<h2 id="그런데-마켓-메이커가-무엇일까요">그런데 마켓 메이커가 무엇일까요?</h2>

<blockquote>
  <p>마켓 메이커(MM)는 유가증권 시장에서 매수(bid)와 매도(ask) 호가를 적극적으로 제시하며 양방향 시장을 조성하고, 각 호가의 시장 규모를 함께 제공하는 회사 또는 개인을 말합니다. (<a href="https://www.investopedia.com/terms/m/marketmaker.asp">출처</a>)</p>
</blockquote>

<p>위 인용문이 잘 이해되지 않았다면, 전당포를 상상해 보세요:</p>

<p><img src="https://hummingbot.org/blog/what-is-market-making/pawn.jpg" alt="" /></p>

<p>수잔은 오래된 기타를 가지고 있지만 더 이상 연주할 시간이 많지 않고, 현금이 좀 필요하다고 가정해 봅시다. 한편, 도시의 다른 곳에서는 마이크가 친구의 기타로 연주를 배우다가 이제 자신의 기타를 살 만큼 실력이 늘었다고 생각하지만, 새 기타는 너무 비쌀 수 있습니다.</p>

<p>거래를 성사시킬 수 있는 두 사람이 있지만, 서로를 찾거나 기타에 대한 합리적인 가격에 합의하기는 어려울 수 있습니다.</p>

<p>바로 이 지점에서 전당포가 등장합니다:</p>

<p>수잔은 기타를 사려는 사람을 찾아다니는 대신, 전당포에 기타를 팔 수 있고, 마이크는 그곳에 가면 기타를 찾을 수 있다는 것을 알고 찾아갈 수 있습니다.</p>

<p>전당포 주인은 수잔과 마이크 모두에게 서비스를 제공하고 있습니다. 그는 그들이 원하는 것을 쉽게 팔거나 살 수 있는 방법(유동성 제공)과, 마을의 중고 기타 수요에 기반한 공정한 가격(스프레드 축소)을 제공합니다.</p>

<p>전당포는 이 서비스의 대가로 수잔에게 지불한 가격과 마이크로부터 받은 가격의 차액(스프레드 크기)으로 수익을 얻습니다.</p>

<blockquote>
  <p>💡 마켓 메이커는 전당포 주인처럼 금융 시장에서 동일한 종류의 서비스를 제공합니다. 그는 유동성을 공급하고 매수-매도 스프레드 크기를 줄이는 데 도움을 주며, 자신의 매수 주문과 매도 주문 간의 차액(스프레드)에서 이익을 얻습니다.</p>
</blockquote>

<h2 id="금융-시장에서-마켓-메이킹은-어떻게-이루어지나요">금융 시장에서 마켓 메이킹은 어떻게 이루어지나요?</h2>

<p>금융 시장은 실제 경제의 공개 시장과 크게 다르지 않습니다. 매일 수백만 명의 사람들이 어떤 종류의 거래 플랫폼에 접속하여 주식, 채권, 석유, 금, 계약, 암호화폐 등 다양한 자산에 대한 거래를 체결하고자 합니다.</p>

<p>하지만 수천 명의 사람들이 한 장소에 모여 팻말을 들고 있거나 무언가를 얼마에 사거나 파는지 소리치는 대신, 금융 자산 시장은 모든 매수 및 매도 제안이 한 곳에 집계되는 오더북(order book)을 사용합니다:</p>

<p><img src="https://hummingbot.org/blog/what-is-market-making/order_book.png" alt="" /></p>

<p>오더북은 모든 시장 참여자들이 제시한 모든 매수 및 매도 제안(수량과 가격 포함)의 목록에 불과합니다.</p>

<p>위 사진에서 우리는 BTC/USD 페어의 오더북을 볼 수 있습니다. 만약 지금 비트코인을 사려는 사람이 있다면, 그는 12,022.230달러(가장 낮은 매도 호가)를 지불해야 하며, 그 가격에는 0.578 BTC가 있습니다.</p>

<p>하지만 즉시 비트코인을 팔고 싶은 사람이 있다면, 그는 최대 0.016 BTC에 대해 12,016.32달러(가장 높은 매수 호가)의 가격을 받아들여야 합니다.</p>

<blockquote>
  <p>💡 상품이나 자산에 대한 <u>가장 낮은 매도 호가와 가장 높은 매수 호가 사이의 차이</u>를 <font color="red">스프레드(spread)</font>라고 합니다.</p>
</blockquote>

<p>기술적으로, 오더북에 매수 또는 매도 제안을 올리는 모든 사람은 마켓 메이커(maker) 역할을 하는 것이며, 오더북에 제시된 가격을 받아들이는 사람들은 마켓 테이커(taker)라고 불립니다.</p>

<p>마켓 메이커로 활동하는 것은 개념적으로 “전당포 주인”처럼 시장에 참여하는 것과 유사합니다. 자산을 낮은 가격에 사겠다는 제안을 만들고, 가능한 한 빨리 그리고 가능한 한 여러 번 더 높은 가격에 파는 것입니다.</p>

<blockquote>
  <p>💡 가장 일반적인 트레이딩/투자 전략이 큰 가격 변동에서 이익을 얻으려는 반면, 전문 마켓 메이커는 두 가격 수준 사이의 더 작지만 더 일관된 가격 변동을 이용하려고 합니다.</p>
</blockquote>

<p>대부분의 트레이더와 투자자들은 시장이 이렇게 움직이는 것을 보고 싶어 합니다:</p>

<p><img src="https://hummingbot.org/blog/what-is-market-making/graph1.png" alt="" /></p>

<p>반면 마켓 메이커들은 시장 가격이 이렇게 움직이는 것을 좋아합니다:</p>

<p><img src="https://hummingbot.org/blog/what-is-market-making/graph2.png" alt="" /></p>

<p>자산의 가격은 일정한 흐름으로 변하는 것이 아니라 파도처럼 변합니다. 트레이더와 투자자들이 바다가 밀물로 향하는지 썰물로 향하는지 알아내려고 하는 동안, 마켓 메이커는 해변의 더 작은 파도를 지켜보고 있습니다.</p>

<h2 id="매수-매도-스프레드-vs-마켓-메이커-스프레드">매수-매도 스프레드 vs 마켓 메이커 스프레드</h2>

<p>앞서 본 사진의 오더북 상태를 보면, 마켓 메이커는 두 가지 제안을 올릴 수 있습니다:</p>

<ul>
  <li>비트코인 1개를 12,016.320달러에 매수 (매수 호가)</li>
  <li>비트코인 1개를 12,022.230달러에 매도 (매도 호가)</li>
</ul>

<p>다른 시장 참여자들이 이 가격들을 받아들여 양쪽 주문이 모두 체결되면, 마켓 메이커는 이 거래에서 5.91달러의 이익을 얻게 됩니다.</p>

<p>이것은 시장의 매수-매도 스프레드로도 알려져 있으며, 위 예시에서는 마켓 메이커가 작업의 양쪽을 모두 완료하여 받은 5.91달러의 이익입니다:</p>

\[\frac{(12,022.23-12,016.32)}{12,016.32} = 0.049\%\]

<p>일부 거래소는 실시간으로 매수-매도 스프레드를 시각화하는 방법을 제공하기도 합니다 (오더북에 게시된 모든 주문의 누적 크기인 북 뎁스(book depth)와 함께):</p>

<p><img src="https://hummingbot.org/blog/what-is-market-making/chart_depth.png" alt="" /></p>

<p>하지만 이것이 마켓 메이커가 항상 이 정확한 매수 및 매도 가격을 사용해야 한다는 의미는 아닙니다.</p>

<p>마켓 메이커는 자신의 운영 스프레드를 결정할 때 다른 요인들을 고려해야 합니다, 예를 들면:</p>

<ul>
  <li>시장의 매수-매도 스프레드;</li>
  <li>거래 비용 (거래소 수수료 및/또는 이체 수수료 포함);</li>
  <li>거래량;</li>
  <li>시장 변동성;</li>
  <li>운영 비용 (전기 요금, 클라우드 서버 비용 등);</li>
  <li>거래 운영과 관련된 기타 모든 비용.</li>
</ul>

<p>마켓 메이커 스프레드가 얼마나 커야 하는지 또는 작아야 하는지에 대한 정답은 없으며, 결국 스프레드는 마켓 메이커 전략의 일부일 뿐입니다.</p>

<blockquote>
  <p>🐦 Hummingbot에서는 <code class="language-plaintext highlighter-rouge">config ask_spread</code> 명령어로 매도 주문의 스프레드 비율을, <code class="language-plaintext highlighter-rouge">config bid_spread</code> 명령어로 매수 주문의 스프레드 비율을 변경할 수 있습니다.</p>
</blockquote>

<h2 id="전략에는-무엇이-포함되나요">전략에는 무엇이 포함되나요?</h2>

<p>수익성 있는 마켓 메이커가 되는 것은 단지 스프레드 크기를 선택하고, 오더북에 지정가 주문을 보내기 시작한 다음, 뒤돌아서 잊어버리는 것만이 아닙니다.</p>

<p>마켓 메이킹 운영을 시작하기 전에, 스스로에게 몇 가지 질문을 해야 합니다:</p>

<ul>
  <li>스프레드를 항상 고정시켜야 할까? 시장 상황에 따라 변경해야 할까?</li>
  <li>내 주문의 크기는 얼마로 해야 할까?</li>
  <li>시장에 가격 추세가 있을 때, 또는 명확한 추세가 없을 때 어떻게 해야 할까?</li>
  <li>시장 방향은 어떻게 감지할 것인가?</li>
  <li>내 주문은 오더북에 얼마나 오래 있어야 할까?</li>
  <li>한쪽 주문이 체결되면, 반대쪽 주문은 체결될 때까지 유지해야 할까?</li>
  <li>시간이 지남에 따라 한 자산을 더 많이 축적하고 싶은가, 아니면 항상 50/50 잔액을 유지하고 싶은가?</li>
  <li>가격 급등이 있을 때 어떻게 해야 할까?</li>
  <li>평균 매수 비용을 신경 써야 할까?</li>
  <li>언제 시장에서 벗어나야 하고 그 이유는 무엇이며, 아니면 항상 거래해야 할까?</li>
  <li>무엇을 잃을 수 있고, 얼마나 많은 위험을 감수하고 있는가?</li>
  <li>이 질문들에 대한 답은 시장 상황에 따른 당신의 행동(그리고 반응)을 결정하며, 궁극적으로 당신의 전략을 정의할 것입니다.</li>
</ul>

<p>좋은 마켓 메이킹 전략은 시장 변화에 어떻게 반응할지 미리 계획하는 것에 불과합니다.</p>

<p>하지만 이 모든 질문에 겁을 먹고 마켓 메이킹을 포기하기 전에, 여기 팁이 있습니다:</p>

<blockquote>
  <p>💡 작게 시작하세요. 사전에 전략에 대한 모든 답을 가지려고 하지 말고, 한 번에 하나의 매개변수에 집중하여 다른 시장 상황에서 어떤 일이 일어나는지 테스트하고 관찰하세요. 시간이 지나면 다른 매개변수를 추가하고 더 많은 테스트를 하며 모든 조각들이 함께 어떻게 작동하는지 지켜보세요.</p>
</blockquote>

<p>규격화되어 있고, 바로 사용할 수 있으며, 모든 상황에 맞고, 항상 수익성 있는 전략/매개변수를 그냥 찾을 수는 없겠지만, 시간이 지나면 각 전략의 장단점을 이해하기 시작할 것이고, 몇 가지를 실험해 본 후에는 자신의 목표에 맞는 것을 찾게 될 것입니다.</p>

<blockquote>
  <p>🐦 Hummingbot에서는 <code class="language-plaintext highlighter-rouge">config</code> 명령어를 사용하여 다양한 설정을 여러 가지 방법으로 조합하여 매우 다양한 전략을 구축할 수 있습니다. 순수 마켓 메이킹(pure market making) 참조 가이드를 확인하여 각 매개변수가 무엇에 사용되는지 알아보세요.</p>
</blockquote>

<h2 id="자동화된-트레이딩과-마켓-메이킹">자동화된 트레이딩과 마켓 메이킹</h2>

<p>자, 트레이딩 로봇… 아마 당신이 이 글을 읽는 또 다른 이유일 것입니다. 당신은 단지 마켓 메이커가 되려는 것이 아니라, 모든 힘든 일을 해줄 마켓 메이킹 로봇을 설정하려는 것입니다.</p>

<p>결국, Hummingbot은 자동화된 트레이딩 전략을 시작하고자 하는 모든 사람에게 무료로 제공되는 오픈소스 트레이딩 로봇입니다.</p>

<p>수동으로 마켓 메이킹 작업을 하는 것도 가능하지만, 트레이딩 로봇을 사용하면 전략을 정밀하게 실행할 수 있고, 감정적 요인(탐욕과 공포)을 제거하며, 더 나은 위험 관리를 위한 안전 조치를 만들 수도 있습니다.</p>

<p>하지만 모든 로봇이 똑같이 만들어지지는 않았으며, 어떤 종류의 전략을 사용할 것인지(고빈도, 저빈도, 추세 추종, 그리드, 스트래들, 퀀트… 가능성은 매우 많습니다)에 따라 한 로봇이 다른 로봇보다 더 나은 작업을 수행할 수 있습니다.</p>

<p>결국, 트레이딩 로봇은 도구이며 우리는 작업에 맞는 올바른 도구를 사용해야 합니다.</p>

<p>Hummingbot은 암호화폐 시장을 위한 알고리즘 마켓 메이킹에 훌륭한 선택입니다. 왜냐하면 이러한 종류의 트레이딩 작업에 집중되어 있기 때문입니다.</p>

<p>하지만 어떤 로봇을 사용하든, 항상 기억하는 것이 중요합니다:</p>

<blockquote>
  <p>🐦 트레이딩 작업의 수익성을 정의하는 것은 전략입니다. 알고리즘은 단지 전략을 컴퓨터 명령어로 번역하고 자동화된 방식으로 실행하는 것일 뿐입니다.</p>
</blockquote>

<h2 id="이익과-위험에-대한-간략한-메모">이익과 위험에 대한 간략한 메모</h2>

<font color="red">마켓 메이킹은 위험이 없고 항상 수익성 있는 트레이딩 작업이 아닙니다.</font>

<p>다른 모든 거래 활동과 마찬가지로, 시장의 비효율성을 이용하기 위해 로봇을 실행하는 것은 그 자체의 위험/보상 특성을 가지고 있습니다.</p>

<p>따라서 실제 자금을 사용하기 전에, 이러한 유형의 트레이딩 메커니즘이 무엇인지, 그리고 어떤 종류의 위험에 노출될 것인지를 확실히 이해해야 합니다.</p>

<blockquote>
  <p>🐦 Hummingbot에서는 <code class="language-plaintext highlighter-rouge">paper_trading</code> 명령어를 사용하여 모의 투자 모드(paper trading mode)를 활성화할 수 있습니다. 이를 통해 자본을 위험에 빠뜨릴 필요 없이 실시간 시뮬레이션 환경에서 전략을 테스트할 수 있습니다.</p>
</blockquote>

<h2 id="저희-커뮤니티에-참여하세요">저희 커뮤니티에 참여하세요</h2>

<p>이것은 Hummingbot 아카데미의 첫 번째 글일 뿐이며, 앞으로 마켓 메이킹 및 차익거래와 관련된 다른 주제들, 일부 전략 분석을 포함하여 더 많은 글이 올라올 예정입니다. 우리의 목표는 여러분이 더 나은 마켓 메이커/차익거래자가 되는 방법을 배우도록 돕는 것입니다.</p>

<p>더 배우고 싶다면, 매주 새로운 글이 올라오는 저희 블로그 업데이트를 꼭 팔로우하세요.</p>

<p>다음 글을 기다리는 동안, 저희 디스코드 서버에 참여하는 것을 잊지 마세요. 이곳은 우리 커뮤니티가 마켓 메이킹과 차익거래, 그리고 Hummingbot을 사용하여 트레이딩 전략을 개선할 수 있는 모든 가능한 방법에 대해 이야기하는 곳입니다.</p>

<p>또한, Hummingbot 아카데미에서 다루었으면 하는 특정 주제가 있다면, 디스코드에서 저희 팀에 연락하거나 academy@hummingbot.io로 이메일을 보내주세요.</p>

<p>곧 뵙겠습니다. 모두 수익성 있는 트레이딩 세션이 되시기를 바랍니다!</p>

<details>
<summary><a href="https://hummingbot.org/blog/what-is-market-making/">Show original (English)</a></summary>

![](https://hummingbot.org/blog/what-is-market-making/cover.webp)

# Welcome to Hummingbot Academy!
If you reached this page, there is a high probability that you have been asking one of these questions:

- What is a market maker?
- What do market makers do?
- How can I become a market maker?
- How do I create a market making robot?
- Then you are on the right place!

Here at [Hummingbot](), our goal is to help you learn more about market making and how to use our free open-source robot to implement your own strategy.

## But what is a Market Maker?

&gt; A market maker (MM) is a firm or individual who actively quotes two-sided markets in a security, providing bids and offers (known as asks) along with the market size of each. ([source](https://www.investopedia.com/terms/m/marketmaker.asp))

If the above quote didn't made any sense to you, imagine a pawnshop:

![](https://hummingbot.org/blog/what-is-market-making/pawn.jpg)

Let's say that Susan has an old guitar, doesn't have much time to play anymore, and could use some cash; meanwhile in another part of town, Mike has been learning to play his friend's guitar and now thinks that he is good enough to invest some cash to buy his own, but a brand new one might be too expensive.

Although we have two people that could close a deal, it might be difficult for them to find each other, or even to agree on a reasonable price for that guitar.

This is where the pawn shop enter the picture:

Instead of looking around for someone that wants to buy a guitar, Susan could sell her guitar to the pawnshop, and Mike could go there knowing that he would find one.

The pawnshop owner is providing a service to both Susan and Mike. He offers an easy way to sell/buy what they want (providing liquidity) and a fair price, based on the demand for used guitar in the town (spread reduction).

The pawnshop will be paid for this service by the difference in price he paid to Susan and the price he received from Mike (spread size).

&gt; 💡 A market maker, like a pawnshop owner, provides the same kind of service in financial markets. He provides liquidity and helps to reduce bid-ask spread sizes, taking his profits from the difference between his buy and sell orders (spread).

## How does market making happen in financial markets?¶

A financial market isn't much different from the real economy open markets. Every day, millions of people access some kind of trading platform, looking to close deals among a wide range of assets, including company shares, bonds, oil, gold, contracts, and cryptocurrencies.

But instead of thousands of people gathering in the same place, holding signs and/or screaming for how much they are buying or selling something, financial assets markets use an order book, where all buy and sell offers are aggregated in the same place:

![](https://hummingbot.org/blog/what-is-market-making/order_book.png)

The order book is nothing more than a list of all buy and sell offers (with quantities and prices) available across all market participants.

In the picture above, we can see the BTC/USD pair order book. If someone is looking to buy Bitcoin right now, he/she will have to pay $12,022.230 (the lowest ask price) and there is 0.578 BTC available at that price.

But if someone wants to sell Bitcoin immediately, he/she will have to accept the price of $12,016.32 (the best bid price) for up to 0.016 BTC.

&gt; 💡 The difference between the lowest of offer prices and the highest of demand prices for a good or asset is called spread.

Technically, any person that posts a buy or sell offer on the order book is acting as a market maker, while those who are accepting the prices offered on the order book is called a market taker.

Acting as a market maker is conceptually similar to participating in the market as the "pawnshop owner", creating offers to buy an asset at a low price, and selling it at a higher price as fast as possible and as many times as possible.

&gt; 💡 While the most common trading/investing strategy looks to profit from big price changes, a professional market maker is trying to capitalize on smaller but more consistent price swings between two price levels.

Most traders and investors want to see the market moving like this:

![](https://hummingbot.org/blog/what-is-market-making/graph1.png)

While market makers love to see market prices moving like this:

![](https://hummingbot.org/blog/what-is-market-making/graph2.png)

The price of an asset doesn't change at a constant flow but as waves, and while traders and investors are trying to find out if the sea is moving towards high or low tide, the market maker is watching the smaller waves on the beach.

## Bid-ask spread vs market maker spread

Looking at the state of the order book on the picture we saw earlier, a market maker could post two offers:

- Buy 1 Bitcoin for $12,016.320 (Bid price)
- Sell 1 Bitcoin for $12,022.230 (Ask Price)

When other market participants accept these prices, and a deal happens on both orders, the market maker will have a profit of $5.91 on this transaction.

This is also known as the market Bid-Ask spread, and in this example above, it's the $5.91 profit the market maker received for completing both sides of the operation:

$$ \frac{(12,022.23-12,016.32)}{12,016.32} = 0.049\% $$

Some exchanges even offer a way to visualize the ask-bid spread in real-time (along with the book depth, which is the accumulated size of all orders posted on the order book):

![](https://hummingbot.org/blog/what-is-market-making/chart_depth.png)

But this doesn't mean that a market maker must use always use this exact bid and ask prices.

A market maker must still consider other factors when deciding what is going to be his operational spread, including:

- Market bid-ask spread;
- Transaction costs (including exchange fees and/or transfer fees);
- Trade volume;
- Market volatility;
- Operational costs (electric bills, cloud server costs, etc.);
- Any other costs related to the trading operation.

There is no right or wrong answer to how big or small the market maker spread should be, and in the end, the spread is just a part of the market maker strategy.

&gt; 🐦 You can change your spread percentage on Hummingbot with the commands `config ask_spread` for sell orders and `config bid_spread` for buy orders.

## What goes into a strategy?

Being a profitable market maker isn't only about choosing a spread size, starting to send limit orders to the order book, and then turning around and forgetting about it.

Before starting a market making operation, you must ask yourself some questions:

- Should I keep the spread fixed all the time? Should I change it depending on market conditions?
- What should the size of my orders be?
- What should I do when there is a price trend in the market, or if there is no clear trend?
- How am I going to detect the market direction?
- How long should my orders stay on the book?
- If one side of the operation is filled, should I keep the opposing order until it is filled?
- Do I want to accumulate more of one asset over time, or do I want to always have a 50/50 balance?
- What should I do if there is price spike?
- Should I care about the average buying cost?
- When should I stay out of the market and for what reason, or should I trade all the time?
- What can I lose, and how much am I putting at risk?
- The answers to these questions determine your actions (and reactions) based on the market conditions and will ultimately define your strategy.

A good market making strategy is nothing more than planning ahead on how you will react to market changes.

But before you get scared with all of these questions and give up on market making, here is a tip:

&gt; 💡 Start Small. Don't try to have all the answers to your strategy beforehand, but focus on one parameter at a time, testing and watching what happens in different market situations. Over time, add another parameter and do more testing and watch how all the pieces are working together.

You are not going to find a cookie cutter, ready-to-use, one-size-fits-all and always profitable strategy/parameters just simply lying around, but after some time, you will start to understand the good and the bad of each strategy, and after experimenting with some of them will find one that fits your goals.

&gt; 🐦 On Hummingbot, you can combine different settings in different ways using the `config` command to build a wide variety of strategies. Check out the pure market making reference guide to see what each parameter is used for.

## Automated trading and market making

So, trading robots... That is probably another reason why you are reading this article; you are not just looking to become a market maker, you are looking to setup a market making robot to do all of the hard work.

After all, Hummingbot is an open-source trading robot, available for free to anyone who wants to start an automated trading strategy.

While it is possible to do market making operations manually, a trading robot allows your strategy to be executed in a precise way, remove the emotional factor (greed and fear), and even create safety measures for better risk control.

But not all robots are made equal, and depending on what kind of strategy you are going to use (high-frequency, low-frequency, trend following, grid, straddle, quant... there are a lot of possibilities), one bot might do a better job than others.

After all, a trading robot is a tool and we must use the right tool for the job.

Hummingbot is a great choice for algorithmic market making for the cryptocurrency markets because it is focused on this kind of trading operation.

But no matter what robot you choose to use, it's always important to remember:

&gt; 🐦 What defines the profitability of a trading operation is the strategy. The algorithm is only the strategy translated into computer instructions and executed in an automated way.

## A quick note on profit and risk
Market making is not a risk-free, always profitable trading operation.

Like any other trade activity, running a robot to capitalize on market imperfections comes with its own set of risk/reward features.

Therefore, before you start using real funds, make sure that you understand what the mechanics of this type of trading are and what kind of risks you will be exposing yourself to.

&gt; 🐦 With Hummingbot you can enable the paper trading mode using the command paper_trading, which allows you to test your strategy in a real-time simulated environment, without the need to put your capital at risk.

## Join our community

This is only the first article of the Hummingbot Academy and there are a lot more articles to come where we will talk about other topics related to market making and arbitrage trading, including some strategy analysis. Our objective is to help you learn how to become a better market maker/arbitrageur.

If you want to learn more, make sure to follow our blog updates for new articles every week.

While you wait for the next post, remember to join our Discord server, a place where our community talks about market making and arbitrage, and all the possible ways you can use Hummingbot to improve your trading strategies.

Also, if there is any specific topic you want us to cover on the Hummingbot Academy, contact our team on Discord, or send an email to academy@hummingbot.io.

See you soon, and I wish you all a profitable trading session!

</details>
<p><br /></p>

<p>위 블로그 글이 와닿지 않을 수 있습니다. 그래서 Pure Market Making(PMM)에 대한 조금 더 구체적인 예시를 현재 업비트 호가창으로 보여보겠습니다.</p>

<p><img src="/assets/images/2025-09-18/upbit-orderbook.png" alt="" /></p>

<p>현재 BTCKRW의 호가창 상황은 아래와 같습니다.</p>

<ul>
  <li>매수 최우선호가: 163,007,000원</li>
  <li>매도 최우선호가: 163,085,000원</li>
  <li>스프레드: 78,000원 (약 0.048%)</li>
  <li>중간가격(mid-price): (163,007,000 + 163,085,000) ÷ 2 ≈ 163,046,000원</li>
</ul>

<p>이제 여기에 가정을 해보겠습니다. 매수/매도 스프레드 0.1%와 주문 리프레시 시간 10초 그리고 주문 크기 0.01 BTC 라고 가정해보겠습니다. 이제 각 시간마다 상황을 정리해보면,</p>

<ul>
  <li>t=0: 전략은 중간가격 163,046,000원을 기준으로 계산
    <ul>
      <li>매수 주문: 163,046,000 × (1 - 0.001) ≈ 162,883,000원</li>
      <li>매도 주문: 163,046,000 × (1 + 0.001) ≈ 163,209,000원</li>
      <li>따라서 주문장은:
        <ul>
          <li>매수 주문 0.01 BTC @ 162,883,000원</li>
          <li>매도 주문 0.01 BTC @ 163,209,000원</li>
        </ul>
      </li>
      <li>즉, 기존 최상단 호가보다 약간 아래/위에 나만의 주문을 배치</li>
    </ul>
  </li>
  <li>t=5: 시장에서 누군가 매도 주문을 내서 내 매수 주문(162,883,000원)이 체결됨.
    <ul>
      <li>나는 0.01 BTC를 보유하게 됨. 전략은 다음 틱에서 새로운 매수 주문을 다시 배치하여 균형 유지.</li>
    </ul>
  </li>
  <li>t=10: 전략은 기존 주문을 취소하고 새로 계산
    <ul>
      <li>만약 가격이 변동해 중간가격이 163,200,000원으로 올랐다면
        <ul>
          <li>매수 주문: 163,037,000원</li>
          <li>매도 주문: 163,363,000원</li>
        </ul>
      </li>
      <li>주문이 시장 변화에 맞춰 다시 깔림</li>
    </ul>
  </li>
</ul>

<p>수익은 다음과 같이 정리됩니다.</p>
<ul>
  <li>내가 162,883,000원에 매수한 0.01 BTC를, 이후 누군가가 163,209,000원에 매수(즉 내 매도 주문 체결)하면
    <ul>
      <li>차익 = (163,209,000 - 162,883,000) × 0.01 = 3,260원</li>
      <li>이 작은 차익을 초당 수십·수백 번 반복하면서 수익 확보</li>
    </ul>
  </li>
</ul>

<blockquote>
  <p>정리하면, 지금 매수·매도 호가 차이가 좁은 시장에서도, 마켓메이킹은 중간 가격(mid-price) 기준으로 스프레드를 잡고 반복적으로 주문 갱신을 해서 안정적으로 수익을 쌓는 구조입니다. 그리고 중간 가격을 어떤 기준으로 두느냐에 따라서 성능이 많이 좌우됩니다.</p>
</blockquote>

<p>이러한 PMM의 가장 리스크 중 하나는 바로 한 방향(상승장/하락장)으로 쭉 밀어붙이는 장세일 경우입니다. → <font color="red">재고 리스크(Inventory Risk)</font>는 다음 포스팅에서 조금 더 이야기 해보도록 하겠습니다.</p>

<ul>
  <li>하락장 (계속 가격이 떨어질 때)
    <ul>
      <li>전략은 계속 저가 매수 주문이 체결됨 → BTC 재고(Inventory)가 늘어남.</li>
      <li>하지만 시장 가격이 계속 내려서, 내가 내놓은 매도 주문(조금 높은 가격) 은 체결되지 않음.</li>
      <li>결과적으로 BTC 재고만 쌓이고 평가손실(미실현 손실) 발생.</li>
      <li>예시: 1BTC를 163,000,000원 근처에서 여러 번 나눠 샀는데, 가격이 160,000,000원까지 내려가면 → 평가손실 -3,000,000원. 전략은 틱마다 새로운 매도 주문을 내겠지만, 시장이 안 올라오면 체결이 안 됨.</li>
    </ul>
  </li>
  <li>상승장 (계속 가격이 오를 때)
    <ul>
      <li>전략은 계속 고가 매도 주문이 체결됨 → KRW(현금)는 늘어나지만 BTC 재고가 줄어듦.</li>
      <li>그런데 가격이 계속 올라가면, 내가 판 가격보다 훨씬 더 높은 가격에서 BTC를 다시 사야 할 수 있음.</li>
      <li>결과적으로 기회비용 손실 발생 (BTC를 싸게 판 뒤, 비싸게 다시 사야 하는 상황).</li>
      <li>예시: 0.1BTC를 163,200,000원에 팔았는데, 가격이 165,000,000원까지 올라감. 다시 매수 주문을 갱신하려면 164,800,000원 같은 높은 가격에 매수 주문을 걸어야 해서 불리함.</li>
    </ul>
  </li>
</ul>

<p>이러한 추세장에서 극복하는 방법은 아래와 같이 크게 3가지입니다.</p>

<ul>
  <li><u>인벤토리 스큐(Inventory Skew)</u>
    <ul>
      <li>내가 BTC를 너무 많이 들고 있으면 → 매도 주문 위주로 내고, 매수 주문은 줄임.</li>
      <li>반대로 현금만 남아 있으면 → 매수 주문 위주로 내서 밸런스를 맞춤.</li>
    </ul>
  </li>
  <li><u>스프레드 동적 조정(Dynamic Spread)</u>
    <ul>
      <li>추세가 강하면 스프레드를 넓혀서 리스크를 줄임.</li>
      <li>예: 평소 ±0.1% → 변동성 클 때 ±0.5%</li>
    </ul>
  </li>
  <li><u>헤지(Hedging)</u>
    <ul>
      <li>선물(Futures)이나 다른 거래소를 활용해서 반대 포지션을 잡음.</li>
      <li>예: 업비트에서 현물 마켓메이킹을 하면서, 바이낸스에서 반대 방향 선물 포지션을 잡아 가격 리스크를 줄임.</li>
    </ul>
  </li>
</ul>

<h1 id="참고자료">참고자료</h1>
<ul>
  <li>https://github.com/hummingbot/hummingbot</li>
  <li>https://hummingbot.org/blog/what-is-market-making</li>
  <li><a href="https://arxiv.org/pdf/1903.07222">Market Making under a Weakly Consistent Limit Order Book Model</a></li>
</ul>]]></content><author><name>성민석</name><email>minsuksung@korea.ac.kr</email></author><category term="blog" /><category term="hummingbot" /><category term="market-making" /><category term="algorithm-trading" /><summary type="html"><![CDATA[마켓메이킹이란 무엇인가요?]]></summary></entry><entry><title type="html">Matplotlib에서 한글폰트 설정</title><link href="https://minsuk-sung.github.io/blog/matplotlib-korean/" rel="alternate" type="text/html" title="Matplotlib에서 한글폰트 설정" /><published>2024-03-19T00:00:00+09:00</published><updated>2024-03-19T00:00:00+09:00</updated><id>https://minsuk-sung.github.io/blog/matplotlib-korean</id><content type="html" xml:base="https://minsuk-sung.github.io/blog/matplotlib-korean/"><![CDATA[<h2 id="matplotlib에서-한글-깨짐-현상-해결-방법-windows-colabubuntu">Matplotlib에서 한글 깨짐 현상 해결 방법 (Windows, Colab/Ubuntu)</h2>

<p>데이터 시각화 라이브러리인 <strong>Matplotlib</strong>을 사용하다 보면 한글이 깨져 보이는 현상을 자주 마주하게 됩니다. 매번 해결 방법을 검색하는 번거로움을 덜어드리고자, 운영체제별 설정 방법을 간단하게 정리해 보았습니다.</p>

<h3 id="윈도우windows-환경">윈도우(Windows) 환경</h3>

<p>윈도우 환경에서는 시스템에 기본적으로 설치된 <strong>‘맑은 고딕(Malgun Gothic)’</strong> 폰트를 지정해주면 간단하게 한글을 표시할 수 있습니다.</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="n">plt</span>

<span class="c1"># 폰트를 '맑은 고딕'으로 설정
</span><span class="n">plt</span><span class="p">.</span><span class="n">rc</span><span class="p">(</span><span class="s">'font'</span><span class="p">,</span> <span class="n">family</span><span class="o">=</span><span class="s">'Malgun Gothic'</span><span class="p">)</span>
</code></pre></div></div>

<h3 id="코랩colab-및-우분투ubuntu-환경">코랩(Colab) 및 우분투(Ubuntu) 환경</h3>
<p>구글 코랩과 같은 리눅스(우분투) 기반 환경에는 ‘맑은 고딕’ 폰트가 설치되어 있지 않습니다. 따라서 <strong>나눔폰트(Nanum Fonts)</strong>를 직접 설치하고 Matplotlib의 폰트 캐시를 업데이트해야 합니다.</p>

<p>아래 명령어를 실행하여 나눔폰트를 설치하고, 시스템과 Matplotlib이 폰트를 인식할 수 있도록 캐시를 재생성합니다.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">!</span><span class="nb">sudo </span>apt-get <span class="nb">install</span> <span class="nt">-y</span> fonts-nanum <span class="c"># 나눔글꼴 설치</span>
<span class="o">!</span><span class="nb">sudo </span>fc-cache <span class="nt">-fv</span>  <span class="c"># 폰트 캐시 재생성</span>
<span class="o">!</span><span class="nb">rm</span> ~/.cache/matplotlib <span class="nt">-rf</span> <span class="c"># matplotlib 캐시 삭제</span>
</code></pre></div></div>
<p>🚨 중요: 코랩 환경에서는 위 셀을 실행한 후, 상단 메뉴에서 <strong>‘런타임’ &gt; ‘런타임 다시 시작’</strong>을 클릭하여 세션을 재시작해야 폰트 설정이 정상적으로 반영됩니다.</p>

<p>세션이 다시 시작되었다면, 이제 코드에서 나눔폰트(‘NanumBarunGothic’ 등)를 지정하여 그래프를 그릴 수 있습니다.</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="n">plt</span>

<span class="c1"># 폰트를 '나눔바른고딕'으로 설정
</span><span class="n">plt</span><span class="p">.</span><span class="n">rc</span><span class="p">(</span><span class="s">'font'</span><span class="p">,</span> <span class="n">family</span><span class="o">=</span><span class="s">'NanumBarunGothic'</span><span class="p">)</span> 
</code></pre></div></div>

<p>폰트 설정이 완료되면 아래와 같이 그래프의 제목, 축 레이블 등 모든 요소에 한글이 정상적으로 표시되는 것을 확인할 수 있습니다.</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="n">np</span>
<span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="n">plt</span>

<span class="c1"># 나눔폰트로 설정 (위에서 이미 실행했다면 생략 가능)
</span><span class="n">plt</span><span class="p">.</span><span class="n">rc</span><span class="p">(</span><span class="s">'font'</span><span class="p">,</span> <span class="n">family</span><span class="o">=</span><span class="s">'NanumBarunGothic'</span><span class="p">)</span> 

<span class="c1"># 데이터 및 그래프 생성
</span><span class="n">fig</span> <span class="o">=</span> <span class="n">plt</span><span class="p">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">8</span><span class="p">,</span> <span class="mi">4</span><span class="p">))</span>
<span class="n">ax</span> <span class="o">=</span> <span class="n">plt</span><span class="p">.</span><span class="n">subplot</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="n">ax</span><span class="p">.</span><span class="n">bar</span><span class="p">([</span><span class="s">'가'</span><span class="p">,</span> <span class="s">'나'</span><span class="p">,</span> <span class="s">'다'</span><span class="p">,</span> <span class="s">'라'</span><span class="p">,</span> <span class="s">'마'</span><span class="p">],</span> <span class="n">np</span><span class="p">.</span><span class="n">random</span><span class="p">.</span><span class="n">random</span><span class="p">(</span><span class="mi">5</span><span class="p">))</span>
<span class="n">ax</span><span class="p">.</span><span class="n">grid</span><span class="p">(</span><span class="bp">True</span><span class="p">)</span>

<span class="c1"># 제목 및 축 레이블 설정
</span><span class="n">ax</span><span class="p">.</span><span class="n">set_title</span><span class="p">(</span><span class="s">'나눔고딕으로 작성한 제목입니다.'</span><span class="p">)</span>
<span class="n">ax</span><span class="p">.</span><span class="n">set_xlabel</span><span class="p">(</span><span class="s">'X축'</span><span class="p">)</span>
<span class="n">ax</span><span class="p">.</span><span class="n">set_ylabel</span><span class="p">(</span><span class="s">'Y축'</span><span class="p">)</span>

<span class="n">plt</span><span class="p">.</span><span class="n">show</span><span class="p">()</span>
</code></pre></div></div>

<p><img src="/assets/images/2024-03-19/img1.png" alt="" /></p>]]></content><author><name>성민석</name><email>minsuksung@korea.ac.kr</email></author><category term="blog" /><category term="matplotlib" /><summary type="html"><![CDATA[Matplotlib에서 한글 깨짐 현상 해결 방법 (Windows, Colab/Ubuntu)]]></summary></entry><entry><title type="html">PyTorch 실험 재현성을 위한 Random Seed 고정 방법</title><link href="https://minsuk-sung.github.io/blog/random-seed/" rel="alternate" type="text/html" title="PyTorch 실험 재현성을 위한 Random Seed 고정 방법" /><published>2024-03-07T00:00:00+09:00</published><updated>2024-03-07T00:00:00+09:00</updated><id>https://minsuk-sung.github.io/blog/random-seed</id><content type="html" xml:base="https://minsuk-sung.github.io/blog/random-seed/"><![CDATA[<h2 id="tldr">TL;DR</h2>
<p>실험 재현성을 위해 아래 함수를 코드 상단에 추가하고 실행하세요.</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">random</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="n">np</span>
<span class="kn">import</span> <span class="nn">torch</span>

<span class="k">def</span> <span class="nf">set_random_seed</span><span class="p">(</span><span class="n">seed</span><span class="o">=</span><span class="mi">42</span><span class="p">):</span>
    <span class="s">"""
    실험 재현성을 위해 PyTorch, Numpy, Python 등의 랜덤 시드를 고정합니다.
    
    Args:
        seed (int): 고정할 시드 값
    """</span>
    <span class="n">os</span><span class="p">.</span><span class="n">environ</span><span class="p">[</span><span class="s">"PYTHONHASHSEED"</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">seed</span><span class="p">)</span>
    <span class="n">random</span><span class="p">.</span><span class="n">seed</span><span class="p">(</span><span class="n">seed</span><span class="p">)</span>
    <span class="n">np</span><span class="p">.</span><span class="n">random</span><span class="p">.</span><span class="n">seed</span><span class="p">(</span><span class="n">seed</span><span class="p">)</span>
    <span class="n">torch</span><span class="p">.</span><span class="n">manual_seed</span><span class="p">(</span><span class="n">seed</span><span class="p">)</span>
    <span class="n">torch</span><span class="p">.</span><span class="n">cuda</span><span class="p">.</span><span class="n">manual_seed</span><span class="p">(</span><span class="n">seed</span><span class="p">)</span>
    <span class="n">torch</span><span class="p">.</span><span class="n">cuda</span><span class="p">.</span><span class="n">manual_seed_all</span><span class="p">(</span><span class="n">seed</span><span class="p">)</span>  <span class="c1"># if use multi-GPU
</span>
    <span class="c1"># CuDNN 관련 설정
</span>    <span class="n">torch</span><span class="p">.</span><span class="n">backends</span><span class="p">.</span><span class="n">cudnn</span><span class="p">.</span><span class="n">deterministic</span> <span class="o">=</span> <span class="bp">True</span>
    <span class="n">torch</span><span class="p">.</span><span class="n">backends</span><span class="p">.</span><span class="n">cudnn</span><span class="p">.</span><span class="n">benchmark</span> <span class="o">=</span> <span class="bp">False</span>

<span class="n">set_random_seed</span><span class="p">()</span>
</code></pre></div></div>

<h2 id="코드-상세-설명">코드 상세 설명</h2>
<ul>
  <li><code class="language-plaintext highlighter-rouge">random.seed(seed) &amp; os.environ['PYTHONHASHSEED']</code>: 파이썬 내장 random 모듈과 해시 함수의 무작위성을 제어합니다.</li>
  <li><code class="language-plaintext highlighter-rouge">np.random.seed(seed)</code>: Numpy에서 사용하는 무작위 연산의 결과를 고정합니다. 데이터 전처리 등에 사용될 수 있습니다.</li>
  <li><code class="language-plaintext highlighter-rouge">torch.manual_seed(seed)</code>: PyTorch의 CPU 연산에 대한 시드를 고정합니다.</li>
  <li><code class="language-plaintext highlighter-rouge">torch.cuda.manual_seed(seed)</code>: 현재 사용 중인 GPU 연산에 대한 시드를 고정합니다.</li>
  <li><code class="language-plaintext highlighter-rouge">torch.cuda.manual_seed_all(seed)</code>: 모든 GPU(Multi-GPU 환경)에 대한 시드를 고정합니다.</li>
  <li><code class="language-plaintext highlighter-rouge">torch.backends.cudnn.deterministic = True</code>: CuDNN 라이브러리가 사용하는 비결정적(non-deterministic) 알고리즘을 비활성화하여 결정적(deterministic)인 알고리즘만 사용하도록 합니다.</li>
  <li><code class="language-plaintext highlighter-rouge">torch.backends.cudnn.benchmark = False</code>: 이 값을 True로 설정하면 CuDNN이 내장된 벤치마크를 통해 현재 모델에 가장 적합하고 빠른 알고리즘을 동적으로 찾아줍니다. 하지만 이 과정에서 무작위성이 발생하므로, 재현성을 위해서는 False로 설정해야 합니다. (단, 속도가 저하될 수 있습니다.)</li>
</ul>

<h2 id="사용-시-참고사항">사용 시 참고사항</h2>
<p>💡 Jupyter Notebook이나 Google Colab 환경에서는 스크립트 최상단이나, 모델 학습을 시작하기 직전의 셀에서 이 함수를 실행해주는 것이 가장 확실합니다. 여러 셀에 걸쳐 코드를 실행할 경우, 의도치 않게 시드가 초기화될 수 있기 때문입니다. 가장 좋은 습관은 학습 루프를 실행하기 바로 전에 호출하는 것입니다.</p>]]></content><author><name>성민석</name><email>minsuksung@korea.ac.kr</email></author><category term="blog" /><category term="random_seed" /><category term="pytorch" /><summary type="html"><![CDATA[TL;DR 실험 재현성을 위해 아래 함수를 코드 상단에 추가하고 실행하세요.]]></summary></entry></feed>