官方长文典藏 · 案卷 I
推特 Article 编号: 2054154772362809344
《从一小时套利 $550K 到 价值 $1M 的账户被冻结(最终付出$300K解冻)》
【实盘震撼复盘】记录 2026 年 5 月 8 日在链上最大期权交易所 Derive 遭遇做市商极端报价偏离,通过 Portfolio Margin 组合保证金子账户与 Vertical Spread 构建 800 万美元名义敞口,随后遭遇平台以 Chainalysis 黑名单为名手动冻结 100 万美元,最终通过严密数据博弈协商解冻 700K 美元的完整全景纪实。
其实这整件事的本质很简单:当做市商的挂单价格大幅度偏离其他交易所的价格,且用户因此获利时,该不该认定为有效交易。
因为这发生在DEX上,所以如果再升华一下:decentralize到底有多centralize; “not your keys not your coins”,但 your keys 就真的是 your coins 了吗?
本来不打算再说这件事了,但是我觉得既然已经在公开平台上说了这件事,就还是有必要有始有终,让大家都知道发生了什么,不做一个让人讨厌的谜语人。
先给这篇长文定个基调:虽然结果不是最理想的,过程也很难受,但最后的结果还是能接受的。写这篇长文不是为了谴责任何人,不是为了维权,更不是为了流量,就只是想把大家当作朋友,和朋友说清楚到底发生了什么,所以我会非常客观地描述事实。
你可以理解为是对这个平台的避雷,你也可以理解为一个套利的alpha。
1. 哪个平台?
这个交易所是 @DeriveXYZ ,目前最大的链上crypto期权交易平台。
我在derive上持续做套利已经超过半年了,以前没有出现过任何问题。
2. 什么套利?
既然是最大的链上期权交易所,当然做的是期权套利。
期权套利无非就是四种情况:
put-call parity: 假设 at the money,简化的公式就是 C = P + S,只要公式两边不等,就可以套利。
vertical spread: 最简单的期权组合,比如卖一个 ETH 2000 的call,买一个ETH 2100 的call,只要两者的价差超过 100,就是无风险套利
calendar spread:对于不同到期日,同样strike price的期权,只要近期的期权价格高于远期期权,就是稳稳无风险套利
跨所套利:对于同样到期日,同样strike price的期权,只要不同交易所之间有价差,就可以套利。同时,前面提到的三种套利也都可以跨平台执行。
这四种情况大概涵盖了99%的纯期权套利,另外还有可能会有一些变种,或者通过合约/现货的 delta hedging 来做套利。
所以就像我在之前的推特上说的,我只是一个做套利,根据市场上存在的价格,低买高卖,从来没有做过什么市场操纵、虚假挂单、以及任何其他我听都没听说过的手法。我一直重复地提到这点,也是因为当时derive冻结我的账号、要求我配合协商的根据就是指控我违反了这些条款(我会在下文引用原话详细说明)。
3. 发生了什么?
2026年5月8日晚,我收到了我的监控系统的推送,derive上又有套利的机会。因为期权流动性的特殊性,所有期权相关的套利我都是收到推送后人工核实并手动下单。
因为已经在derive上套利已经超过半年了,所以我不紧不慢地开始套利了,并发现这次的利润特别高,每$10,000的notional exposure 大概可以有$550的毛利润(不计算对冲成本和交易手续费)。
以前并不是没有过这样的高收益率,但大多是转瞬即逝,甚至来不及下第二单。其中一个重要原因就是 Derive上每个币种的订单簿深度都很薄,且每次下单吃完订单簿上的挂单后,需要等几分钟后才会增加新的挂单。而这次的套利机会,不仅持续了近一个小时,而且还可以直接通过derive 的RFQ询价系统来下单,避免了需要等待订单簿更新的麻烦。
为了提高资金利用率,最大程度地进行套利,我在这一个小时内除了开仓,还额外做了两件事:
- 建立一个单一币种的 portfolio margin 的子账户,可以提高资金利用率,增加最大开仓。
- 将所有套利仓位都换成vertical spread来降低保证金的使用。
做了这两件事后,我就开始通过Derive的RFQ询价系统开始快速下单,每单大约是$100k的exposure,最终的仓位大约是 $8m notional exposure,也就是说,我一共下了大约80单。
这里介绍一下Derive的RFQ询价系统的操作流程,因为后面和项目方的交流里会考到:
在Derive,你可以直接通过订单簿直接下单;也可以发送一个RFQ订单,设置好期权的到期日、行权价、数量,然后发送一个请求,如果有做市商接单,就会返回给你一个价格给你确认,如果你认为价格没有问题,就可以点击下单完成交易。
在这个过程中,非常重要的一点是,如果你下一个大单,Derive的页面上会出现一个提示,大概意思是“你太大,可以考虑变小,这样仓位容易进入”。
原文:You are requesting a quote for a large size. Consider breaking your request into lots of less than 2000 for better responses.
在这个提示中的建议订单数是会浮动的,在我下单时,提示的订单大小大约是 $100k notional。我很听话,所以,每单都按照提示下了大约$100k。
每一次交易完成后,如果想要再下一单,就需要重新走一遍所有流程:
我:我要买价值 $ xxx,xx 的 XYZ 期权,什么价格
做市商:$xx.xx 一个,包熟,要不要
我:全要了
也就是说,我进行了大约80次交易,每次交易都是我问做市商这个什么价格,做市商提供价格后我下单。(再次敲重点!后面项目方要考)
4.下单过程中的一些波折以及主要的成本
我是做套利的,可以有确定的收益时,绝不赌博,所以不管利润再大,风险再小,我也不能忍受打开风险敞口裸奔。
一开始,就像我在之前提到的那样,我是通过在Derive内部对冲,做一个vertical spread,但是当仓位开到大约 $4.5m notional的时候,发现没有做市商接单对冲的仓位了,而套利的仓位还能继续开。
于是我就去了Binance和Gate两个所去开期权的对冲仓位,因为我在这两个所有足够的保证金,不需要花时间调整资金。然而这两个所的深度也非常差,大约只开了$1m notional 的仓位就没有做市商挂单了,其中很大一部分还是我以远超期权本身价值的价格成交的(做市商可以把这部分钱退我吗?)。
这时候整个仓位到了$5.5m notional,通过期权来对冲的路基本已经走完了,因为套利的机会随时都会过去,所以我也没有考虑转一些资金去其他交易所开仓,直接开了合约仓位来对冲。如果你们现在去看一下k线图,5月8日晚到5月9日凌晨,刚好是一波快速拉升,这也导致我的对冲仓位的亏损抵消了很大一部分利润,因为时间太急,连delta都没有算。
5. Derive 账户被锁
开到大约$8m notional的时候,我的Derive账户突然红了,被风控了,不允许交易。过了一会儿,Derive网页上跳出一个提示:我的钱包在Chainalysis的黑名单上,也不允许提现了。
这个“Chainalysis的黑名单”显然只是Derive曲线救国,利用项目存在的一个路径锁我账户的方法。大概率是后台有一个Chainalysis的黑名单,然后他们手动把我的钱包地址加入了这个黑名单列表,成功将我的账户锁住,我在Derive上不能交易,不能提现。
6. 与项目方的沟通
早上6点多,在telegram的群里与Derive开始沟通,做市商则要求通过另一个匿名加密的渠道沟通。
沟通的关键点其实很简单直接。
与项目方的第一次主要沟通:
说明我的所有交易没有任何问题,全部都是通过你们的RFQ询价系统正常交易。
询问封我号的依据
询问我具体违反了哪一个条款
询问如何/何时可以解封
Derive的第一次回复:
封号依据:
封号是为了调查,调查是因为我们发现你以不合理的价格持续地成交,并骚扰RFQ系统来下单。
原文:The restricting on the account was placed for investigation for making repeated trades at pricing that was clearly erroneous...... repeatedly spamming RFQs attempting to continue trading at these prices
这里这个 ”spamming“ 我翻译成”骚扰“不知道合不合适。
具体违反了哪一个条款:
还在调查中,没有结果,但条款中写明有这些行为是不被允许的:“spoofing, manipulation, fictitious transactions, pre-arranged or non-competitive transactions, and any fraudulent act or scheme to defraud, deceive, trick, or mislead”。
这里就不翻译了,因为我也不懂这里每一个的不法手段到底是啥。
怎么解封:
我们还在调查中,但只要和你的对手方(做市商)谈妥了就可以解封。
部分原文:our hope is this can be resolved between counterparties in a mutually satisfyingly way without further escalation
这是我个人推测:做市商和项目方是一家人,不是自己做市就是有紧密利益关系,且是该币种期权的唯一做市商,因为发生这件事之后直到现在,订单簿上所有的挂单都取消了,只剩下散户零零散散挂的几个单。
与项目方的第二次主要沟通(5小时后):
调查得怎么样了?
有结论了吗?如果有结论了,那么请告知我违反了哪条条款
如果没有结论,什么时候调查才有结论
如果没有结论,调查还要多久?
Derive的回复:
还在调查
有结论了,你违反了我之前提到的那些条款
原文:1. still under review 2. from our view, per my previous message the terms and conditions were violated
我直接就问号脸了,不是还在调查吗?怎么就又已经有结论说我违反条款了呢?
7. 与做市商的沟通:
做市商直接给出了一份直截了当的和解提议:归还 $480k。注:做市商的损失大约在 $500k 左右。
我:不可能,给你 $480k 之后我不仅不赚钱,还有可能因此亏钱。
最后谈谈谈,谈到了 $300k。
8. 花钱消灾
当天的下午3点,三方达成协议,我退还 $300k给做市商,derive 退还手续费,完成交易后我的账户恢复正常。
从我的角度来说,最终的结果不是最理想的,但是是考虑各方面因素后可以接受的。我的目标很简单:快速解决这件事,保留部分利润。
可以用不同的解决方法来拿到更高的利润吗?完全可以,但是有其他的成本:
- 虽然derive锁了我的账户,但我依然可以通过智能合约的交互来强行提款,但整个周期可能在7天左右
- 但即使我提款了,如果derive和做市商想要继续追着我的话,他们依然有方法找到和我的钱包相关联的中心化交易所,然后继续找我的麻烦。(your keys 就真的是 your coins 了吗?)
Derive和做市商应该也松一口气,因为如果我当时强行提款,更麻烦的会是他们,因为钱在我手里。但对我来说,后续可能要花的时间和精力让我觉得还是拿走一部分利润就算了。
在整个沟通过程中,Derive对我比较勉强甚至可笑的指控是:
1. 违反了条款中的“spoofing, manipulation, fictitious transactions, pre-arranged or non-competitive transactions, and any fraudulent act or scheme to defraud, deceive, trick, or mislead”
很明显,我通过RFQ来下单,且每次RFQ都是直接成交,没有用大量取消订单之类的手法(我也不懂,只听说过),不可能违反其中任何一条。
2.指控我“repeatedly spamming RFQs attempting to continue trading at these prices”
我也想一次下 $8m 的订单,一次完成套利啊,但是你们自己提示我“你太大,可以考虑小,这样容易进去”,我乖乖听话,这也是错吗?
另外,我每一次RFQ都是下单成交了,真实交易也能是“spamming”吗?
当然,我也都理解,这些都只是从项目方的角度,在当时必须有的说辞和借口,没必要去纠结他们实际说了什么。
后续
在昨天,我和Derive通了一个电话,从事情发生,到昨天电话沟通,整个过程中我们都是很友好的。
对我来说,在电话沟通中,最重要的是两件事:
1. 他们认定我不是bad actor,不是hacker,不是exploitor。
2. 从我的角度来说,我最关心的是,如果同样的事情以后再发生,会怎么样。
他们的回答大概是:
- 会增加RFQ订单的审核,确保这样错价套利的机会不会再出现
- 会在 terms of service 里增加一个条款,从法理上限制这样的行为
所以,对不起大家,我一己之力堵住了这条套利的路。
官方长文典藏 · 案卷 II
推特 Article 编号: 1987850782318702592 / 1989080425822875648
《2个月,我在 edgeX 撸了一辆帕拉梅拉(上/下篇全景合集)· How I Made $200k with edgeX in 60 Days》
【量化做市教科书】详述 60 天内从 edgeX 获得真实到手 20 万美元利润的全部技术细节:涵盖跨所合约价差套利第一性原理、毫秒级订单簿数据流清洗、麦穗择取动态开平仓算法、10.11暴跌流动性生存测试与华尔街利润兑现哲学。
【上篇:背景、认知转变与 edgeX 生存法则】
Scroll down for the English version.
毫不避讳地说,是的,这是一篇“嘴撸”,但这也是我到目前为止分享过的最硬、技术细节最多的一篇 干货,文中所有的叙述以及技术分享都是 100% 的真实。这篇分享分为“上”和“下”两部分,今天这一部分主要介绍大致的背景,以及 @edgeX_exchange 在各方面所提供的优势;第二篇则会详细分享技术层面的细节。
一。开始
在聊 edgeX 之前,我想先简单聊聊“程序化交易”这件事。
我的启蒙来自一篇 Medium 上的水文。大约十年前,我在纽约早高峰的地铁上刷到一篇文章,标题大概是:
“How I Made a Million Trading Crypto with a Bot.”
我不知道作者有没有真的赚到一百万美元,但那确实是一篇水文——除了模糊介绍了一些背景,还配了一张向右上角延伸的 PnL 图表,几乎没有任何干货。
但那篇文章依然给了我启发:我在金融行业工作,我会写代码,那我为什么从没尝试过程序化交易呢?
于是我试了,不出意料地失败了。工作太忙,我很快就放下了。
现在回头看,失败的原因主要有:
过于急躁,没有系统地学习整个领域;
对领域认知不足,尝试了超出自身能力范围的事;
对自己了解不够,没有找到最适合自己的那个方向。
几年后,在工作中积累了一些相关经验,也对自己有了更清晰的认识,我决定重新开始尝试。这是比起第一次尝试时我获得的一些非常重要的新的认知:
我是一个“缺乏自信” (under confident) 的人,但一个好的 trader 往往需要“过分自信” (over confident);
我以为通过程序化交易能克服“缺乏自信”的短板,但事实是,即使交易完全由程序执行,我仍然难以摆脱对亏损的担心,以及想要手动干预的冲动;
我意识到,加密货币的程序化交易中,有一个极为重要的分支: 套利。
这一次,我试了,而且我成功了,于是开启了套利之路。
二。edgeX
我接触 edgeX 的时间并不早,直到八月底才正式开始在 edgeX 上交易。主要原因是 edgeX 的 API 曾暂停过一段时间,直到八月才重新开放。
拿到 API 白名单的当天,我就立刻开始做程序化跨所价差套利。之所以选择价差套利,是因为这是最简单的程序化套利方式:只需要选定两个交易所,在价差大时开仓、价差小时平仓。交易逻辑不涉及复杂算法,代码结构也很简单,短时间内就能写好并启动。
起初我最担心的是 edgeX 的订单簿流动性和深度——因为这直接决定了套利的可行性、收益率以及空间:
流动性决定套利收益率:当价差出现时,如果订单无法成交,就会错失盈利机会;当流动性充足,每个订单都能及时成交时,资金利用率才能最大化。
订单簿深度决定套利空间:若深度太薄,一个订单的滑点就可能把价差打回;而如果深度足够大,滑点几乎可以忽略。
幸运的是,edgeX 的表现远超预期。
三。天时地利人和
经常有朋友对我说:“要是你早一点在 edgeX 上交易,拿到的积分数量会非常夸张。”
其实也未必。我是一个风险偏好极低的人,不会为了积分去刻意“磨损”,也几乎从不做主动的合约交易。所以,这个“如果”并不存在。
八月底与 edgeX 的相遇,大概就是天时地利人和的结果。
那时,edgeX 的周交易量刚突破 150 亿美元,相比如今每周五百多亿也许不算什么,但对套利来说,这已经足够支撑稳定的流动性。订单簿的深度自七月起就表现优异,因此在前期测试中完全不是担忧点。
两周测试后,套利程序已经可以稳定无间断运行。我也写了一些辅助工具,简单分享如下:
实时监测服务器状况 —— 因为价差套利最怕的就是交易所宕机导致仓位对冲失衡;
实时监控仓位数据 —— 包括数量、金额、清算价等;
记录订单簿变化 —— 便于通过历史数据回测和优化策略;
自建 Telegram 机器人 —— 可快速查看收益、历史交易、仓位情况,并提供应急指令。
一切都非常顺利。
四。危机
最担心的事还是来了。
在 10 月 11 日的暴跌 中,几乎所有的 perp DEX 都受到影响,不是宕机,就是交易无法执行。
幸运的是,edgeX 并没有受到任何影响。即使套利另一侧的服务器宕机,我依然能及时管理 edgeX 上的仓位,避免了损失。
这次暴跌让我更坚定了对 edgeX 的信心,也让我敢于进一步加大资金和仓位。当然,我也重新审视了潜在风险,而 edgeX 恰好在各方面都有优秀的应对:
极端行情下的存取款速度:edgeX 的存取款速度非常快,几乎都是秒到,我个人从未遇到问题。这保证了能在极端行情中及时调整保证金,防止被动清算。
即时的仓位管理:虽然我有 Telegram bot,但它在紧急情况下无法完成所有操作,而 edgeX 的 iOS App 恰好补足了这点,让我可以随时在手机上手动干预。必须强调,edgeX 的移动端使用体验真的非常好。
交易所的稳定性以及对事故的处理:edgeX 的客服一直都做的很好,对社区非常负责。即使在过去曾出现过短暂宕机,他们也为受影响的用户提供了 120% 赔付 —— 这是其他任何交易所都没有做到的。这种积极、负责的态度,很大程度上支撑了我加大资金和仓位的决定。
五。收益
标题并没有夸张,甚至略微保守。我从 edgeX 获得的实际到手收益大约是 20万u,不是积分的潜在价值,而是账户里真实的余额。
收益主要来自两部分:
套利收益 | 约 10 万美元
根据市场波动不同,每天的年化收益在 15%–400% 之间。自八月底以来,平均年化约 90%。随着 edgeX 市场逐渐成熟、活跃,近期年化也在逐步回落。
卖出部分积分的收益 | 约 8 万美元华尔街有句老话:
“Nobody ever got hurt taking some profit.”
我卖出一部分 edgeX 积分,并不是因为不看好,而是出于我极低的风险偏好。当看到大额浮盈时,部分兑现是让我最舒服的选择。
除去已卖出的积分外,我仍持有不少 edgeX 积分,也非常期待它们在未来兑换成百万级空投的那一天。
在这里要特别感谢那三位购买我积分、在单押情况下依然无条件信任我的朋友。即使最终积分的价值达到 1000U/分,我都会如约交付。
此外,还有一小部分收益来自 eLP 金库 和 邀请返佣,但占比不足 10%。
六。最后
价差套利并不复杂,真正的考验在于交易所本身。而 edgeX 恰好满足了所有关键条件:
充足的流动性,确保快速成交;
足够的订单簿深度,提供套利空间;
稳定的服务器,保障订单执行;
便捷的手机 App,应对突发行情;
积极、负责的客服,及时解决问题。
在下篇,我会详细分享技术层面的内容——包括云服务器架构搭建、数据采集与分析、参数调优,以及过程中遇到的各种挑战与解决方案。
下篇链接:
————————————————————————
This article is divided into two parts — “Part I” and “Part II.” Today’s section mainly covers the background story and the advantages that @edgeX_exchange offers from different perspectives. In the part II, I’ll dive into the technical details behind everything.
I. The Beginning
Before talking about edgeX, I’d like to briefly touch on algorithmic trading itself.
My first inspiration came from a random post I read on Medium about ten years ago, during a morning commute on the NYC subway. The title was something like:
“How I Made a Million Trading Crypto with a Bot”
I don’t know if the author really made a million dollars — it was clearly a clickbait article with little substance: a vague background story, a PnL chart pointing upward, and no real content.
Still, it inspired me.
I thought: I work in finance. I can code. Why have I never tried algorithmic trading myself?
So I tried — and, predictably, I failed.
Work was busy, and I soon gave up.
Looking back now, the reasons for failure were simple:
I rushed in without learning the field properly.
I overestimated my abilities and tried things beyond my skill set.
I didn’t understand myself well enough to find the niche that truly fit me.
A few years later, after gaining more experience, I decided to try again — this time better prepared. Here’s what I had learned by then:
I’m a naturally under confident — while a good trader often needs overconfidence.
I hoped algorithmic trading would help me overcome my lack of confidence, but even when everything was automated, I still couldn’t fully shake off the fear of losing money or the impulse to intervene manually.
I discovered one of the most important aspects of crypto algorithmic trading: arbitrage.
This time, I tried again — and this time, I succeeded.
II. edgeX
I didn’t start using edgeX very early — not until late August, actually.
The main reason was that edgeX’s API had been temporarily paused and only reopened in August.
Once I got on the API whitelist at the end of August, I immediately began cross-exchange spread arbitrage.
I chose spread arbitrage because it’s the simplest form of algorithmic trading:
you pick two exchanges, open positions when the spread widens, and close them when it narrows.
The trading logic doesn’t require advanced algorithms, and the code is straightforward enough to get up and running in no time.
At first, my biggest concern was edgeX’s order book liquidity and depth, because these directly determine the profitability and feasibility of arbitrage:
Liquidity determines profitability: when spreads appear, if your orders don’t get filled, you miss profit opportunities. The higher the fill rate, the higher your capital efficiency.
Depth determines arbitrage potential: if the order book is thin, slippage can instantly erase your spread; but with deeper books, slippage becomes negligible.
Fortunately, edgeX exceeded my expectations.
III. Timing, Conditions, and Luck
Friends often tell me, “If only you had started trading on edgeX earlier, you’d have earned an insane amount of points.”
That’s not entirely true. I’m very risk-averse — I don’t deliberately grind for points, nor do I take directional positions. So there’s really no such “if only” for me.
My encounter with edgeX in late August was simply perfect timing.
At that time, edgeX’s weekly trading volume had just surpassed $15 billion — not much compared to the current $60+ billion per week, but enough to ensure the liquidity required for arbitrage.
Order book depth had also been excellent since July, so that was never a concern.
After two weeks of testing, my arbitrage bot was running smoothly 24/7, and I built a few helpful tools along the way:
Real-time server monitoring — since the biggest risk in arbitrage is exchange outages that cause unhedged exposure.
Real-time position tracking — quantities, notional values, liquidation prices, etc.
Order book change logging — to analyze historical data and fine-tune strategies.
A Telegram bot — to quickly check profits, trade history, open positions, and handle emergency commands.
Everything worked perfectly.
IV. Crisis
Then came what I had feared most.
During the October 11 market crash, nearly all perpetual DEXs were affected — either going completely offline or becoming unresponsive.
Fortunately, edgeX stayed fully functional.
Even though the other side of my arbitrage setup went down, I was still able to manage my edgeX positions in time and avoided any losses.
This reliability — stable servers and fast response — gave me even more confidence in edgeX.
I scaled up my capital and position sizes, but also re-evaluated the risks.
And it turned out, edgeX had solid answers for every concern I had:
Deposit and withdrawal speed in extreme markets: edgeX’s deposits and withdrawals are extremely fast — usually near-instant. I’ve never experienced delays, which allows timely margin adjustments and prevents liquidation risks.
Instant position management: While my Telegram bot handles most operations, it can’t do everything during emergencies. The edgeX iOS app perfectly fills that gap — letting me take manual actions anytime. (I have to say, the mobile app is genuinely excellent.)
Losses caused by exchange issues: edgeX’s customer support has always been outstanding. In previous incidents, they even compensated affected users 120%, something I’ve never seen any other exchange do. That proactive attitude completely eliminated my remaining concerns.
V. The Results
My total realized profit from edgeX is around $200,000 USDT — actual cash, not just the notional value of points.
The income mainly comes from two parts:
Arbitrage profits — about $100K
Depending on market volatility, my annualized return ranged from 15% to 400%. From late August until now, the average has been around 90% annualized. As edgeX grows more mature and active, the annualized yield has been gradually decreasing and stabilizing.
Selling points — about $80K
There’s a saying on Wall Street: “Nobody ever got hurt taking some profit.” I sold a portion of my edgeX points not because I was bearish, but because, as I mentioned, I’m very risk-averse. When I see a large unrealized profit in front of me, locking in part of it feels like the most comfortable decision.
Excluding the points I sold, I still hold several thousand edgeX points — and I’m genuinely looking forward to the day they convert into tokens worth seven figures. Special thanks to the three friends who bought my points and trusted me unconditionally. Even if the final airdrop reaches $1000 per point, I’ll deliver exactly as promised.
Additionally, a small portion of my earnings came from eLP vault yield and referral rebates, though these make up less than 10% of the total.
VI. Wrapping Up
Spread arbitrage isn’t complex — most of the challenge lies in the exchange itself.
And edgeX happens to meet all the key requirements:
Sufficient liquidity for instant execution
Deep order books to support arbitrage space
Stable servers ensuring order reliability
A convenient mobile app for fast reactions
Responsive customer support for issue resolution
If you think this article is too high-level, stay tuned for Part II, where I’ll share the technical side — including cloud server architecture, data collection and analysis, parameter tuning, and the many challenges (and solutions) I’ve encountered along the way.
Here's the second part:
【下篇:跨所价差套利算法、订单簿监控与麦穗择取实战】
Scroll down for the English version.
在上一篇,我已经提到,我的大部分利润来自于在 @edgeX_exchange 跨所价差套利。在这里我想再次强调:跨所价差套利不是交易所的 bug,而是只有在交易所做得足够好的情况下才会出现的 feature。只有当一个交易所具备:
足够的流动性
足够的订单簿深度
稳定快速的撮合系统
套利的机会才真正“可被捕捉”。
大家常说币安是宇宙第一所,但事实也是——即使我在多个中心化交易所都有负手续费的做市商账户,币安仍然是我套利交易量最高的交易所。所以,在 edgeX 上套利并不是一个 bug,而是一个 feature。
这篇文章是为各种不同背景的朋友介绍 跨所价差套利。如果你看到我大篇幅地解释一些你觉得非常简单的概念,请谅解。
一、基础策略与本质
虽然“程序化套利”是一个非常广泛的领域,但几乎所有套利的本质都是一样的: 利用短暂的价格偏离,捕捉随后确定性的回归。
我在 edgeX 执行的是 跨所合约价差套利
什么是跨所合约价差套利?
在两个不同交易所之间,寻找同一标的永续合约价格的偏差,同时建立仓位:
A 所:做多
B 所:做空
形成一个 delta ≈ 0 的对冲组合,等价差回归后平仓锁定收益。
实例:
下面的截图中是两个交易所在同一时间 ETH 的订单簿截图,其中左边黑色的是 edgeX,右边白色的是另一交易所,我们暂时称它为 交易所B。
可以看到 edgeX 的买一价为 3178.27,交易所B的卖一价为3177.00,两者的差价为 1.27,那么套利者可以:
- 在 edgeX 做空 ETH
- 在 交易所B 做多 ETH
这样建立一个 对冲组合,整体 Delta ≈ 0,不吃价格的方向性风险。当两个交易所的价格靠近,比如下面这种情况,价差变为 0.1:
| edgeX | 3170.10 |
| 交易所B | 3170.00 |
如果这时候平仓,你就赚了这 合约价差的缩小部分,也就是1.27 - 0.1 = 1.17。
二、如何找到价差?
想找到有效的价差,不仅要看“价差本身”,更要看 价差的变化。
如果 ETH 在两个交易所永远相差 $2,这个价差没有套利价值。但如果有时相差 $2,有时相差 $1,那么在 $2 时开仓、$1 时平仓,就能赚确定性价差回归。
比如下面的这张图,通过可视化历史价差数据可以很清楚的看到这两个交易所之间价差的波动。
而要做到这些,需要:
1. 写代码实时监控订单簿(不是K线)
K线每秒一次的数据远远不够。
价差套利一定要监控订单簿的 每次 变化,并持续记录、分析、清洗数据。几乎没有交易所会提供订单簿的历史数据,因此,你需要写代码监控各个交易所的订单簿并花一定的时间来记录并导出数据。导出数据时的格式也非常重要,需要考虑到后期的数据分析,以及各个交易所数据之间的拼接。
2. 合约的底层资产必须完全一致
价差的来源有很多,比如流动性、交易结构差异、合约费率、用户结构不同,等等。在做价差套利时,底层资产一定要相同。比如有些交易所用的是USDT,而有些交易所是用USDC,这种情况下,你看到的价差也许只是 USDT 和 USDC 的价差,而不是跨所的价差。
三、什么时候开仓?什么时候平仓?(最能区分策略水平的维度)
我们知道,“价差大的时候”该开仓,“价差收敛的时候该平仓”,但多少是“大”,怎么样有算是“收敛”了呢?
其实 开仓/平仓 的决策逻辑,非常像“麦穗择取问题”:
有有限的资金
只能看到当前,不知道未来
必须实时决策
一旦开仓后,又开始新一轮择时:何时平仓?
更复杂的是,价差套利比起麦穗择取问题多了一个维度:时间。
举例:1 小时赚 1% vs 10 小时赚 2%,前者可能更优,因为 9 个小时里可能再做两次 1%,总收益反而更高。但也有可能后者更优,因为剩余的 9 个小时里可能不再出现套利的机会。
这就是价差套利最难的核心:开仓和平仓的时机。
在设计开仓和平仓算法时,最直接可参考的就是前一步所收集的历史价差数据。除此之外,还可以纳入以下因素来优化决策:
合约费率
价格波动率(短周期与长周期的波动分布)
市场整体趋势
四、怎样保证实际成交价格接近预期?(执行架构的核心)
分为交易策略和基础两部分:
1. 交易策略(挂单 vs 吃单的组合)
挂单便宜但不保证成交,吃单一定成交但会滑点。
常见的三种执行方式:
方式A:先挂单 A 成交 → 立即在 B 吃单
方式B:先挂单 A 成交 → B 尝试挂单 → 若不成交就切换吃单
方式C:A/B 同时挂单 → 若一边成交另一边未成交 → 立刻取消并吃单
这几种不同的成交方式各有利弊,执行的难度也不同。选择使用哪种成交方式,和交易所的这三点的特性息息相关:
- 交易所的流动性:决定了挂单时的成交速度
- 订单簿的深度:决定了吃单时的滑点
- 交易手续费:决定了策略的行为,吃单/挂单
以 edgeX 为例,
edgeX 的流动性非常好,这一点我相信用过我的对冲脚本的朋友都有体会,比起其他交易所,在edgeX 挂在盘口的订单更容易也更快成交。
edgeX 的订单簿深度非常好,btc和eth的深度可以说是整个市场里最好的,这也是edgeX团队一直在关注的一个重点。
edgeX 的挂单交易手续在所有交易所中是偏低的,使用我的邀请码再加上10%的反佣后的挂单手续费只有0.009%,且根据交易量拿到更高的vip等级后有更低的手续费率。
因此,edgeX 对于上文提到的三种成交方式都适配,给套利提供了很大的空间和灵活性。
2. 基础设施(如何保证执行稳定)
如果想要认真做程序化套利的,必须使用云服务器来保证低延迟与稳定性。
我在这里推荐使用 日本东京地区的AWS,非常不建议用国内公司的服务器(如阿里云、腾讯云)。原因是绝大多数的交易所的服务器都是在东京,且不少交易所用的就是 AWS,能够保证延迟最低且稳定。对于需要设置colocation的更专业的用户来说,也更加友好。
五、风险与对策
在跨所套利中,风险不可避免,但大部分都可以通过系统化的监控与机制来降低。主要包括以下几类:
1. 代码 Bug 导致的对冲风险敞口
这是所有程序化交易者都躲不开的问题,没有人能保证代码没有 bug。我的应对方式是:
- 每次交易完成后自动检查仓位是否一致
- 如发现异常,立即触发警报 + 人工介入
2. 交易所服务器异常 / 数据错误
例如:实际 BTC 价格是 120000,但 API 却返回 119000,可能会导致程序错开、错平仓。
我的防范措施分两层:
- 监控“预计成交价 vs 实际成交价”的偏离
若连续超出阈值 → 立即暂停程序 + 警报
- 实时计算最近 X 分钟的收益 / 亏损情况
若出现非正常亏损 → 警报 + 人工检查
3. 极端行情下的保证金风险
极端行情时,两边仓位需要快速补保证金,而保证金调拨速度完全依赖交易所体验。
edgeX 在这方面表现得非常好:
- 存取款速度极快,基本都是秒到
- 有手机 App,应急调仓比其他 DEX 方便非常多
这对套利者来说重要性非常高。
4. 云服务器安全风险
尽管绝大多数 API 默认不支持提款,但黑客仍可通过自成交洗单的方式盗走资金。
因此必须做到:
- 启用 IP 白名单
- 只使用密钥登录(禁用密码登录)
只要做好这两点,云服务器被攻破的风险几乎趋近于零。
此外我自己写了一个 telegram bot,能够获取实时信息,实时监控,这对于减少风险也非常有帮助。具体功能有:
1. 每一笔成交的实时推送
2. 查看当前仓位信息,包括账户余额、仓位、价格、清算价格,等等
3. 统计过去 x 小时/天 的收益,收益率,交易量,订单数等等
4. 一键减仓(适用于极端行情时维持保证金)
5. 暂停/开启脚本
六、我的交易架构(实际配置)
套利程序在 AWS 东京区的ec2服务器上运行,所有的数据储存在AWS dynamoDB,用 AWS lambda 自动整理每天的数据,并将每天整理的数据汇总并储存回AWS dynamoDB。我通过telegram获取实时信息或是明天整理统计后的数据。
由于我的资金量相对比较大($七位数),目前用多个账号运行三个不同的开仓和关仓的策略,以此减小下单时对订单簿的压力,避免过大的。
目前程序同时监测多个交易所,在下单时,edgex主要以 maker 单为主,因为我在cex有负费率的做市商账户,所以下单比较灵活。
由于时间和安全的考量,我目前只做btc和eth,如果以后有时间,会慢慢地增加其他交易对。
七、遇到的挑战
唯一的挑战就是:edgeX 的 API rate limit 对高频交易者来说稍微有点紧
如果未来 edgeX 能针对高频用户开放更灵活的限频等级、或提供专用的高速通道,整个策略的上限会被进一步打开。
我也相信以 edgeX 团队的节奏,这块一定迟早会优化。
衷心感谢所有认真阅读完这两篇文章的朋友。欢迎任何的意见、建议、批评、探讨、问题、交流。
English Version
In my previous article, I mentioned that most of my profit came from cross-exchange spread arbitrage on @edgeX_exchange. I want to emphasize this again: cross-exchange arbitrage is not a bug, but a feature—a feature that only appears when a trading venue is doing an extremely good job.
You only get real arbitrage opportunities when an exchange has:
strong liquidity
deep order books
a stable and fast matching engine
Only then can spread opportunities be captured in the first place.
People often call Binance “the No.1 exchange in the universe,” and to be fair—
even though I have maker accounts with negative fees on several centralized exchanges, Binance is still the exchange where I generate the most arbitrage volume. So it is not a bug, but a feature.
This article is written for readers from different backgrounds. If you see me explaining concepts that seem very basic to you, please bear with me.
1. The Core Idea Behind the Strategy
Although “algorithmic arbitrage” covers many different strategies, the essence of almost all arbitrage is the same:
Capture a temporary price deviation, and profit from the subsequent mean reversion.
On edgeX, I primarily execute cross-exchange perpetual futures spread arbitrage.
What is Cross-Exchange Perpetual Futures Spread Arbitrage?
It means identifying price discrepancies of the same perpetual futures contract across two exchanges and opening positions like:
Long on Exchange A
Short on Exchange B
This forms a delta-neutral hedged position, which locks in profit when the price spread converges.
Example
Below is the order book from two exchanges at the same time.
The left (black background) is edgeX.
The right (white) is another exchange—let’s call it Exchange B.
When edgeX shows a best bid at 3178.27, and Exchange B shows a best ask at 3177.00, the spread is 1.27.
An arbitrageur can:
short ETH on edgeX
long ETH on Exchange B
This forms a delta ≈ 0 hedged pair with no directional price risk.
When the spread narrows—for example, to 0.10:
| edgeX | 3170.10 |
| Exchange B | 3170.00 |
The profit is 1.27 – 0.10 = 1.17.
2. How to Find Spread Opportunities?
To find meaningful spreads, you must look not only at the spread itself, but more importantly: the change in the spread.
If the spread between ETH on two exchanges stays at $2 forever, it has no value.
But if sometimes it is $2 and sometimes $1, you can open at $2 and close at $1 to capture deterministic mean reversion.
Visualizing historical spread data makes this very clear.
To do this well, you need to:
1. Monitor order books in real time (not candles)
Candles update once per second—they are completely insufficient.
Spread arbitrage requires monitoring every order book update, storing data, cleaning data, and analyzing the distribution of spread movement.
Most exchanges do not provide historical order book data, so you must record it yourself.
Even the format of the exported data matters a lot for later analysis and cross-exchange stitching.
2. The underlying assets must be fully identical
Spread can arise from:
liquidity differences
fee structures
funding rate differences
user base structure
or simply USDT vs USDC pricing
If one exchange uses USDT and another USDC, the “spread” you see may just be the stablecoin premium, not a real arbitrage opportunity across exchanges.
3. When to Open? When to Close? (The part that truly separates good strategies from average ones)
The logic behind opening and closing positions is very similar to the classic “Secretary Problem” or “Wheat-Stalk Picking Problem”:
Limited capital
You can only see the current “stalk” (current spread)
Must decide in real time
After entering, the clock resets—you must again decide the best time to exit
But spread arbitrage adds another dimension: Time efficiency.
Example:
1% profit in 1 hours
2% profit in 10 hours
The first may be better, because you might capture two more 1% opportunities in the remaining nine hours. But sometimes the second is better, if opportunities don’t reappear.
This is why:
Timing of entry and exit is the single most difficult, and most differentiating factor in spread arbitrage.
When designing these algorithms, I primarily rely on:
historical spread data
fee structure
short/long-term volatility
overall market regime and trend
4. How to Ensure Actual Execution Matches Expected Price? (The core of execution architecture)
This consists of two parts:
trade execution logic and infrastructure stability.
1. Trade execution (maker vs taker combinations)
Maker orders are cheap but uncertain.
Taker orders always fill but with slippage.
Common execution patterns:
Method A: Maker on A → once filled, taker on B
Method B: Maker on A → maker on B → fallback to taker if not filled
Method C: Maker both sides → whichever fills first triggers immediate taker on the other side
Which method performs best depends heavily on:
liquidity
order book depth
fee structure
Why edgeX is especially suitable for arbitrage (based on real usage)
Liquidity is excellent — maker orders fill faster than on most DEXs
Order book depth (BTC/ETH) is among the best across all perp DEXs
Fees are low — with my referral + 10% rebate → maker fee is 0.009%
Matching engine stability is outstanding
Because of these characteristics:
All three execution methods work well on edgeX, making it extremely flexible and friendly for arbitrage systems.
2. Infrastructure (ensuring stable execution)
If you are serious about arbitrage, you must use cloud servers for low latency and reliability.
I strongly recommend AWS Tokyo.
Most exchanges host their matching engines in Tokyo—some even directly on AWS.
5. Risks & How to Mitigate Them
Arbitrage carries unavoidable risks, but most can be controlled with proper systems.
1. Code bugs causing unhedged exposure
No developer can guarantee zero bugs. My solution:
- verify position after every trade
- trigger alerts + manual intervention on mismatch
2. Exchange API errors / incorrect market data
Example: real BTC is 120000 but API returns 119000.
Mitigation:
- monitor deviation between expected vs actual execution price
- monitor rolling PnL over the past X minutes
abnormal loss → alert + pause
3. Margin risk during extreme volatility
During extreme moves, both sides may require additional margin.
edgeX performs exceptionally well here:
- deposits/withdrawals are extremely fast (often instant)
- mobile app makes emergency margin management much easier
This matters a lot for arbitrage.
4. Cloud server security
Even if APIs don’t support withdrawals, attackers can still steal funds via wash-trading/self-trading.
To eliminate this risk:
- enable IP whitelisting
- use key-based login only (no passwords)
Do these two things, and compromise risk is almost zero.
Telegram monitoring bot
I also built a custom TG bot helps reduce risk by providing:
- real-time trade notifications
- real-time account metrics (balance, positions, liquidation price, etc.)
- PnL/ROI/trade count/volume statistics for any time window
- one-click reduce-position during extreme markets
- start/pause scripts
6. My Actual Trading Architecture
execution: AWS Tokyo EC2
database: DynamoDB
daily data processing and reporting: AWS Lambda
notifications: Telegram bot
Because I am trading with 7-figure capital, I run three different open/close algorithms across multiple accounts to reduce slippage and distribute order book impact.
The system monitors multiple exchanges simultaneously.
On edgeX, the majority of my orders are maker.
Currently I only trade BTC & ETH due to time and security considerations. More pairs may be added in the future.
7. Challenges Encountered
The only real challenge is:
edgeX’s API rate limits are a bit tight for high-frequency traders.
If edgeX introduces higher rate limits for active traders, the ceiling for this type of strategy would increase significantly.
With edgeX’s current iteration speed, I’m confident this will eventually be improved.
Thank you sincerely to everyone who read both parts of this series.
I welcome any feedback, questions, critiques, or discussion.