Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cross-Exchange Spot Arbitrage Systems (2017–2020)

Two production-era C# trading systems that captured price spreads between cryptocurrency exchanges by routing coins through the blockchain, not by moving fiat across borders.

These are not "Kimchi premium" FX arbitrage tools — moving KRW/USD across borders falls under foreign exchange regulations. These systems use the coin itself as the value-transfer medium: buy on Exchange A, transfer on-chain to Exchange B, sell, repeat. Margins are captured from price discrepancies that exist between exchanges at any given moment.


See It Running (17-minute walkthrough)

Cross-exchange arbitrage system — Korean narration with English auto-translate available

17-minute live demonstration of the predecessor semi-automatic system (Bithumb ↔ Binance). The author enters an amount (e.g. 5M KRW), the system computes net profit for every overlapping coin after fees and transfer costs, sorts the routes, and the operator picks the winner — at which point the system places orders and initiates the on-chain transfer.

Korean narration. YouTube auto-translate to English available (CC → Settings → Auto-translate). What you watch is more important than what you hear — the screen shows order books, profit-sorted route candidates, and live execution.

This semi-automatic system is the starting point for the evolution captured in the two repositories below.


Two Systems, Two Evolutionary Directions

201901_PROJECT 바이낸스_업비트_빗썸
Direction Depth — full automation of one pair Breadth — more exchanges, more analysis
Exchanges Upbit + Binance Bithumb + Upbit + Binance
Pairs monitored 1 2 (Bithumb–Binance, Upbit–Binance)
Trade cycle 16-step autonomous (8 stages × bidirectional) Simplified TRADE_PROCESS
Price analysis Linear regression for momentum
Operational state Live-trading Simulation / research
Lines of code (Form1.cs) 4,947 4,296

The Story Behind the Code

In 2017, spreads between Korean exchanges and overseas exchanges were wide — sometimes 20%+ during the Korean retail boom. Crude, hand-coded scripts captured those spreads at scale. The author's earliest arbitrage program from that period (2017, 5 months) turned 30M KRW into 200M KRW. For the full narrative, see the blog post: Cross-Exchange Arbitrage — When a 3% Margin Accidentally Rode an 8x Bull Run (2017).

The video above shows the semi-automatic system from that era. The operator watches order books, enters a trade size, the system computes profit per coin after all fees, sorts the candidates, and the operator clicks the winner. That manual selection step worked because spreads were wide enough that a few seconds of human latency didn't kill the trade.

By 2019, spreads had compressed to sub-1%. The same hand-clicking approach stopped working — by the time a human reviewed the sorted list and picked the best route, the margin was gone.

These two repositories are the response to that compression. Two parallel attempts to keep the same capture rate under tighter conditions, both removing the human latency in different ways:

  • 201901_PROJECT went vertical: take one exchange pair (Upbit–Binance), automate every single step of the cycle so a human never has to intervene. 16 stages, both directions, 28 REST endpoints implemented directly. No more clicking through sorted lists — the system fires when conditions match.

  • 바이낸스_업비트_빗썸 went horizontal: add a third exchange (Bithumb), monitor two pairs simultaneously, integrate linear regression to time entries on momentum rather than spreads alone. More candidates, sharper entry filter.

The lesson: when free money disappears, system precision has to compensate. Code complexity inverse-correlates with market margin.


Technology Signals (What This Code Demonstrates)

Built without SDK shortcuts where it mattered

  • Bithumb HMAC-SHA512 authentication implemented from scratch (바이낸스_업비트_빗썸/Form1.cs, class XCoinAPI line 4085). No official .NET SDK existed at the time. Hex encoding + Base64 + millisecond-precision nonce, all manual.
  • 28 REST endpoints implemented directly in 201901_PROJECT (Upbit: 15, Binance: 13). Order placement, cancellation, balance lookup, deposit address management, withdrawal tracking, blockchain confirmation polling — all explicit, no SDK abstraction hiding the wire protocol.

Operationally aware

  • API rate limits documented inline (바이낸스_업비트_빗썸/Form1.cs line 18): "Binance: REQUEST_WEIGHT=1,200/min, 20/sec, ORDERS=10/sec, 100,000/day". People who haven't operated production trading systems don't write this comment.
  • JWT + HMAC authentication side-by-side (201901_PROJECT, UPBIT_PRIVATE_REQUEST for Upbit JWT vs. Binance.Net for Binance HMAC). Different exchanges, different auth evolution, both accommodated.
  • WebSocket separation for KRW vs BTC markets (201901_PROJECT, UPBIT_CLIENT and UPBIT_CLIENT_BTC). Korean Won market and BTC-quoted market have different price discovery mechanics; mixing them on a single socket loses information.
  • Tool selection based on data availability (바이낸스_업비트_빗썸): WebSocketSharp for Upbit (real-time), Binance.Net library for Binance (mature SDK), Selenium ChromeDriver for parts of Bithumb that the API didn't expose. Pragmatic, not dogmatic.

Multi-dimensional state tracking

  • 4D order book data structure in 201901_PROJECT: double[Market, AskBid, Coin, Time]. Most retail arbitrage bots track 2D; tracking the time axis of bid/ask per exchange enables linear regression on the order book itself.

Settlement-aware

  • Both systems account for blockchain confirmation times (BTC ~30min, ETH ~5min). Buy → transfer → sell isn't atomic — the price can move during the transfer window. The cycle stages (UPBIT_대기UPBIT_비트UPBIT_구매UPBIT_전송UPBIT_입금UPBIT_비투UPBIT_판매UPBIT_종료) reflect that reality.

Honest Disclaimers

  • Code style: Variable and function names are in Korean (e.g. UPBIT_REQUEST_전체입금주소확인). Production-grade for solo Korean operation; would need translation for global team collaboration.
  • Architecture: Single Form1.cs per project, no concern separation, no test coverage. Defensible for single-developer trading tools (where deployment friction matters more than maintainability), but not modern enterprise pattern.
  • Currency of the codebase: Bithumb API revised its signature scheme in 2021, Binance refined permission scopes — these specific implementations will not run as-is today. The value here is the design judgment, not the runnable code. Treat this as a portfolio snapshot of trading-system engineering, not a clone-and-run kit.
  • Credentials: All API keys, secrets, wallet addresses, and personal identifiers have been replaced with {PLACEHOLDER} tokens. Original keys were retired with the corresponding accounts.

Verifiable Evidence

The code alone proves engineering competence. The following corroborate that the systems actually operated:

  • YouTube demonstration (linked at top): 17-minute walkthrough of the predecessor semi-automatic Bithumb–Binance system. Korean narration. The upload timestamp on YouTube is independent of any local file metadata — it predates the systems in this repo and shows the evolutionary starting point.
  • Bithumb 2017 transaction history: Monthly volume of 30+ billion KRW during peak operation period. Available for verification by serious clients on request (account-level data, screenshot anonymized).
  • Code commit timeline: File modification dates and inline references date the codebases to 2019–2020.

Bittrex (which featured in earlier-generation systems from 2017) shut down in 2023, so direct transaction verification from that exchange is no longer possible. The 2017 Bithumb side records remain.


About the Author

Senior backend engineer based in Korea. Background in systems trading (2012 onward), browser automation, real-time backends, and custodial crypto payment systems. Currently operating a production crypto payment platform (under NDA) using BSC HD wallets, idempotent transaction handling, and row-level concurrency control.

Prefers asynchronous, text-first collaboration. Comfortable with AI-augmented engineering workflow.


Repository Index

About

Cross-exchange spot arbitrage systems (2017-2020). C# WinForms. Bithumb / Upbit / Binance.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages