Ali H. Askar (@aliaskar92) header
Ali H. Askar (@aliaskar92) profile picture
Dubai
Joined November 2013
Photo by Ali H. Askar (@aliaskar92)Photo by Ali H. Askar (@aliaskar92)Photo by Ali H. Askar (@aliaskar92)Photo by Ali H. Askar (@aliaskar92)Photo by Ali H. Askar (@aliaskar92)Photo by Ali H. Askar (@aliaskar92)Photo by Ali H. Askar (@aliaskar92)Photo by Ali H. Askar (@aliaskar92)Photo by Ali H. Askar (@aliaskar92)Photo by Ali H. Askar (@aliaskar92)
Ali H. Askar retweeted
HFT is a lot about configuration once your trading system is solid 01/ validate at parse, not at runtime - a fallback feed equal to its primary - alias cycles in session schedules - multipliers < 1 - out of range venue params 03/ everything gets a cap you probably have a bunch of ema, spread and vol factors in your config. all should be capped dynamically and validated before any change. let your agents write and validate the change themselves. 04/ no defaults if you have defaults, nobody knows what's live. fail at startup when a required value is missing. 05/ every config param must be useful and documented if you have 5 params that have no impact, they just shouldn't be there. at big firms you literally have people whose job is to update these config files. one param can make a huge difference in your pnl. make it as easy as possible for you (or your agent) to know what actually matters. 06/ session config is a pricing parameter - anchor sessions in the venue's timezone, not yours - model maintenance breaks - holiday calendars per exchange family, not per exchange - staleness grace per source, a leg that ticks seconds apart after the close shouldn't flap your spread - test the weeks where uk and us dst don't match after every config change should start a blast radius analysis for the next hours/days/weeks, what doesn't show up as an issue now can be in 2 days.
one thing every hft dev has to fight: transitions 01/ every transition is a way to lose or win big your fair value changes at every transition, and volume moves: the nyse auctions, after-hours, blue ocean's overnight book 02/ it's not that easy - make sure your slow signals are warmed up in time - widen your quotes preemptively - reduce size - fc*kin timezones and holiday calendars - every feed handler has a hard time at transitions, watch your p99 there - filter outliers too: liquid -> illiquid is where bad prints show up 03/ where the money is - snipe anyone who's mispricing instead of giving free options to arbers. don't be a chicken - funding gets mispriced when the book goes thin: be the one collecting it
3
2
1
85
4,820
Ali H. Askar retweeted
Part 3: Measure once, cut twice: telemetry and Amdahl's law Most people optimise their bot without ever measuring it. It's like trying to lose weight without a scale. The bot from part 2 runs from my laptop in Singapore. It felt slow, and my first instinct was to dive into the Rust decision code and optimise the shit out of it. I was very wrong. It was nowhere near the bottleneck. Then I remembered Kevin Bowers' @jump_firedancer talks at Breakpoint, and measured first. One trip, step by step The bot now timestamps every step from a Binance price update to our new order resting on Bullet, and exports it all to Grafana. Averaged over 5 minutes: 1. Inside Binance: 0.4ms 2. Binance to us: 41.6ms 3. Waiting in our queue: 0.010ms 4. Our code deciding (tick-to-trade): 0.0057ms 5. Order to live on Bullet: 190ms End-to-end: 232ms Amdahl's law Speeding up one part only helps as much as that part's share of the total. Our trading logic is 0.002% of the trip. Make it 99% faster and the whole trip gets about 0.002% faster. Days of work, basically nothing to show for it. That's the whole point of measuring: know where to look before you spend your time, or Amdahl's Street Justice (as Kevin Bowers likes to call it) gets you. And the numbers already tell us what to fix: • Binance to us (41.6ms) is distance. Part 4 moves the bot next to the exchange. Hint hint, colocation. • Order to live (190ms) is our naive executor. It cancels the old order, waits for Bullet to confirm, then places the new one, and waits on every request. Part 6 fixes that. Two traps when measuring • Use Rust --release builds. Debug builds skip the compiler's optimisations, and made our code look 3-5x slower than it really is. More on squeezing Rust in part 9. • Sync your clocks. Binance to us compares Binance's clock with your laptop's, so if yours is off, the number is off. Mine drifted 433ms behind, so messages arrived before they were sent. That's why end-to-end only uses the exchanges' clocks. Details in the github Now everything is timed and we have a target. Measure first, then fix the biggest number. Tomorrow we move the bot to Tokyo, next to the exchange.
Part 2: Running a simple Rust market maker from your laptop in 5 minutes Today: 2-sided quoting on SOL-PERP Market making 101 The order book has bids (people wanting to buy) and asks (people wanting to sell). The gap between the best bid and best ask is the spread. Depth is how much size sits at each price. See attached image. A market maker rests a bid below fair value and an ask above it, and earns the spread when both get filled. Fill too much on one side and you're holding inventory, so you skew both quotes to lean back toward flat. Get filled right before price moves through you and that's adverse selection, the thing that kills makers. Fair value comes from Binance, where most price discovery happens: the Binance mid plus the average gap between Binance and Bullet. No trustworthy price, no quotes. The design The bot uses the actor model. Every input (a Binance tick, a Bullet book update, a fill, a timer) becomes an event on one queue. The market maker reads one event at a time and answers with intents: place this, cancel that. An executor carries them out and reports back as more events. Why that fits a trading bot: • One writer, no locks. Only the market maker touches its state, so there are no races between a fill and a requote. • Quote on the newest info. If more events are waiting, read them first. Quoting on a price you know is stale is a gift. • Testable. The market maker never touches the network, so its 48 tests run in milliseconds with made-up events. • Dry run is real. Paper trading is just a different executor, so dry run runs the same code as live. • Room to grow. Later parts move feeds and the executor onto their own threads without touching the strategy. It's the same idea LMAX built a famously fast exchange on: a single thread owning the business logic, fed by a queue. Why Rust It's fast, close to C++. The compiler is strict, catching memory bugs (no manual memory mgmt with malloc) and data races before they ever reach production. The cargo crate ecosystem is extensive. And there's no garbage collector. A GC pauses your bot at random (see the orange spikes), and the worst time to pause is mid-move, with stale quotes resting. See the test below, same loop in Go vs Rust on my box: Go's worst tick was ~1ms, Rust's ~0.05ms (chart). That tail is where you get picked off. To be clear, this strat rn has no edge. The defaults are deliberately wide and tiny, and it's slow: every order is synchronously waited on before the next event is read. It also measures no latency numbers yet. Tomorrow we timestamp every hop, spoiler alert, our Rust trading logic won't be the bottleneck.
12
4
1
104
6,217
Ali H. Askar retweeted
How I made $6K PnL in 30 days on $10K principal market making perps ($158m+ volume). The strat was entirely built by me and my quant, Claude (he won a national math competition in China). Last night I asked if you'd want a guide. Hundreds of you said yes, so here it is: HFT for Dummies. The honest timeline when I did it: - Days for basic harness and venue integrations. - Weeks to get it semi-competitive. - Months to really tune and get it properly profitable. This series can hopefully shortcut the learning curve for you. I've been writing trading bots since 2017. It's how I got into crypto (free market data!), and how I met my co-founder. Back then the barrier was high. You had to know how to code, to study data to find alpha, and to grind devops to have systems not blow up in production. Thankfully I taught myself Python and later Rust, but not everyone has a CS degree. Nowadays with LLMs, anyone can have a skilled quant in their pocket. I use it for data analysis, strategy tuning, research and alpha generation and infra optimisation. It's a ridiculous time saver. I'm extremely bullish on one-person quant shops. I think this will be a huge trend this next decade as finance comes on chain and market data and connectivity are accessible to anyone. I've already met many hobbyists who've made a living trading on e.g. Hyperliquid, enough so to quit their day jobs. What we'll be building A delta-neutral, reference-price market maker. Binance is where most price discovery happens. We stream its market data, use it as a reference price, and quote a bid and an ask around it on another venue. I'm using @Bulletxyz because it's the one I know best. Market making is the business of picking up pennies. Mine are under half a basis point per dollar. Enough pennies add up at the scale of millions of volume. The catch is speed. If the market moves and you're slow to update, someone lifts your stale quote and you're the exit liquidity. It's a fun game of algorithmic cat and mouse. On Bullet, takers get a 100ms speed bump. Why? It gives soon-to-be market makers like you a safety buffer so you don't get steamrolled by billion dollar firms with microwave towers. The goal The goal: tick to order sent in under 10ms. Stretch goal: under 1ms, which is very achievable if you're determined. We'll also focus on minimising jitter (randomness) because your slowest orders are the ones that will lose you the most pnl. Agenda: I'll aim to post one topic a day, going from easy wins, and getting progressively more deep in the weeds. If you work at any HFT firm this will all be elementary stuff, but hopefully it's helpful for newcomers. Saving seconds 1. Basic intro to algo-trading (this post) 2. Running a simple market maker from your laptop 3. Measure once, cut twice: telemetry and Amdahl's law 4. AWS: Infra and colocation Saving millis 5. Stop polling: websockets are your friend 6. Optimising order execution 7. How to not get rekt by API rate limits 8. Linux tuning: CPU pinning, IRQs and other nerd stuff Saving micros (diminishing returns, but fun) 9. Optimising the hot path with CPU profiling in Rust 10. AWS: the last mile 11. Bonus: nonces (and other DeFi quirks) I'll try share some open source code along with it. Don't expect to be beating Jump in the orderbooks just yet. It should be a good baseline that you can extend and take it as far as you want (you can take it pretty far!). Tomorrow: setting up a basic MM in Rust, the architecture of which will roughly follow the diagram attached below.
Would people be interested if I wrote up a guide on latency optimization and colocation tricks for perp exchanges?
69
49
8
1,009
115,571
Ali H. Askar retweeted
做HFT算法,你就单线程干到底,多线程解耦对你来说除了满足你的设计感之外,只能给你带来切换开销。 就 @binance 数据的更新频率,热路径上的计算对于CPU来说就是小菜一碟,只要订单发出是异步就行了。 至于perp dex,你签个名就要1ms,更别说节点的内存池还可能给你排序呢,别优化数据链路和计算过程了,专线是真的好啊,好节点是真的贵啊。 有些延迟可以优化,有些延迟只能付费。
10
9
3
265
18,630
Ali H. Askar retweeted
最近在做 perp 跨所套利 (Hyperliquid, Lighter, Binance, Entropy). 下面这些冷知识都是我自己实测出来的 1. VPS 放 AWS 东京, AZ 选az4. LightSail的话选默认的A地区就行了. 因为这里离币安服务器最近. az4 到 Binance 0.3ms, 另外两个区 1.5-1.9ms. HL 和 Lighter 都走 CloudFront. 换 Lightsail AZ C会比A快1ms.. 2. Hyperliquid 行情开 3-4 条连接, 用最先到的消息. (比单条链接快). 具体为啥我也不清楚. 币安数据就没这个问题. 3. HL 撤报价别用 cancel, 用 modify 把单子挪远, 会快一倍.. 4. Lighter 免费账户就够了 5. 美股闭市期间. Binance 上的币股变动都是最先的. 领先 Lighter main 50-200ms, Lighter RH 250-350ms, trade.xyz 450-550ms, Entropy ~800ms 6. 美股盘中 Binance 只落后 Nasdaq 50-60ms. 而正常情况在东京收 Nasdaq 行情最快也要 75ms+. 很明显是一些大的做市商有专线, 连接纽约和东京. 比公网链路快很多. 这个咱们散户没办法..
105
151
21
1,561
156,366
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
3
11
1
195
22,871
Ali H. Askar retweeted
ETH Zürich's "Mathematical Foundations for Finance" PDF: metaphor.ethz.ch/x/2021/hs/4…
86
1
703
29,288
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 本身。先尋找結構,再談論速度 (但是我仍然尋找當中....)
4
11
2
248
16,963
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
388
35,353
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,217
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
157
10
743
45,101
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
102
10,965
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是亏得。
32
19
3
258
23,768
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
132
9,193
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. nitter.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. nitter.cf/alxshp/status/21078790…
25
162
7
1,164
46,999
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,518
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 nitter.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
118
12,582
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.
432
1,593
668
18,196
2,671,259
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
219
24,731