Dubai
Joined November 2013
Ali H. Askar retweeted
Ex-Tower Research HFT trader Annanay Kapila (@annanay) on why hedge funds trade mid-frequency instead of HFT: "Proprietary trading firms who don't have a lot of capital need to achieve a very high return on capital. They tend to do high-frequency trading because they never end up in big positions." "By contrast, hedge funds tend to end up more in mid-frequency trading, because they're not interested in small gains or losses that you can realize on each trade from high-frequency trading." "If I have the ability to put a lot of capital behind my trades and take large positions, then I have the privilege of being able to predict much longer in the horizon." "In that region, where we're trying to predict hours, days, maybe even weeks out into the future, I need to take on bigger positions overall to make it worth my while. I need more capital, and I'll probably achieve lower return on investment." "I'll be able to make more dollars, even if I don't make as much percentage return."
"Greed makes markets." Annanay Kapila (@annanay) spent years as an HFT quant at Flow Traders and Tower Research before founding QFEX (@QFEX), a perpetual futures exchange for equities, commodities & FX. Cambridge Maths. At his last job, the desk traded $10B+ of volume a day, run almost entirely by algorithms. In this lecture, he builds market making from first principles: - The map of systematic trading: prop money vs. other people's money, HFT vs. mid-frequency, and why every strategy lives in one quadrant - Why prop firms can return 50-100% a year while hedge funds can't: HFT never leaves you holding a big position - The order book from scratch: bids, offers, limit orders, and why the first order on a price level gets the trade - No free lunch: how arbitrageurs force every order book to reveal a fair price without anyone trying to - The entire strategy in one line: bid below fair value, offer above it, collect the difference forever - Market making is "time-spreading risk," warehousing positions between a seller who shows up now and a buyer who shows up later - Adverse selection: you're most likely to get filled precisely when your price is most wrong - Why market makers are completely self-serving, and why that's exactly what makes markets work - The competitive race that compresses spreads: greed among market makers means lower costs for everyone else - Thick books vs. thin books, and the vicious loop that keeps illiquid markets illiquid Highlights: (00:45) The systematic trading map: capital vs speed (01:45) Prop firms vs hedge funds: return-on-capital economics (06:29) A message from Onyx (07:55) Where market making sits: high-Sharpe prop HFT (08:55) Fungibility and why exchanges exist (11:00) How a central limit order book actually works (17:40) No free lunch: arbitrage-free pricing in the book (19:55) Theo: reading fair value from the mid (22:45) Who really posts the book (not retail) (24:35) Market making as warehousing risk across time (27:20) Edge: quoting around your fair value (29:45) Queue priority and the adverse selection problem (33:05) How competition compresses the bid-offer spread (37:40) Thick vs thin books: liquidity begets liquidity (43:55) Scaling to $10B a day on algorithms
2
6
1
105
12,937
Ali H. Askar retweeted
ETH Zürich's "Mathematical Foundations for Finance" PDF: metaphor.ethz.ch/x/2021/hs/4…
1
73
1
641
25,190
Ali H. Askar retweeted
如何更快取得 @HyperliquidX 的盤口數據? 在 Hyperliquid 進行跨所套利時,發現部分成交滑點偏高,p90 達 2–8 bp 經查,主因為下單當下所持盤口數據已過時,價格已先行變動,所見仍為數百毫秒前的狀態。伺服器部署於東京,物理距離已盡量縮短,惟官方公共 WebSocket 推送之盤口仍偏慢。以全天生產數據統計: 中位數 236 ms p90 346 ms 約 2% 之幀超過 1 秒才抵達 後續採用 @Quicknode 的 gRPC 盤口推送 p50:236 ms → 176 ms p90:346 ms → 211 ms 超過 1 秒之幀:2.05% → 0.02% 費用方面,Build 方案每月 49 美元,包含 8,000 萬 credits。僅訂閱最佳買賣報價、約 20 個幣種,已完全足夠 若追求更快,可自行成為 Hyperliquid validator,直接自鏈上取得數據,惟每月伺服器成本約 1,000 美元 真正的機會來自結構差異——跨所、跨 DEX、資金費率與定價規則之間的不一致。先找出結構,機會方才存在;速度僅是使既有機會執行得更為乾淨 以每月 49 美元換取約 60 ms 的改善,性價比可接受;更高成本則待結構機會更為明確後再行考慮。因此,QuickNode 對我而言是實用工具,而非 alpha 本身。先尋找結構,再談論速度 (但是我仍然尋找當中....)
3
9
1
222
14,569
Ali H. Askar retweeted
Ex-Tower Research HFT trader Annanay Kapila (@annanay) on why prop firms can make 100% a year and hedge funds can't: "Proprietary trading firms tend to have only their own partners' money. So they tend to be less well capitalized. So they need to achieve a good return on capital." "They tend to run strategies that you can't necessarily put a lot of money behind, but you can make a lot of return from them. So returns on proprietary trading firms can be upwards of 50%, even 100% a year." "You'd struggle to find a hedge fund achieving those kinds of returns. But the point with a hedge fund is they take in a lot of capital. Even if they achieve a modest return on that capital, they still make a lot of money." "Hedge funds ultimately are dealing with clients' money. They have to act within risk constraints that their clients put on them. There needs to be a sales process to get the capital in, and a process for how to return the capital." "With proprietary trading firms, none of those considerations really apply, because ultimately you're trading with your own money."
"Greed makes markets." Annanay Kapila (@annanay) spent years as an HFT quant at Flow Traders and Tower Research before founding QFEX (@QFEX), a perpetual futures exchange for equities, commodities & FX. Cambridge Maths. At his last job, the desk traded $10B+ of volume a day, run almost entirely by algorithms. In this lecture, he builds market making from first principles: - The map of systematic trading: prop money vs. other people's money, HFT vs. mid-frequency, and why every strategy lives in one quadrant - Why prop firms can return 50-100% a year while hedge funds can't: HFT never leaves you holding a big position - The order book from scratch: bids, offers, limit orders, and why the first order on a price level gets the trade - No free lunch: how arbitrageurs force every order book to reveal a fair price without anyone trying to - The entire strategy in one line: bid below fair value, offer above it, collect the difference forever - Market making is "time-spreading risk," warehousing positions between a seller who shows up now and a buyer who shows up later - Adverse selection: you're most likely to get filled precisely when your price is most wrong - Why market makers are completely self-serving, and why that's exactly what makes markets work - The competitive race that compresses spreads: greed among market makers means lower costs for everyone else - Thick books vs. thin books, and the vicious loop that keeps illiquid markets illiquid Highlights: (00:45) The systematic trading map: capital vs speed (01:45) Prop firms vs hedge funds: return-on-capital economics (06:29) A message from Onyx (07:55) Where market making sits: high-Sharpe prop HFT (08:55) Fungibility and why exchanges exist (11:00) How a central limit order book actually works (17:40) No free lunch: arbitrage-free pricing in the book (19:55) Theo: reading fair value from the mid (22:45) Who really posts the book (not retail) (24:35) Market making as warehousing risk across time (27:20) Edge: quoting around your fair value (29:45) Queue priority and the adverse selection problem (33:05) How competition compresses the bid-offer spread (37:40) Thick vs thin books: liquidity begets liquidity (43:55) Scaling to $10B a day on algorithms
5
26
2
390
34,765
Ali H. Askar retweeted
good stuff. i used a similar tactic in 01 to be the first one on the books whenever they got out of (usually unplanned) maintainance. hammer the API to be the first one in the books, and pick off anyone who forgot or couldnt to cancel their orders. gud monies
exchanges deploy too, downtime exist. use that as an edge. 01/ for example recently lighter added a shutdown notice before closing: {"close_in_ms":12943,"type":"shutdown"} then closes with code 1012 "server shutting down". they say within 30s 02/ ok then what ? all sockets got the notice within 13ms of each other. close_in_ms ranged from ~5.3s to ~13.8s, different per socket. every close landed between 10ms before and 4ms after the deadline. data kept flowing until the close think about it. everyone has the same constraints, if you're the first to reconnect, you're basically alone for a few seconds. won't matter in most cases, sure, but during high volatility times this can be a money printer. 03/ works for market data too you can open the new socket while the old one is still draining, so there's no blind window at all. basically you always have to treat venue maintenance as a normal state of your system, not an exception. 04/ edge lies in the p99 when designing hft systems, always think about the worst case, the last quantile, that's where shit ton of money can be printed (or lost) every api/dependency you have can go down, be ready for this
7
1
87
6,075
After almost 10 years of work corporateownershipdata.com now makes available all publicly available ownership records of 7,156 publicly traded firms, not just the S&P 500, including dual-class shares.
13
156
10
737
43,986
Ali H. Askar retweeted
one thing every hft developer should have: a repeatable blueprint of scenarii that you can run on any exchange API to understand its behavior. 01/ list all possible operations think about all the possible edge cases there can be, try sending each operation 3x then 10x, then invert the order of operations. try everything so you can draw as much conclusions as possible on how their ordering/matching engine works. 02/ pipeline it make this easily repeatable, so you can easily run it through any new exchange API you find. every time you find an edge case on any exchange, add it to your blueprint and test it everywhere. many details are hidden out there waiting for you to be found. 03/ run it after every update exchanges update their logic pretty often, don't assume things will always be the way they are. use this as an edge, the faster you catch an internal logic change, the longer you can take advantage of it.
a few more good HFT tricks for you to try out again. not rocket science. just there to nudge you in the right direction. 01/ multiple feeds subscribe to multiple feeds, from different places, with different IPs, multiple times. and deduplicate the output. you never know why one feed or the other can be faster in different conditions. benchmarking when the market is calm has nothing to do with high vol times. even the worst median can be the best p99. yes ultimately you want a private fiber w/ @Avelacom_Corp but until then just compound the feeds you have and make the best usage of em. can already get you pretty far. 02/ always a/b test keep a low risk engine running on the side that serves as a reference for your optimizations. first, well you can still catch some liquidations but more importantly bugs early on and actually see your improvements. more volume, more activity = more messages going through your system, you need to be able to spot where is the bottleneck at all times. 03/ stale data is worse than no data you have to know your data feeds, their edge cases, especially when pricing fair value using multiple sources and layers. each layer should have its own thresholds and protections, an oracle feed you're using for a basis or a weekend mid price should not be treated equally.
1
3
2
101
10,567
Ali H. Askar retweeted
勇闯Perp价差套利第一周,供大家参考: 延迟:(我的服务器在 AWS 东京) @arcus_xyz:挂单 43ms,改价 28ms,撤单 52ms,挂单成交到收到推送 10ms 左右 @Lighter_xyz :357ms,其中 300ms 是 Standard 档固定的吃单延迟,网络往返只有 33ms @entropyIO:540ms 撮合,780ms 收到回执 540ms 里网络只占很小一部分,东京到交易所的往返通常只有几十毫秒。剩下的大部分应该是 Hyperliquid 链上出块、撮合的等待时间 每组 2个号,本金 = 两边账户合计 A 组|Entropy × Lighter RH 运行 4.8 天|本金 $205|交易量 $12,035|平均 OI $404 盈利 +$6.01 B 组|Arcus × Lighter RH(保守) 运行 7 天|本金 $282|交易量 $20,269|平均 OI $699 盈利 +$2.69|积分 1.26 C 组|Arcus × Lighter RH(均衡) 运行 4.8 天|本金 $411|交易量 $47,463|平均 OI $1,361 盈利 +$4.27|积分 1.94 D 组|Arcus × Lighter RH(激进) 运行 2 天|本金 $200|交易量 $31,593|平均 OI $819 盈利 +$1.94|积分 0.87 Arcus × Lighter(B + C + D)合计:本金 $893,交易量 $99,325,盈利 +$8.90,Arcus积分 4.07,Lighter给的积分总共不到0.3😂😂 Arcus积分跟什么有关: OI x 持仓时间、交易量 大约每 1 万刀交易量 0.17 分,每 1000 刀 OI 持仓一天 0.18 分,三组的误差都在 4% 以内。 也就是说,持仓 1000 刀 OI 一整天,差不多相当于刷 1 万刀交易量。 各品种表现:(我只选择了流动性还不错的RWA品种,Crypto只做了ZEC) CRCL 赚得最多,SPCX 滑点最大、SPY滑点最小,只有ZEC是亏得。
31
18
3
252
23,061
Ali H. Askar retweeted
高频基建大致可以分成这几层,从底层硬件一直到上层运维 1. 硬件与网络 机房选址和托管:服务器放在离交易所撮合引擎最近的地方(比如 AWS 东京) 服务器配置:CPU 绑核、关超线程、大页内存、网卡选型 网络:内核旁路(kernel bypass)、多网卡分离行情和下单、专线 2. 时钟与延迟测量 时钟同步(NTP、PTP) 全链路打点:从收到行情到发出订单,每一段花了多少时间 延迟分布统计:看的是 p50、p99,而不是平均值 3. 行情层 连接管理:WS 订阅、断线重连、心跳 解析与归一化:不同交易所格式统一成内部格式 本地订单簿重建:快照加增量、序号断档检测和补数据 数据质量:乱序、重复、丢包、延迟异常的识别 4. 交易接口层(连接层) 交易所适配:每家 API 的差异抽象成统一接口 限频管理:按 API Key 或按 IP 的令牌桶 下单通道:WS 下单、批量下单、撤改单 5. 订单管理(OMS) 订单状态机 成交回报处理与持仓计算 状态对账:本地和交易所的订单、持仓核对 6. 策略引擎 事件驱动框架:行情、成交、定时器事件的调度 低延迟设计:无锁队列、预分配内存、避免 GC 策略和基础设施的接口解耦 7. 风控 事前风控:下单前的仓位、金额、价格偏离检查 实时风控:回撤、库存、敞口监控 熔断与 kill switch:行情异常、延迟超标、交易所故障时停止报价并撤单 8. 数据与研究 行情和成交的全量落盘存储 回放系统:用历史 tick 数据重放 回测与仿真:撮合、队列位置、延迟模型 9. 监控与运维 监控面板:延迟、成交率、PnL、系统资源 告警:分级告警,谁接、多久响应 日志、部署、灰度发布、故障恢复 10. 资金与账户 多交易所、多账户资金调度 费率档位和做市协议管理
36
13
3
131
8,997
Ali H. Askar retweeted
🐘 Introducing Postgres Internals in 3D. 🌟 pgrun.dev/pi Stop reading boring diagrams. Start exploring PostgreSQL. An interactive 3D map to understand how Postgres actually works. 100% free. Built for developers. xitter.cf/alxshp/status/21100494…
Introducing PGSync 🐘 Real-time PostgreSQL replication. FREE. OSS Built in Rust. 🦀 Postgres 16 / 17 / 18. No extensions. No triggers. No complex setup. → snapshot → replicate → stream changes → track WAL → recover from crashes → resume automatically → keep databases in sync ~15 MB RAM during streaming. Built for developers. Built for AI agents. Open source. xitter.cf/alxshp/status/21078790…
25
162
7
1,164
46,770
Before you ship a vibe-coded site, make Opus 5.5 audit it like a performance team. Send 4 subagents across these 20 checks: *Images + fonts* •⁠ ⁠Convert images to WebP/AVIF and size them correctly •⁠ ⁠Use ⁠ next/image ⁠ for large assets •⁠ ⁠Lazy-load below-the-fold media •⁠ ⁠Prioritize the main above-the-fold image •⁠ ⁠Use framework-native font loading •⁠ ⁠Keep fonts limited •⁠ ⁠Remove unused third-party scripts •⁠ ⁠Delay analytics/chat widgets until after load *Frontend* •⁠ ⁠Run a bundle analyzer •⁠ ⁠Replace full-library imports with only what you use •⁠ ⁠Dynamically import heavy charts, editors and maps •⁠ ⁠Fetch homepage data on the server •⁠ ⁠Stream AI responses •⁠ ⁠Use skeletons while loading *Database + APIs* •⁠ ⁠Add indexes for filtered/sorted columns and RLS fields •⁠ ⁠Use ⁠ (select auth.uid()) ⁠ in RLS policies •⁠ ⁠Kill N+1 queries •⁠ ⁠Paginate long lists •⁠ ⁠Cache shared API responses, never user-specific ones •⁠ ⁠Move emails, image processing and reports to background jobs *Servers + network* •⁠ ⁠Keep functions near the database region •⁠ ⁠Use static pages or ISR where possible •⁠ ⁠Parallelize independent API calls •⁠ ⁠Test on low-end Android + slow 4G Then paste this: “Send one subagent per group to check it without editing anything, and note which file each issue is in and which page it affects. Run the database subagent at high effort. Before changing anything, run a production build or preview, then run Lighthouse three times in mobile mode on the homepage and the two or three slowest pages and note the median. Then fix everything yourself from their lists, measure again the same way, and give me the before-and-after numbers. Don’t remove features to gain speed. Ask me before removing dependencies, changing the deploy region, or changing the database.”
21
18
2
400
70,393
Ali H. Askar retweeted
time to talk about pricing in HFT 01/ micro price or mid price? well none, you need a proper filter. mid price and micro price can easily be manipulated, especially during weekends or illiquid markets. what you want, is to filter out the noise from the signal. 1. don't overreact to price movements, wait for confirmations. 2. anchor on the deepest side of the book. 3. the tighter, the closer to the actual mid 02/ kalman filter there is a very good description of it in the book "Algorithmic Trading: Winning Strategies and Their Rationale" not for lead-lag arb or tight quoting. good if you have one fast but noisy source and one slower more reliable source. be careful to align on origin timestamps. rewind, correct, replay. 03/ future contracts rolling xitter.cf/AriPingle/status/20422… outdated alfa, but if you look around closely it's still a good example on how you can print with better pricing models. look at the oracles used by each market, there are lots of innefficiencies or MMs mispricing out there.
Yesterday, Hyperliquid oil perp was paying -300% annualized funding. Onchain infrastructure is telling us something about how commodity markets will work going forward @tradexyz perps use CME front month as the oracle. Front month ~$95, back month ~$87. Oracle rolls over 5 business days, stepping down ~$1.70 per shift The "obvious" trade is to short the perp, hedge on CME, collect the roll. We open-sourced a model to price it w/ a link at end of the 🧵
4
10
119
12,508
Ali H. Askar retweeted
Introducing Anatomy Describe a machine in one line. Claude brings it to life. - Interactive isometric wireframes you can rotate, inspect and explore - WebGL shaders for fire, water, plasma and more - Real 3D motion, with individual parts that rotate and move Install it as an agent skill. Fully open source.
428
1,593
664
18,178
2,654,371
Ali H. Askar retweeted
I need help from my street quants. When I create features, I plot quantiles of the feature value vs forward returns, I often get this kind of results: linear positive relation in the middle, and reversion at the tails of the feature. I added an example, of feature= 10 days returns / 10 days std. the three lines are just the same feature but on 3 terciles of the universe by ADV. In the end, I want to use a linear model so it won’t pickup this behavior. 1. I could use a non-linear model (will probably overfit) 2. I could apply a transform to the feature such that larger values of the features gets lower. 3. I could ignore this issue Still not figured out what the best solution is, any advice ?
18
7
1
221
24,625
Ali H. Askar retweeted
最初通过加密交易所而非传统交易所接触程序化交易的交易员无疑是幸运的。 在IB,你需要为几乎所有实时数据支付费用,股票、大宗、债券等等,各种不同交易所的标的都要收一遍,L1和L2还要拆开来收。少则两三美元一个月,多则一两百刀一个月。如果不交,只能看到延时15分钟的数据。即使交了数据订阅费,你也只能同时订阅3个标的的L2,每3个L2标的实时数据需要一个月30刀。周六数据服务器维护时段你是调不了历史数据的。你的手机端和服务器端都需要维护各自的账号才能不产生登录冲突。所有交易标的的交易权限都要手动开通,有的还要答各种题目。出入金存在相当程度的时延而且基本只能从同名账户出入。 我要是AI Agent我一定会从加密交易所开始我的交易之旅,毕竟我连传统交易所的KYC都过不去。而据我所知AI会在接下来10年内接管一切。
4
2
1
31
3,835
Ali H. Askar retweeted
This is a must read for all aspiring traders/PMs Contrary to clever punditry, risk is both quantitative and qualitative in nature. The physics of money works under a stable regime but the seismic monetary resets, where the big money is, occur by the whims of the human condition
8
56
2
619
37,558
Ali H. Askar retweeted
This is all you need for your next System Design interview. Bookmark these 👇 github.com/liquidslr/system-… pagefy.io/system-design/syst…
6
113
1
646
25,086
Ali H. Askar retweeted
Don’t underestimate how much value you can get from a free blog. I came across a blog by Sergi (the #1 trader on Darwinex) explaining how he evaluates whether a filter actually improves a trading strategy. I used his framework to build a model that systematically evaluates the effectiveness of filters applied to any trading strategy. I’m pretty confident this will become one of the core pillars of my development process going forward. I combined his framework with another concept I learned from Timothy Masters (Monte Carlo Permutation Tests) to develop the full model. There are so many gems like this on Sergi’s website. You just have to dig. Here’s the blog post: sersansistemas.com/filtros-t…
14
52
3
650
41,342
Ali H. Askar retweeted
Daha önce parasını yaklaşık 10 bin katına çıkaran Qullamaggie ile ilgili bir paylaşımım olmuştu. Manuelci arkadaşlardan inek öğrenci modunda detaylı araştırmak isteyen olursa pozisyon büyüklüğü risk ve poz kapatma tarzı ile ilgili oldukça detaylı bir makale var alıntıda. Kabaca özetlersek: her bir tradede çok az miktarı riske atıyor ve poz kapatırken kuralcı davranışlardan daha çok sezgisel hareket ediyor. Detaylar makalede.
The most frequent advice we get on position sizing is a recipe for blowing up our accounts. I looked at how Market Wizard Kristjan Qullamaggie actually sized his positions, to go from $9,000 to $105,000,000 in 10 years
10
65
4,386