<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Taylor R Price</title>
    <description>The latest articles on DEV Community by Taylor R Price (@trpricesoftware).</description>
    <link>https://dev.to/trpricesoftware</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F273261%2F22dc04bd-bf1c-4a5f-bc69-f200c36667ce.jpg</url>
      <title>DEV Community: Taylor R Price</title>
      <link>https://dev.to/trpricesoftware</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/trpricesoftware"/>
    <language>en</language>
    <item>
      <title>Integrating Crypto Exchanges and Charles Schwab</title>
      <dc:creator>Taylor R Price</dc:creator>
      <pubDate>Tue, 24 Nov 2026 02:13:46 +0000</pubDate>
      <link>https://dev.to/trpricesoftware/integrating-crypto-exchanges-and-charles-schwab-2ed5</link>
      <guid>https://dev.to/trpricesoftware/integrating-crypto-exchanges-and-charles-schwab-2ed5</guid>
      <description>&lt;p&gt;&lt;strong&gt;BLUF&lt;/strong&gt; – Putting two crypto spot exchanges (Binance.US and Kraken), a retail US stock broker (Charles Schwab), and a historical equity feed (Databento) behind one C++23 interface meant stopping every provider quirk at the edge. Inside Kestrel, a strategy never sees &lt;code&gt;BTCUSDT&lt;/code&gt;, &lt;code&gt;XXBTZUSD&lt;/code&gt;, or &lt;code&gt;BRK/B&lt;/code&gt;, and never cares whether it is trading 24/7 crypto or NYSE market hours. Getting there meant taming Kraken’s legacy symbol codes and its HTTP-200 error arrays. It meant surviving Schwab’s 7-day OAuth refresh deadline without restarting a live process, and building a US equity calendar that doesn’t blindly trust a broker’s holiday table. And it meant documenting every place where live API responses disagreed with the official specs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In this post:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One Seam For Market Data and Orders (&lt;code&gt;DataSource&lt;/code&gt;, &lt;code&gt;TradingVenue&lt;/code&gt;, and Normalized Symbols)&lt;/li&gt;
&lt;li&gt;Two Crypto Spot Exchanges, Two Very Different Personalities (Binance.US and Kraken)&lt;/li&gt;
&lt;li&gt;Surviving Charles Schwab’s 7-Day OAuth Refresh Cycle (Without Stopping a Live Run)&lt;/li&gt;
&lt;li&gt;Teaching a 24/7 Engine About US Equity Market Hours&lt;/li&gt;
&lt;li&gt;Where Live Schwab Behavior Disagreed With the Docs (and Why Databento Joined the Lineup)&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the &lt;a href="https://blog.taylorbuiltsolutions.com/introducing-kestrel-stock-crypto-trading-tool/" rel="noopener noreferrer"&gt;first post in this series&lt;/a&gt;, I introduced Kestrel, a C++23 library and CLI tool for pulling stock and crypto market data, backtesting strategies, paper trading, and executing live orders. The full source is on &lt;a href="https://github.com/trprice/kestrel" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; if you want to follow along in the code. In the &lt;a href="https://blog.taylorbuiltsolutions.com/building-with-ai-coding-agents/" rel="noopener noreferrer"&gt;second post&lt;/a&gt;, I covered the multi-model AI workflow and C++ guardrails that kept the codebase clean, and in the &lt;a href="https://blog.taylorbuiltsolutions.com/cpp-under-the-hood-trading-bot/" rel="noopener noreferrer"&gt;third post&lt;/a&gt;, I walked through fixed-point &lt;code&gt;Decimal&lt;/code&gt; math, unknown-outcome order recovery, HTTP session pooling, and TimescaleDB quote batching.&lt;/p&gt;

&lt;p&gt;Today I want to look at the integration boundary itself: what it actually took to make Binance.US, Kraken, and Charles Schwab (plus Databento for historical equity backtests) behave like a single, predictable system.&lt;/p&gt;

&lt;p&gt;As before, nothing here is financial advice. This post is about getting four very different market APIs to speak the same language without shooting your account in the foot.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;One Seam For Market Data and Orders (&lt;code&gt;DataSource&lt;/code&gt;, &lt;code&gt;TradingVenue&lt;/code&gt;, and Normalized Symbols)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The temptation when you integrate your first exchange is to let its vocabulary leak everywhere: passing raw JSON around, assuming markets never close, or baking &lt;code&gt;BTCUSDT&lt;/code&gt; into strategy configs. By the time you add a second crypto exchange and a traditional equity broker, that approach turns every strategy into a pile of &lt;code&gt;if (provider == ...)&lt;/code&gt; branches.&lt;/p&gt;

&lt;p&gt;Kestrel splits market connectivity into two narrow interfaces, wired together in a single place (&lt;code&gt;src/factory.cpp&lt;/code&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;data::DataSource&lt;/code&gt;&lt;/strong&gt; (&lt;code&gt;include/kestrel/data/data_source.hpp&lt;/code&gt;) owns the read side: &lt;code&gt;GetBars&lt;/code&gt;, &lt;code&gt;StreamQuotes&lt;/code&gt;, &lt;code&gt;StreamBars&lt;/code&gt;, &lt;code&gt;GetTrades&lt;/code&gt; (where supported), &lt;code&gt;GetSymbolInfo&lt;/code&gt;, and &lt;code&gt;Hours()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;trading::TradingVenue&lt;/code&gt;&lt;/strong&gt; (&lt;code&gt;include/kestrel/trading/trading_venue.hpp&lt;/code&gt;) owns the write and account side: &lt;code&gt;PlaceOrder&lt;/code&gt;, &lt;code&gt;PlaceOco&lt;/code&gt;, &lt;code&gt;CancelOrder&lt;/code&gt;, &lt;code&gt;CancelAll&lt;/code&gt;, &lt;code&gt;GetOpenOrders&lt;/code&gt;, &lt;code&gt;GetOrder&lt;/code&gt;, &lt;code&gt;GetFills&lt;/code&gt;, &lt;code&gt;GetPositions&lt;/code&gt;, &lt;code&gt;GetBalances&lt;/code&gt;, and &lt;code&gt;StreamExecutions&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because market data and execution are separate interfaces, switching &lt;code&gt;[general] mode&lt;/code&gt; from &lt;code&gt;"live"&lt;/code&gt; to &lt;code&gt;"paper"&lt;/code&gt; doesn’t touch the data source or the strategy. &lt;code&gt;CreateComponents()&lt;/code&gt; still builds the provider’s real &lt;code&gt;DataSource&lt;/code&gt;, and simply swaps the live &lt;code&gt;TradingVenue&lt;/code&gt; for &lt;code&gt;PaperTradingVenue&lt;/code&gt;, which matches orders locally against the live quote stream with configurable fees, slippage, and latency:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Provider (&lt;code&gt;[general] provider&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;Market&lt;/th&gt;
&lt;th&gt;Paper / Import Credentials&lt;/th&gt;
&lt;th&gt;Market Data&lt;/th&gt;
&lt;th&gt;Live Trading Status&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;binanceus&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Crypto spot&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;REST + WebSocket quotes, closed bars, public trades&lt;/td&gt;
&lt;td&gt;Live (&lt;code&gt;run&lt;/code&gt;, &lt;code&gt;order&lt;/code&gt;, &lt;code&gt;cancel&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;kraken&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Crypto spot&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;REST (latest 720 bars) + v2 WebSocket quotes&lt;/td&gt;
&lt;td&gt;Written &amp;amp; read-checked live; &lt;code&gt;run&lt;/code&gt; gated by &lt;code&gt;[kraken] live_trading = true&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;schwab&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;US stocks &amp;amp; ETFs&lt;/td&gt;
&lt;td&gt;App key/secret + OAuth token file&lt;/td&gt;
&lt;td&gt;REST + single-socket &lt;code&gt;SchwabStreamer&lt;/code&gt; + daily bar poller&lt;/td&gt;
&lt;td&gt;Market orders &amp;amp; live &lt;code&gt;run&lt;/code&gt; tested Nov 13, 2026; &lt;code&gt;run&lt;/code&gt; gated by &lt;code&gt;[schwab] live_trading = true&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;databento&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;US stocks &amp;amp; ETFs (historical)&lt;/td&gt;
&lt;td&gt;API key for HTTP import (none for local CSVs or &lt;code&gt;backtest&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Imported into TimescaleDB (&lt;code&gt;kestrel_app databento&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;None (historical import + &lt;code&gt;backtest&lt;/code&gt; only)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Stopping Symbol Quirks At the Edge&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Every provider has its own opinion on what to call an asset (&lt;code&gt;src/data/symbols.cpp&lt;/code&gt;). Inside Kestrel, a crypto pair is always &lt;code&gt;BASE/QUOTE&lt;/code&gt; (&lt;code&gt;BTC/USD&lt;/code&gt;, &lt;code&gt;ZEC/USDT&lt;/code&gt;) and an equity ticker uses a dot for share classes (&lt;code&gt;AAPL&lt;/code&gt;, &lt;code&gt;BRK.B&lt;/code&gt;). Provider classes convert on the way out and normalize on the way back in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Binance.US&lt;/strong&gt; strips the slash (&lt;code&gt;BTCUSDT&lt;/code&gt;). On the way back in, &lt;code&gt;FromBinanceUSSymbol&lt;/code&gt; splits concatenated pairs against a known quote list ordered longest-first so &lt;code&gt;USDT&lt;/code&gt; and &lt;code&gt;USDC&lt;/code&gt; match before &lt;code&gt;USD&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Charles Schwab&lt;/strong&gt; writes equity share classes with a slash (&lt;code&gt;BRK/B&lt;/code&gt; instead of &lt;code&gt;BRK.B&lt;/code&gt;). If you send &lt;code&gt;BRK.B&lt;/code&gt; to Schwab’s &lt;code&gt;/pricehistory&lt;/code&gt;, it doesn’t return an error; it quietly returns zero bars.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kraken&lt;/strong&gt; accepts &lt;code&gt;"BTC/USD"&lt;/code&gt; on outbound calls (&lt;code&gt;ToKrakenSymbol&lt;/code&gt;), so Kestrel sends one clean format everywhere. Kraken’s &lt;em&gt;responses&lt;/em&gt;, however, span three different naming eras at once. Its v2 WebSocket sends &lt;code&gt;"BTC/USD"&lt;/code&gt;, &lt;code&gt;OpenOrders&lt;/code&gt; and &lt;code&gt;QueryOrders&lt;/code&gt; return concatenated aliases like &lt;code&gt;"XBTUSD"&lt;/code&gt; and &lt;code&gt;"XDGUSD"&lt;/code&gt; (Bitcoin as &lt;code&gt;XBT&lt;/code&gt;, Dogecoin as &lt;code&gt;XDG&lt;/code&gt;), and &lt;code&gt;OHLC&lt;/code&gt;, &lt;code&gt;AssetPairs&lt;/code&gt;, &lt;code&gt;BalanceEx&lt;/code&gt;, &lt;code&gt;TradeVolume&lt;/code&gt;, and &lt;code&gt;TradesHistory&lt;/code&gt; still emit legacy 4-letter codes (&lt;code&gt;X&lt;/code&gt; for crypto, &lt;code&gt;Z&lt;/code&gt; for fiat: &lt;code&gt;XXBTZUSD&lt;/code&gt;, &lt;code&gt;ZUSD&lt;/code&gt;, &lt;code&gt;XZEC&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That legacy &lt;code&gt;Z&lt;/code&gt; prefix on Kraken hides a fun trap. If you naively split concatenated symbols by matching &lt;code&gt;"ZUSD"&lt;/code&gt; or &lt;code&gt;"ZEUR"&lt;/code&gt; at the end of a string, you will chop the trailing &lt;code&gt;'Z'&lt;/code&gt; right off Tezos (&lt;code&gt;XTZUSD&lt;/code&gt; becomes &lt;code&gt;XT/USD&lt;/code&gt;) and Chiliz (&lt;code&gt;CHZUSD&lt;/code&gt; becomes &lt;code&gt;CH/USD&lt;/code&gt;). &lt;code&gt;FromKrakenSymbol&lt;/code&gt; explicitly checks 8-character legacy pairs (&lt;code&gt;XXBTZUSD&lt;/code&gt;, &lt;code&gt;USDTZUSD&lt;/code&gt;) against the 17 legacy codes before running longest-first quote suffix matching. On the balance side, &lt;code&gt;FromKrakenAsset&lt;/code&gt; maps &lt;code&gt;XXBT&lt;/code&gt; to &lt;code&gt;BTC&lt;/code&gt; and &lt;code&gt;ZUSD&lt;/code&gt; to &lt;code&gt;USD&lt;/code&gt;, while keeping Kraken Rewards and staking suffixes (like &lt;code&gt;.F&lt;/code&gt; and &lt;code&gt;.S&lt;/code&gt;) distinct so locked yield balances aren’t mistaken for tradable spot coins.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Scoping Safety Layers Between the Strategy and the Venue&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Strategies never talk directly to a &lt;code&gt;TradingVenue&lt;/code&gt;. In &lt;code&gt;Runner&lt;/code&gt;‘s constructor (&lt;code&gt;src/strategy/runner.cpp&lt;/code&gt;), Kestrel wraps the venue in up to three &lt;code&gt;TradingVenue&lt;/code&gt; decorators:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;textStrategy -&amp;gt; OrderTracker -&amp;gt; SessionGatedVenue -&amp;gt; RiskGatedVenue -&amp;gt; Venue
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;OrderTracker&lt;/code&gt; is always present so &lt;code&gt;Runner&lt;/code&gt; can poll active orders. &lt;code&gt;SessionGatedVenue&lt;/code&gt; is inserted whenever a market has closing hours (Schwab and Databento), and &lt;code&gt;RiskGatedVenue&lt;/code&gt; wraps the venue whenever &lt;code&gt;[risk]&lt;/code&gt; is configured (optional in paper mode, mandatory in live &lt;code&gt;run&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Cancels and read calls pass straight through every layer so a strategy can always pull its orders down. On every live venue, &lt;code&gt;GetOpenOrders&lt;/code&gt;, &lt;code&gt;GetFills&lt;/code&gt;, and &lt;code&gt;CancelAll&lt;/code&gt; also filter strictly to the configured &lt;code&gt;[general] symbols&lt;/code&gt;. If you hold a long-term ETF or a manual limit order on another ticker in the same brokerage account, Kestrel’s startup cleanup and kill switch leave it untouched.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Two Crypto Spot Exchanges, Two Very Different Personalities (Binance.US and Kraken)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You might expect two US-accessible crypto spot exchanges to look nearly identical in code. Beyond both running 24/7 (&lt;code&gt;MarketHours::AlwaysOpen()&lt;/code&gt;), almost everything underneath them works differently.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Binance.US: Merged Streams, Schema Drift, and Request-Weight Math&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Unauthenticated market data on Binance.US is straightforward, with a few wrinkles worth handling cleanly (&lt;code&gt;src/data/binanceus_data_source.cpp&lt;/code&gt; and &lt;code&gt;src/data/binanceus_quote_stream.cpp&lt;/code&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Merging top-of-book and trade streams:&lt;/strong&gt; Binance.US’s &lt;code&gt;@bookTicker&lt;/code&gt; WebSocket stream fires on every best-bid/ask change but carries no last-trade price or timestamp. &lt;code&gt;@trade&lt;/code&gt; carries each print and whether the buyer was the maker (&lt;code&gt;"m"&lt;/code&gt;). &lt;code&gt;BinanceUSQuoteStream&lt;/code&gt; subscribes to both on one combined stream URL, and &lt;code&gt;BinanceUSStreamMerger&lt;/code&gt; folds each event into the latest per-symbol state. Every &lt;code&gt;Quote&lt;/code&gt; delivered to &lt;code&gt;Runner&lt;/code&gt; or &lt;code&gt;QuoteWriter&lt;/code&gt; gets the complete picture, including which side took liquidity (on Binance, &lt;code&gt;"m": true&lt;/code&gt; means the buyer was the maker, so the seller was the taker).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filter name drift across listings:&lt;/strong&gt; In &lt;code&gt;exchangeInfo&lt;/code&gt;, older pairs advertise minimum order value under a &lt;code&gt;MIN_NOTIONAL&lt;/code&gt; filter, while newer listings use &lt;code&gt;NOTIONAL&lt;/code&gt;. &lt;code&gt;GetSymbolInfo&lt;/code&gt; checks both.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Paginating public trades (&lt;code&gt;aggTrades&lt;/code&gt;):&lt;/strong&gt; For &lt;code&gt;kestrel_app trades --store&lt;/code&gt;, Binance.US caps time-bounded &lt;code&gt;aggTrades&lt;/code&gt; queries at 1 hour and 1,000 trades, and refuses &lt;code&gt;fromId&lt;/code&gt; if &lt;code&gt;startTime&lt;/code&gt; and &lt;code&gt;endTime&lt;/code&gt; are also present. When a volatile 1-hour window hits 1,000 prints, &lt;code&gt;BinanceUSDataSource::GetTrades&lt;/code&gt; drops the time parameters and pages forward by &lt;code&gt;fromId&lt;/code&gt; until trade timestamps cross the hour boundary, then resumes 1-hour slices.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On the live trading side (&lt;code&gt;BinanceUSTradingVenue&lt;/code&gt;), two operational limits matter most right now:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;order --test&lt;/code&gt; doesn’t check balances:&lt;/strong&gt; &lt;code&gt;POST /api/v3/order/test&lt;/code&gt; validates signatures, symbol filters, tick/lot precision, and price bands, so Kestrel wires it up behind &lt;code&gt;kestrel_app order --test&lt;/code&gt;. Just keep in mind that Binance.US will happily accept a test sell for coins your account doesn’t hold.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Polling fills is expensive in request weight:&lt;/strong&gt; Until Kestrel’s WebSocket user-data stream lands (&lt;code&gt;TODO.md&lt;/code&gt; #3), live runs poll REST for fills and order updates every second. On July 30, 2026, Binance.US raised the weight of &lt;code&gt;GET /api/v3/myTrades&lt;/code&gt; (with a symbol) to &lt;strong&gt;20&lt;/strong&gt; , plus &lt;strong&gt;3&lt;/strong&gt; for &lt;code&gt;openOrders&lt;/code&gt; while an order is active. At 1 Hz, that burns roughly &lt;strong&gt;1,380 weight per minute per symbol&lt;/strong&gt; while orders are working against the conservative &lt;code&gt;2,400/min&lt;/code&gt; cap Kestrel enforces (out of &lt;code&gt;6,000/min&lt;/code&gt; advertised). Single-symbol live runs fit comfortably; multi-symbol live runs would need a longer &lt;code&gt;RunnerOptions::fill_poll_interval&lt;/code&gt; until pushed executions replace polling.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Kraken: HTTP-200 Errors, 720-Bar Caps, and Starter-Tier Budgets&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Kraken (&lt;code&gt;KrakenDataSource&lt;/code&gt;, plus &lt;code&gt;KrakenTradingVenue&lt;/code&gt; written by Gemini 4 Carbon and reviewed by Opus 5.5 in commit &lt;code&gt;99c153f&lt;/code&gt;) has its own set of rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HTTP 200 doesn’t mean the call succeeded:&lt;/strong&gt; Kraken’s REST API routinely returns HTTP &lt;code&gt;200 OK&lt;/code&gt; with &lt;code&gt;{"error": ["EOrder:Insufficient funds"]}&lt;/code&gt; in the JSON body, alongside &lt;code&gt;"W..."&lt;/code&gt; warning strings that aren’t fatal. Every response parser inspects &lt;code&gt;error&lt;/code&gt; first, ignores &lt;code&gt;W&lt;/code&gt; entries, and maps &lt;code&gt;E&lt;/code&gt; prefixes (&lt;code&gt;EAPI:Rate limit&lt;/code&gt;, &lt;code&gt;EOrder:Post only&lt;/code&gt;, &lt;code&gt;EService:Market in ...&lt;/code&gt;, &lt;code&gt;EAPI:Invalid nonce&lt;/code&gt;) into &lt;code&gt;types::ErrorCategory&lt;/code&gt; so &lt;code&gt;util::Retry&lt;/code&gt; and the risk gate react properly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hard 720-bar OHLC history limit:&lt;/strong&gt; Kraken’s public &lt;code&gt;OHLC&lt;/code&gt; endpoint only retains the newest &lt;strong&gt;720 candles&lt;/strong&gt; of any timeframe (12 hours of 1-minute bars, or 30 days of hourly bars). Silently returning 720 bars when a backtest asked for six months would produce garbage results, so &lt;code&gt;KrakenDataSource::GetBars&lt;/code&gt; returns &lt;code&gt;kUnsupported&lt;/code&gt; whenever a full first page starts after the requested &lt;code&gt;start&lt;/code&gt; time. When &lt;code&gt;Runner&lt;/code&gt; warms up a strategy at startup, &lt;code&gt;data::RecentBars&lt;/code&gt; (&lt;code&gt;src/data/recent_bars.cpp&lt;/code&gt;) catches &lt;code&gt;kUnsupported&lt;/code&gt; and binary-searches the lookback span in whole-bar steps to grab as much history as Kraken actually keeps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Signing and strict nonce serialization:&lt;/strong&gt; Private calls to &lt;code&gt;/0/private/*&lt;/code&gt; sign &lt;code&gt;uri_path + SHA-256(nonce + form_body)&lt;/code&gt; with &lt;code&gt;HMAC-SHA512&lt;/code&gt; using the base64-decoded secret. As I noted in the last post, when a Kraken API key’s nonce window is zero, two concurrent threads whose requests cross on the network will trip &lt;code&gt;EAPI:Invalid nonce&lt;/code&gt;. To prevent that, &lt;code&gt;KrakenTradingVenue::SendOnce&lt;/code&gt; holds &lt;code&gt;mSendMutex&lt;/code&gt; across both microsecond nonce generation and &lt;code&gt;mHttp-&amp;gt;Send()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Starter-tier rate budgets:&lt;/strong&gt; Kraken’s Starter tier gives private calls a counter of 15 that decays at just &lt;strong&gt;0.33 points/second&lt;/strong&gt; , and each &lt;code&gt;TradesHistory&lt;/code&gt; call costs &lt;strong&gt;2&lt;/strong&gt;. To stay inside that refill rate, &lt;code&gt;factory.cpp&lt;/code&gt; slows Kraken’s live fill poll to &lt;strong&gt;15 seconds&lt;/strong&gt; and its risk-gate watch to &lt;strong&gt;30 seconds&lt;/strong&gt; (&lt;code&gt;0.20/s&lt;/code&gt; idle, rising to &lt;code&gt;~0.27/s&lt;/code&gt; while an order rests).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;All-or-nothing fill pagination:&lt;/strong&gt; &lt;code&gt;GetFills&lt;/code&gt; pages through &lt;code&gt;TradesHistory&lt;/code&gt; (&lt;code&gt;with_cursor=true&lt;/code&gt;, &lt;code&gt;limit=100&lt;/code&gt;), stepping &lt;code&gt;start&lt;/code&gt; back 1 second so fractional-second timestamps aren’t clipped. If page 2 or later fails or stalls its cursor, &lt;code&gt;GetFills&lt;/code&gt; fails the &lt;em&gt;entire&lt;/em&gt; call rather than returning partial fills. Otherwise, callers would advance their &lt;code&gt;since&lt;/code&gt; cursor to the newest fill on page 1 and permanently skip the unread older pages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Post-only and fee flags:&lt;/strong&gt; Every Kraken order carries &lt;code&gt;oflags=fciq&lt;/code&gt; so fees are charged in the quote currency rather than leaving fractional dust on base-asset sells (as I covered in the &lt;a href="https://blog.taylorbuiltsolutions.com/building-with-ai-coding-agents/" rel="noopener noreferrer"&gt;second post&lt;/a&gt;). For post-only limit orders (&lt;code&gt;oflags=post,fciq&lt;/code&gt;), if &lt;code&gt;AddOrder&lt;/code&gt; rejects synchronously with &lt;code&gt;EOrder:Post only&lt;/code&gt; Kestrel maps it to &lt;code&gt;ErrorCategory::kWouldTake&lt;/code&gt;. More commonly on Kraken, the engine accepts a crossing post-only order with a &lt;code&gt;txid&lt;/code&gt; and immediately cancels it with reason &lt;code&gt;"Post only order"&lt;/code&gt;, which &lt;code&gt;ParseOrder&lt;/code&gt; rewrites to &lt;code&gt;OrderState::kRejected&lt;/code&gt; (delivered via &lt;code&gt;OnOrderUpdate&lt;/code&gt;) on the next poll.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Surviving Charles Schwab’s 7-Day OAuth Refresh Cycle (Without Stopping a Live Run)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Crypto API keys sit quietly in &lt;code&gt;secrets.toml&lt;/code&gt; until you revoke them. Charles Schwab’s individual Trader API uses browser-based OAuth 2.0 across two developer-portal products ( &lt;strong&gt;Market Data Production&lt;/strong&gt; and &lt;strong&gt;Accounts and Trading Production&lt;/strong&gt; ), and even paper trading requires valid OAuth tokens just to fetch bars or open a quote stream.&lt;/p&gt;

&lt;p&gt;Two clocks govern every Schwab session (&lt;code&gt;include/kestrel/data/schwab_auth.hpp&lt;/code&gt; and &lt;code&gt;src/data/schwab_auth.cpp&lt;/code&gt;):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Access tokens last 30 minutes.&lt;/strong&gt; &lt;code&gt;SchwabAuth::AccessToken()&lt;/code&gt; renews them &lt;strong&gt;5 minutes before expiry&lt;/strong&gt; (&lt;code&gt;kRefreshMargin&lt;/code&gt;), serialized under a mutex so concurrent data and trading threads don’t stampede the token endpoint. If a call still gets HTTP &lt;code&gt;401&lt;/code&gt;, &lt;code&gt;SchwabApi::Send&lt;/code&gt; invalidates that token and retries once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Refresh tokens last 7 days, and renewals do not extend them.&lt;/strong&gt; Confirmed on the live API: refreshing an access token keeps the original 7-day countdown from when you logged in via &lt;code&gt;kestrel_app authorize&lt;/code&gt;. Once fewer than 3 days (&lt;code&gt;72 hours&lt;/code&gt;) remain, &lt;code&gt;SchwabAuth&lt;/code&gt; logs an error saying how long is left, and if the login runs out mid-run it logs another (starting up inside the final 24 hours also logs a countdown warning). Because those notices go out as error lines, &lt;code&gt;run&lt;/code&gt; and &lt;code&gt;--store&lt;/code&gt; recorders forward them straight to Discord instead of leaving them buried in a log file. And if you start a command with an expired refresh token, or Schwab refuses a renewal (&lt;code&gt;invalid_grant&lt;/code&gt; or &lt;code&gt;refresh_token_authentication_error&lt;/code&gt;, handled defensively since a revoked token’s exact live body hasn’t been seen yet), Kestrel logs &lt;code&gt;SCHWAB RE-AUTHORIZATION REQUIRED&lt;/code&gt; with the exact command to run.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Side Note:&lt;/strong&gt; One tiny UX snag bites almost everyone the first time they use Schwab’s OAuth flow. After you approve access in the browser, Schwab redirects to your callback URL with a &lt;code&gt;code=&lt;/code&gt; parameter ending in &lt;code&gt;%40&lt;/code&gt; (a URL-encoded &lt;code&gt;@&lt;/code&gt;). Paste that code into a token exchange without percent-decoding it first and Schwab rejects it. &lt;code&gt;SchwabCodeFromRedirect&lt;/code&gt; accepts either the full pasted redirect URL or a bare code and runs &lt;code&gt;PercentDecode&lt;/code&gt; automatically.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Hot-Swapping Tokens While &lt;code&gt;run&lt;/code&gt; Is Live&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The 7-day hard cap created a nasty operational race that showed up during review (fixed in commit &lt;code&gt;21aab88&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Suppose &lt;code&gt;kestrel_app run&lt;/code&gt; is running a multi-day swing strategy. Four days in, you see the 72-hour expiry alert in Discord, open a second terminal, and run &lt;code&gt;kestrel_app authorize&lt;/code&gt; to write fresh 7-day tokens into &lt;code&gt;schwab_tokens.json&lt;/code&gt;. Ten minutes later, the already-running &lt;code&gt;run&lt;/code&gt; process hits its routine 25-minute access-token renewal, refreshes using the &lt;em&gt;old&lt;/em&gt; refresh token it still holds in memory, and writes its renewed token struct back to &lt;code&gt;schwab_tokens.json&lt;/code&gt;. Without coordination, it just overwrote your brand-new 7-day login with one that expires in three days!&lt;/p&gt;

&lt;p&gt;Fixing that cleanly took coordination in both &lt;code&gt;SchwabTokenStore&lt;/code&gt; (&lt;code&gt;src/config/schwab_token_store.cpp&lt;/code&gt;) and &lt;code&gt;SchwabAuth&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Atomic &lt;code&gt;0600&lt;/code&gt; writes with &lt;code&gt;fsync&lt;/code&gt;:&lt;/strong&gt; &lt;code&gt;WriteTokens&lt;/code&gt; never writes to the token file in place. It creates &lt;code&gt;&amp;lt;file&amp;gt;.tmp.&amp;lt;pid&amp;gt;.&amp;lt;counter&amp;gt;&lt;/code&gt; with mode &lt;code&gt;0600&lt;/code&gt; (&lt;code&gt;O_CREAT | O_EXCL&lt;/code&gt;), writes the JSON, &lt;code&gt;fsync&lt;/code&gt;s the file descriptor, atomically &lt;code&gt;rename&lt;/code&gt;s it over the token file, and &lt;code&gt;fsync&lt;/code&gt;s the parent directory. Readers see either the old file or the new one, never a half-written file and never world-readable permissions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Directory-locked &lt;code&gt;SaveUnlessSuperseded&lt;/code&gt;:&lt;/strong&gt; Before saving a routine renewal, &lt;code&gt;SchwabTokenStore::SaveUnlessSuperseded&lt;/code&gt; takes an exclusive &lt;code&gt;flock&lt;/code&gt; on the parent directory (&lt;code&gt;DirectoryLock&lt;/code&gt;, leaving no stray lockfiles behind) and checks what is currently on disk:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;cpptypes&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Result&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;optional&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;SchwabTokens&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;SchwabTokenStore&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;SaveUnlessSuperseded&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;SchwabTokens&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;DirectoryLock&lt;/span&gt; &lt;span class="nf"&gt;lock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mPath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;auto&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;refresh_expires_at&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;refresh_expires_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;optional&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;SchwabTokens&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;move&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;auto&lt;/span&gt; &lt;span class="n"&gt;written&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;WriteTokens&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mPath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;written&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;unexpected&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;written&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;optional&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;SchwabTokens&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Seamless live adoption:&lt;/strong&gt; &lt;code&gt;SchwabAuth&lt;/code&gt; also calls &lt;code&gt;AdoptNewerAuthorization()&lt;/code&gt; &lt;em&gt;before&lt;/em&gt; renewing, and again whenever its in-memory refresh token is expired or refused (even Schwab’s WebSocket streamer waits and reconnects once a fresh token lands on disk). You can run &lt;code&gt;kestrel_app authorize&lt;/code&gt; once a week while &lt;code&gt;run&lt;/code&gt; or &lt;code&gt;stream&lt;/code&gt; stays up without dropping a single position or restarting the process.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On the account side, Schwab’s trading URLs never take raw account numbers; they require an encrypted &lt;code&gt;hashValue&lt;/code&gt; from &lt;code&gt;GET /accounts/accountNumbers&lt;/code&gt;. &lt;code&gt;SchwabTradingVenue::AccountHash()&lt;/code&gt; resolves &lt;code&gt;[schwab] account_number&lt;/code&gt; once, masks account numbers to &lt;code&gt;**** 1234&lt;/code&gt; in every log message, and sets &lt;code&gt;HttpRequest::label&lt;/code&gt; to &lt;code&gt;.../accounts/{account}/orders/{id}&lt;/code&gt; so neither account hashes nor order IDs ever touch logs or the &lt;code&gt;venue_latency&lt;/code&gt; table.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Teaching a 24/7 Engine About US Equity Market Hours&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Crypto strategies can assume the market is open at 03:00 UTC on Sunday. Put a stock strategy on that same assumption and it will try to fire orders into a closed exchange, panic when zero quotes arrive over the weekend, or come up short on warm-up bars when “the last 16 hours” of 30-minute candles spans Sunday night. (&lt;code&gt;data::RecentBars&lt;/code&gt; handles closed gaps at live startup by doubling its lookback window until it collects the full &lt;code&gt;warmup_bars&lt;/code&gt; count, and &lt;code&gt;LoadReplayData&lt;/code&gt; counts a backtest’s warm-up across open sessions rather than calendar days.)&lt;/p&gt;

&lt;p&gt;Rather than sprinkle US equity checks through strategies, &lt;code&gt;DataSource::Hours()&lt;/code&gt; returns a &lt;code&gt;types::MarketHours&lt;/code&gt; (&lt;code&gt;include/kestrel/types/market_hours.hpp&lt;/code&gt; and &lt;code&gt;src/types/market_hours.cpp&lt;/code&gt;). Crypto data sources return &lt;code&gt;MarketHours::AlwaysOpen()&lt;/code&gt;. Schwab and Databento use a two-layer calendar.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Layer 1: Local Rules (&lt;code&gt;UsEquityCalendar&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;UsEquityCalendar&lt;/code&gt; computes NYSE/Nasdaq trading sessions directly using C++20’s &lt;code&gt;std::chrono::locate_zone("America/New_York")&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sessions:&lt;/strong&gt; Regular hours (&lt;code&gt;09:30&lt;/code&gt; to &lt;code&gt;16:00&lt;/code&gt; ET, or &lt;code&gt;13:00&lt;/code&gt; on early closes) and Schwab’s extended hours (&lt;code&gt;07:00&lt;/code&gt; to &lt;code&gt;09:30&lt;/code&gt; pre-market, and regular close to &lt;code&gt;20:00&lt;/code&gt;, or &lt;code&gt;17:00&lt;/code&gt; on early-close days).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Holidays &amp;amp; edge rules:&lt;/strong&gt; Covers weekends and all ten NYSE holidays, including Good Friday (via Meeus’s Gregorian Easter algorithm) and Juneteenth starting in 2022. It handles standard Friday/Monday weekend observance—including NYSE’s quirky rule that when New Year’s Day falls on a Saturday, the Friday before (&lt;code&gt;Dec 31&lt;/code&gt;) stays open. It also encodes &lt;code&gt;13:00&lt;/code&gt; early closes (Black Friday, July 3, and Christmas Eve) and a table of unscheduled NYSE closures since September 11, 2001 (&lt;code&gt;kSpecialClosures&lt;/code&gt;: 9/11, Hurricane Sandy, and national days of mourning through January 9, 2025).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Layer 2: Why &lt;code&gt;SchwabCalendar&lt;/code&gt; Only Lets the Broker &lt;em&gt;Restrict&lt;/em&gt; a Day&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Rules in code can’t know about an unscheduled closure announced tomorrow morning, so &lt;code&gt;SchwabCalendar&lt;/code&gt; (&lt;code&gt;src/data/schwab_data_source.cpp&lt;/code&gt;) cross-checks upcoming dates against Schwab’s &lt;code&gt;GET /markets?markets=equity&amp;amp;date=YYYY-MM-DD&lt;/code&gt; on a background thread (returning &lt;code&gt;UsEquityCalendar&lt;/code&gt;‘s answer immediately so callers never block on HTTP).&lt;/p&gt;

&lt;p&gt;Why not skip &lt;code&gt;UsEquityCalendar&lt;/code&gt; and just trust &lt;code&gt;GET /markets&lt;/code&gt;? Because when I tested &lt;code&gt;GET /markets&lt;/code&gt; against 2027 dates in November 2026, &lt;strong&gt;Schwab reported every single 2027 NYSE holiday as a normal open trading day&lt;/strong&gt;. They populate next year’s holiday schedule late.&lt;/p&gt;

&lt;p&gt;Because of that, &lt;code&gt;SchwabCalendar&lt;/code&gt; treats local rules as the ceiling and only allows Schwab’s API to &lt;em&gt;restrict&lt;/em&gt; a session (close a day, open later, or close earlier):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;cpp&lt;/span&gt;&lt;span class="c1"&gt;// Only dates the rules open are asked about. Schwab can only// restrict them: each time from whichever is more restrictive.const auto rules = mRules.On(date);std::optional&amp;lt;types::TradingDay&amp;gt; chosen;if (*schwab &amp;amp;&amp;amp; rules) { types::TradingDay day{ std::max((*schwab)-&amp;gt;pre_open, rules-&amp;gt;pre_open), std::max((*schwab)-&amp;gt;open, rules-&amp;gt;open), std::min((*schwab)-&amp;gt;close, rules-&amp;gt;close), std::min((*schwab)-&amp;gt;post_close, rules-&amp;gt;post_close)}; if (day.open &amp;lt; day.close) { chosen = day; }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Five Places &lt;code&gt;MarketHours&lt;/code&gt; Quietly Saves You&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Once &lt;code&gt;MarketHours&lt;/code&gt; existed, five different parts of Kestrel plugged into it without changing a line of strategy logic:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Blocking closed-market orders (&lt;code&gt;SessionGatedVenue&lt;/code&gt;):&lt;/strong&gt; Refuses &lt;code&gt;PlaceOrder&lt;/code&gt; and &lt;code&gt;PlaceOco&lt;/code&gt; while the market is closed, naming the exact ISO-8601 timestamp when trading reopens. (&lt;code&gt;PaperTradingVenue&lt;/code&gt; likewise refuses to match quotes while closed.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Session hooks and smart gap backfills (&lt;code&gt;Runner&lt;/code&gt;):&lt;/strong&gt; &lt;code&gt;Runner&lt;/code&gt; delivers &lt;code&gt;OnSessionOpen&lt;/code&gt; and &lt;code&gt;OnSessionClosing&lt;/code&gt; (re-checking &lt;code&gt;RefreshSession&lt;/code&gt; at least once a minute in case &lt;code&gt;SchwabCalendar&lt;/code&gt; learned of a short-notice early close). When a bar arrives after a time gap, &lt;code&gt;HandleBar&lt;/code&gt; checks &lt;code&gt;AnyOpen&lt;/code&gt; across the gap (using regular sessions for daily bars) before calling &lt;code&gt;GetBars&lt;/code&gt;, so Monday’s &lt;code&gt;09:30&lt;/code&gt; open doesn’t trigger a pointless REST backfill across Saturday and Sunday.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filtering streamed bars and off-hours quotes (&lt;code&gt;SchwabDataSource&lt;/code&gt; &amp;amp; &lt;code&gt;Runner&lt;/code&gt;):&lt;/strong&gt; Unless &lt;code&gt;extended_hours&lt;/code&gt; is enabled, &lt;code&gt;SchwabDataSource::StreamBars&lt;/code&gt; drops incoming minute bars outside the regular session (honoring &lt;code&gt;13:00&lt;/code&gt; early closes and holidays automatically), and &lt;code&gt;DailyBarPoller&lt;/code&gt; skips dates with no regular session. On regular-session bar strategies, &lt;code&gt;Runner::Handle&lt;/code&gt; also withholds pre-market and after-hours reference quotes from &lt;code&gt;RiskGatedVenue&lt;/code&gt; so off-hours prints can’t trip a halt at prices the strategy never trades.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Measuring feed silence and late bars in &lt;em&gt;open&lt;/em&gt; time:&lt;/strong&gt; &lt;code&gt;Runner::CheckQuoteFeeds&lt;/code&gt; and &lt;code&gt;data::FeedWatch&lt;/code&gt; measure quiet streams in open-market time (&lt;code&gt;OpenDuration&lt;/code&gt;). The 65.5 hours from Friday &lt;code&gt;16:00&lt;/code&gt; ET to Monday &lt;code&gt;09:30&lt;/code&gt; ET count as &lt;code&gt;0 s&lt;/code&gt; of silence. During an open session, &lt;code&gt;2 minutes&lt;/code&gt; of silence on a single symbol logs a stale-feed warning (and trips &lt;code&gt;[risk] max_quote_age_ms&lt;/code&gt; if configured), while &lt;code&gt;5 minutes&lt;/code&gt; with zero quotes across the whole stream in &lt;code&gt;run&lt;/code&gt; or &lt;code&gt;stream&lt;/code&gt; logs a stream-down error to Discord. Likewise, &lt;code&gt;Runner::CheckBarFeeds&lt;/code&gt; alerts if a daily candle is &lt;code&gt;30 minutes&lt;/code&gt; late after &lt;code&gt;00:00 UTC&lt;/code&gt; on a trading day, while ignoring weekends and holidays.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keeping the risk gate from panic-selling on after-hours prints (&lt;code&gt;RiskGatedVenue&lt;/code&gt;):&lt;/strong&gt; Live equity closes use market orders, which only execute in the regular session. If &lt;code&gt;max_drawdown_close&lt;/code&gt; trips after hours, the gate halts trading and cancels open orders immediately, then holds &lt;code&gt;mPendingDrawdownClose&lt;/code&gt; until the regular session opens (&lt;code&gt;SendPendingClose()&lt;/code&gt;). Similarly, &lt;code&gt;max_loss_per_position&lt;/code&gt; checks &lt;code&gt;HasOpenMarketPrice()&lt;/code&gt;: an illiquid pre-market or after-hours print wide enough to breach a position’s loss limit pauses new entries in that ticker for the day, while waiting for a regular-session print before firing a market sell.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Where Live Schwab Behavior Disagreed With the Docs (and Why Databento Joined the Lineup)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Unit tests against mocked JSON only prove your code matches &lt;em&gt;your reading&lt;/em&gt; of the documentation. Pointing Kestrel at Schwab’s live endpoints in November 2026 turned up a list of places where live payloads differed from the specs on &lt;code&gt;developer.schwab.com&lt;/code&gt; (all documented in &lt;code&gt;docs/venues/schwab.md&lt;/code&gt;):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Area&lt;/th&gt;
&lt;th&gt;What Schwab’s Spec Says&lt;/th&gt;
&lt;th&gt;What the Live API Actually Does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;LEVELONE_EQUITIES&lt;/code&gt; sizes&lt;/td&gt;
&lt;td&gt;Bid/ask sizes (fields &lt;code&gt;4&lt;/code&gt;, &lt;code&gt;5&lt;/code&gt;) are in lots of 100&lt;/td&gt;
&lt;td&gt;Reported in &lt;strong&gt;individual shares&lt;/strong&gt; , matching REST &lt;code&gt;/quotes&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;CHART_EQUITY&lt;/code&gt; fields&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0&lt;/code&gt; is key, &lt;code&gt;1..5&lt;/code&gt; are open, high, low, close, volume&lt;/td&gt;
&lt;td&gt;Shifted up by one: &lt;code&gt;1&lt;/code&gt; is sequence, &lt;code&gt;2..6&lt;/code&gt; are OHLCV (with fractional volume), &lt;code&gt;7&lt;/code&gt; is minute start time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;POST /previewOrder&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Takes a &lt;code&gt;PreviewOrder&lt;/code&gt; wrapper schema&lt;/td&gt;
&lt;td&gt;Rejects that wrapper; takes the &lt;strong&gt;exact same JSON body&lt;/strong&gt; as &lt;code&gt;POST /orders&lt;/code&gt; (matching &lt;code&gt;schwab-py&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GET /pricehistory&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Standard &lt;code&gt;[startDate, endDate]&lt;/code&gt; query&lt;/td&gt;
&lt;td&gt;Always answers in &lt;strong&gt;whole days&lt;/strong&gt; , defaults &lt;code&gt;needExtendedHoursData&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; (including &lt;code&gt;20:00–04:00&lt;/code&gt; ET overnight bars), returns empty &lt;code&gt;candles&lt;/code&gt; instead of an error on unknown symbols, has &lt;strong&gt;no &lt;code&gt;1h&lt;/code&gt; bars&lt;/strong&gt; , and keeps only &lt;strong&gt;~48 days&lt;/strong&gt; of &lt;code&gt;1m&lt;/code&gt; bars&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Streamer concurrency&lt;/td&gt;
&lt;td&gt;WebSocket &lt;code&gt;LOGIN&lt;/code&gt; per client&lt;/td&gt;
&lt;td&gt;Strictly &lt;strong&gt;one connection per user&lt;/strong&gt; ; opening thinkorswim or a second process kicks the first off with notify code &lt;code&gt;12&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Working around Schwab’s real-world behavior shaped four of the more interesting pieces in the repository:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Multiplexing One Streamer Socket (&lt;code&gt;SchwabStreamer&lt;/code&gt;) and Polling Official Daily Bars&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Because a second &lt;code&gt;LOGIN&lt;/code&gt; from the same user disconnects the first with notify code &lt;code&gt;12&lt;/code&gt;, Kestrel can’t open one WebSocket for quotes and another for bars like it does on Binance.US. &lt;code&gt;SchwabStreamer&lt;/code&gt; (&lt;code&gt;src/data/schwab_streamer.cpp&lt;/code&gt;) fetches the WebSocket URL and credentials from &lt;code&gt;GET /userPreference&lt;/code&gt;, logs in once, and multiplexes &lt;code&gt;LEVELONE_EQUITIES&lt;/code&gt; and &lt;code&gt;CHART_EQUITY&lt;/code&gt; subscriptions over that single connection (&lt;code&gt;SUBS&lt;/code&gt;, &lt;code&gt;ADD&lt;/code&gt;, &lt;code&gt;UNSUBS&lt;/code&gt;). If thinkorswim takes over the connection (&lt;code&gt;code 12&lt;/code&gt;), &lt;code&gt;[schwab] takeover_reconnect_ms&lt;/code&gt; defaults to &lt;code&gt;0&lt;/code&gt;, stopping the streamer cleanly and logging an error rather than getting into an infinite tug-of-war stealing the socket back and forth.&lt;/p&gt;

&lt;p&gt;For streamed bars, &lt;code&gt;CHART_EQUITY&lt;/code&gt; only emits 1-minute candles (re-sending the last closed minute on subscribe, which Kestrel drops). &lt;code&gt;SchwabBarAggregator&lt;/code&gt; builds &lt;code&gt;5m&lt;/code&gt;, &lt;code&gt;10m&lt;/code&gt;, &lt;code&gt;15m&lt;/code&gt;, and &lt;code&gt;30m&lt;/code&gt; bars from those minutes, skipping any incomplete window after a reconnect so &lt;code&gt;Runner&lt;/code&gt; backfills it cleanly via REST. For &lt;code&gt;1d&lt;/code&gt; bars, however, summing intraday minutes would miss the opening and closing auctions. Instead, &lt;code&gt;DailyBarPoller&lt;/code&gt; (&lt;code&gt;StreamBars&lt;/code&gt; with &lt;code&gt;1d&lt;/code&gt;) uses zero streamer connections and polls &lt;code&gt;/pricehistory&lt;/code&gt; after &lt;code&gt;00:00 UTC&lt;/code&gt; so live daily strategies trade on the exact same official daily candles used in backtests.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Tick Sizes Without a Symbol-Metadata Endpoint&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Unlike Binance.US (&lt;code&gt;exchangeInfo&lt;/code&gt;) or Kraken (&lt;code&gt;AssetPairs&lt;/code&gt;), Schwab publishes no tick-size or lot-size endpoint. &lt;code&gt;SchwabDataSource::GetSymbolInfo&lt;/code&gt; sends a single &lt;code&gt;GET /quotes&lt;/code&gt; check at startup, returning &lt;code&gt;kNotFound&lt;/code&gt; on a typoed ticker (which aborts &lt;code&gt;run&lt;/code&gt; immediately) or &lt;code&gt;kUnsupported&lt;/code&gt; on non-equities (which aborts &lt;code&gt;backtest&lt;/code&gt; and rejects any order). From there it applies the SEC’s sub-penny rule (Rule 612): a &lt;code&gt;$0.01&lt;/code&gt; tick for stocks at or above &lt;code&gt;$1.00&lt;/code&gt;, and &lt;code&gt;$0.0001&lt;/code&gt; below &lt;code&gt;$1.00&lt;/code&gt;, with &lt;code&gt;SchwabTradingVenue&lt;/code&gt; re-checking each order’s own limit or stop price in case a stock crossed &lt;code&gt;$1.00&lt;/code&gt; mid-session.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. Polling Orders Without Scanning 180 Days Every 5 Seconds&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Schwab’s &lt;code&gt;GET /accounts/{hash}/orders&lt;/code&gt; filters by when an order was &lt;em&gt;entered&lt;/em&gt; (&lt;code&gt;fromEnteredTime&lt;/code&gt;), not when it last changed or filled, and a &lt;code&gt;GOOD_TILL_CANCEL&lt;/code&gt; order can sit open for up to &lt;strong&gt;180 days&lt;/strong&gt;. Each poll also costs one request when idle—or two while an order is working—against Schwab’s &lt;code&gt;120 requests/min&lt;/code&gt; app limit, which Market Data and Trading share. Because &lt;code&gt;SchwabDataSource&lt;/code&gt; and &lt;code&gt;SchwabTradingVenue&lt;/code&gt; each keep an independent &lt;code&gt;SchwabApi&lt;/code&gt; limiter (&lt;code&gt;1.8 req/s&lt;/code&gt;, burst &lt;code&gt;5&lt;/code&gt;), together they could exceed &lt;code&gt;120/min&lt;/code&gt; under load, so live runs poll Schwab every 5 seconds instead of every second. Pulling 180 days of orders on every 5-second poll would inflate latency and risk hitting page limits.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;SchwabTradingVenue&lt;/code&gt; avoids that in three ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;In-memory watermark (&lt;code&gt;OrderScan&lt;/code&gt; / &lt;code&gt;OldestWorkingSince&lt;/code&gt;):&lt;/strong&gt; Only the first fetch in a process looks back 180 days. Every fetch records the entry timestamp of the oldest still-working order on Kestrel’s symbols. If the &lt;code&gt;10:00:00&lt;/code&gt; poll sees that the oldest working order was entered at &lt;code&gt;09:12:00&lt;/code&gt;, the &lt;code&gt;10:00:05&lt;/code&gt; poll only asks for orders entered from &lt;code&gt;09:12:00&lt;/code&gt; onward (minus 5 minutes of clock-skew slack).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recursive window splitting:&lt;/strong&gt; If a busy account ever hits Schwab’s 3,000-order response ceiling in one window, &lt;code&gt;FetchOrders&lt;/code&gt; recursively splits the time range in half down to 1 minute and deduplicates order IDs at the seam.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Targeted fill syncs for one-shot commands:&lt;/strong&gt; When a fresh process like &lt;code&gt;kestrel_app account --store&lt;/code&gt; syncs fills without an in-memory watermark, it pairs a narrow order fetch with &lt;code&gt;GET /accounts/{hash}/transactions&lt;/code&gt; (&lt;code&gt;types=TRADE&lt;/code&gt;) to look up at most 8 older filled orders individually by ID before falling back to a full 180-day scan.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One related quirk shows up on OCO orders (&lt;code&gt;PlaceOco&lt;/code&gt;): when Schwab returns &lt;code&gt;201 Created&lt;/code&gt;, the &lt;code&gt;Location&lt;/code&gt; header only names the parent order. Kestrel immediately reads back the parent to extract both child leg IDs, cancelling any lone surviving leg if its sibling was rejected.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4. Bringing In Databento For Deep Intraday Equity Backtests&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Discovering that Schwab’s &lt;code&gt;/pricehistory&lt;/code&gt; only keeps ~48 days of 1-minute bars (even for &lt;code&gt;SPY&lt;/code&gt;) created an obvious problem: you can’t seriously evaluate an intraday equity strategy on seven weeks of data.&lt;/p&gt;

&lt;p&gt;That led directly to adding &lt;code&gt;provider = "databento"&lt;/code&gt; (commit &lt;code&gt;729101a&lt;/code&gt;, documented in &lt;code&gt;docs/venues/databento.md&lt;/code&gt;). Because Databento bills by data volume, Kestrel refuses to auto-download from it on a backtest cache miss. Instead, &lt;code&gt;kestrel_app databento&lt;/code&gt; runs an explicit import into TimescaleDB under &lt;code&gt;venue = "databento"&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pre-flight cost gate:&lt;/strong&gt; Every HTTP pull queries &lt;code&gt;/v0/metadata.get_cost&lt;/code&gt; first and requires either &lt;code&gt;--dry-run&lt;/code&gt; (spends &lt;code&gt;$0&lt;/code&gt;) or &lt;code&gt;--max-cost &amp;lt;USD&amp;gt; --store&lt;/code&gt; (aborting with exit code &lt;code&gt;2&lt;/code&gt; before downloading if the estimate exceeds your cap). Adding &lt;code&gt;--rollup 5m,15m,30m&lt;/code&gt; later over sessions whose &lt;code&gt;1m&lt;/code&gt; bars are already imported builds the higher timeframes locally for &lt;code&gt;$0&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Session-only slices, data hygiene, and a resumable ledger:&lt;/strong&gt; Intraday HTTP pulls request only open market hours (&lt;code&gt;09:30–16:00&lt;/code&gt; ET, or &lt;code&gt;07:00–20:00&lt;/code&gt; ET with &lt;code&gt;extended_hours = true&lt;/code&gt;), reject multi-publisher bundles like &lt;code&gt;DBEQ.BASIC&lt;/code&gt; that mix per-exchange books under one ticker, and split dense tick schemas like &lt;code&gt;mbp-1&lt;/code&gt; into 15-minute chunks. Sequence numbers (&lt;code&gt;seq&lt;/code&gt;) are derived deterministically from nanosecond &lt;code&gt;ts_recv&lt;/code&gt; timestamps so out-of-order historical backfills still replay chronologically, and each finished slice is recorded in &lt;code&gt;databento_imports&lt;/code&gt;. Just like order placements, a &lt;code&gt;timeseries.get_range&lt;/code&gt; call that times out is &lt;em&gt;never&lt;/em&gt; automatically retried (since Databento may have delivered and billed the stream); re-running resumes cleanly from the ledger, and multi-year portal downloads (&lt;code&gt;.csv.zst&lt;/code&gt;) also pipe straight in via &lt;code&gt;zstdcat ... | kestrel_app ... databento --file - --store&lt;/code&gt; in constant memory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Drop-in compatibility with Schwab:&lt;/strong&gt; &lt;code&gt;DatabentoDataSource&lt;/code&gt; shares &lt;code&gt;UsEquityCalendar&lt;/code&gt; and Kestrel’s normalized tickers (&lt;code&gt;SPY&lt;/code&gt;, &lt;code&gt;BRK.B&lt;/code&gt;), so moving a strategy from a multi-year Databento backtest to Schwab paper or live trading is a one-line &lt;code&gt;provider&lt;/code&gt; change.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Side Note: Where Live Trading Stands Today.&lt;/strong&gt; Kestrel turns live &lt;code&gt;run&lt;/code&gt; on by default only as each venue’s real-account checklist finishes (&lt;code&gt;TODO.md&lt;/code&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Binance.US&lt;/strong&gt; is live (including live &lt;code&gt;market_maker&lt;/code&gt; runs on &lt;code&gt;ZEC/USDT&lt;/code&gt;, and commit &lt;code&gt;3a63e4d&lt;/code&gt; extracted shared client-ID unknown-outcome recovery into &lt;code&gt;trading/order_recovery.hpp&lt;/code&gt; alongside a universal &lt;code&gt;data::CallGuarded&lt;/code&gt; stream-callback guard).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Charles Schwab&lt;/strong&gt; passed its first live cash-account check on November 13, 2026: &lt;code&gt;order --test&lt;/code&gt; (&lt;code&gt;previewOrder&lt;/code&gt;) verified limit, stop, and &lt;code&gt;SCHB&lt;/code&gt; ETF orders; &lt;code&gt;kestrel_app&lt;/code&gt; bought and sold 1 share of &lt;code&gt;F&lt;/code&gt; at market with &lt;code&gt;&amp;lt;orderId&amp;gt;:&amp;lt;activityId&amp;gt;:&amp;lt;leg&amp;gt;&lt;/code&gt; fill IDs; and a 15-minute live &lt;code&gt;ma_crossover&lt;/code&gt; run placed 3 orders with zero errors at ~13 requests/minute and a &lt;code&gt;372 ms&lt;/code&gt; median &lt;code&gt;/orders&lt;/code&gt; poll.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kraken&lt;/strong&gt; passed its signed live read check (&lt;code&gt;BalanceEx&lt;/code&gt;, &lt;code&gt;OpenOrders&lt;/code&gt;, &lt;code&gt;TradesHistory&lt;/code&gt;, and &lt;code&gt;TradeVolume&lt;/code&gt;) on an empty account on November 16, 2026.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both Schwab and Kraken keep live &lt;code&gt;run&lt;/code&gt; behind explicit &lt;code&gt;live_trading = true&lt;/code&gt; flags while I finish checking resting limits and stops, OCO leg cancellation, and funded Kraken orders (including &lt;code&gt;pending: true&lt;/code&gt; cancel replies). With Discord alerts (&lt;code&gt;net::Alerter&lt;/code&gt;, commits &lt;code&gt;0e6ca0a&lt;/code&gt; through &lt;code&gt;5d1d906&lt;/code&gt;) now forwarding error lines, stream and daily-bar outages (&lt;code&gt;data::FeedWatch&lt;/code&gt;), risk-gate actions (&lt;code&gt;util::Notice&lt;/code&gt;), and startup low-disk checks, the last operational piece before leaving live runs unattended is an external dead-man’s-switch heartbeat (&lt;code&gt;healthchecks.io&lt;/code&gt;), followed by those real-account order checks and WebSocket &lt;code&gt;StreamExecutions&lt;/code&gt; so live runs stop polling REST for fills.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Integrating multiple exchanges and brokers behind a clean C++23 boundary came down to a handful of practical habits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stop provider quirks at the edge:&lt;/strong&gt; Keep native symbols (&lt;code&gt;XXBTZUSD&lt;/code&gt;, &lt;code&gt;BRK/B&lt;/code&gt;), HTTP-200 error payloads, and account hashes locked inside each venue class so strategy and risk code only ever see one model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make market hours a first-class abstraction:&lt;/strong&gt; Once &lt;code&gt;MarketHours&lt;/code&gt; lives on &lt;code&gt;DataSource&lt;/code&gt;, order gating, bar backfills, streamed-bar session filtering, stale-quote checks, and after-hours risk closes all work automatically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design for credential lifecycles on running processes:&lt;/strong&gt; Short-lived tokens and 7-day re-authorizations need atomic file swaps, directory locks, and in-memory adoption so renewing access never requires killing a live run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify every spec against live traffic:&lt;/strong&gt; From shifted streamer field numbers and &lt;code&gt;previewOrder&lt;/code&gt; payloads to 2027 holiday tables and 48-day bar retention limits, live endpoints always have opinions the documentation forgot to mention.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next up, to wrap up this initial series, is &lt;strong&gt;When Trading Strategies Meet Reality&lt;/strong&gt;. I’ll dig into the backtest and live test numbers across Kestrel’s six strategies (&lt;code&gt;trend_ensemble&lt;/code&gt; alongside the original five: &lt;code&gt;ma_crossover&lt;/code&gt;, &lt;code&gt;market_maker&lt;/code&gt;, &lt;code&gt;breakout&lt;/code&gt;, &lt;code&gt;momentum_rotation&lt;/code&gt;, and &lt;code&gt;mean_reversion&lt;/code&gt;): why adding realistic network latency completely flipped a “profitable” market maker on its head, how a short live run verified how prices moved right after each fill compared to the simulator, and which slower daily setups actually held up after fees and slippage.&lt;/p&gt;

&lt;p&gt;Have you run into undocumented API surprises or OAuth headaches integrating brokerage or crypto APIs of your own? Drop a comment below. I’d love to hear war stories!&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://blog.taylorbuiltsolutions.com/integrating-crypto-exchanges-charles-schwab-api/" rel="noopener noreferrer"&gt;Integrating Crypto Exchanges and Charles Schwab&lt;/a&gt; appeared first on &lt;a href="https://blog.taylorbuiltsolutions.com" rel="noopener noreferrer"&gt;Taylor Built Solutions&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kestrel</category>
      <category>binanceus</category>
      <category>c</category>
      <category>c23</category>
    </item>
    <item>
      <title>C++ Under the Hood: Money, Latency, and Safety</title>
      <dc:creator>Taylor R Price</dc:creator>
      <pubDate>Sat, 21 Nov 2026 19:14:04 +0000</pubDate>
      <link>https://dev.to/trpricesoftware/c-under-the-hood-money-latency-and-safety-42b</link>
      <guid>https://dev.to/trpricesoftware/c-under-the-hood-money-latency-and-safety-42b</guid>
      <description>&lt;p&gt;&lt;strong&gt;BLUF&lt;/strong&gt; – Writing an automated trading tool in C++23 isn’t about chasing tricks to save every nanosecond possible. At retail exchange speeds, the things that actually protect your account and your data are unglamorous systems fundamentals. Order sizes, prices parsed from JSON, and P&amp;amp;L all stay in exact fixed-point math, where a &lt;code&gt;double&lt;/code&gt; never gets the chance to round them. A timed-out order placement never gets blindly retried. Warm HTTPS connections keep a round trip to Tokyo from costing half a second. And tick-by-tick quotes get batched into TimescaleDB without blocking the WebSocket thread or losing sub-millisecond arrival order.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In this post:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Money: Fixed-Point &lt;code&gt;Decimal&lt;/code&gt; Math (and Keeping &lt;code&gt;double&lt;/code&gt; Out Of JSON)&lt;/li&gt;
&lt;li&gt;Safety: &lt;code&gt;std::expected&lt;/code&gt;, Never Blindly Retrying Orders, and Failing Closed&lt;/li&gt;
&lt;li&gt;Latency: Keeping Connections Warm (429 ms Down To 129 ms) and Measuring Everything&lt;/li&gt;
&lt;li&gt;Throughput: Batching Quotes Into TimescaleDB Without Losing Order&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the &lt;a href="https://blog.taylorbuiltsolutions.com/introducing-kestrel-stock-crypto-trading-tool/" rel="noopener noreferrer"&gt;first post in this series&lt;/a&gt;, I introduced Kestrel, a C++23 library and CLI tool for pulling stock and crypto market data, backtesting strategies, paper trading, and executing live orders. The full source is &lt;a href="https://github.com/trprice/kestrel" rel="noopener noreferrer"&gt;on GitHub&lt;/a&gt; if you want to follow along in the code. In the &lt;a href="https://blog.taylorbuiltsolutions.com/building-with-ai-coding-agents/" rel="noopener noreferrer"&gt;second post&lt;/a&gt;, I walked through how I used multiple AI coding agents and mechanical C++ guardrails to build it without ending up with a plate of spaghetti.&lt;/p&gt;

&lt;p&gt;This time I want to pop the hood and look at the engineering choices that actually move money, talk to exchanges, and write market data to disk. None of these are exotic high-frequency trading tricks—Kestrel talks to retail REST and WebSocket APIs over the public internet—but every single one of them came out of either a real measurement or a failure mode that can quietly corrupt P&amp;amp;L or place an order twice.&lt;/p&gt;

&lt;p&gt;As before, nothing here is financial advice. This post is about keeping a trading bot’s bookkeeping honest, not about making it profitable.&lt;/p&gt;




&lt;h2&gt;
  
  
  Money: Fixed-Point &lt;code&gt;Decimal&lt;/code&gt; Math (and Keeping &lt;code&gt;double&lt;/code&gt; Out Of JSON)
&lt;/h2&gt;

&lt;p&gt;Anyone who has spent time maintaining payroll systems learns early that binary floating point has no business anywhere near accounting. The &lt;a href="https://standards.ieee.org/ieee/754/6210/" rel="noopener noreferrer"&gt;IEEE 754&lt;/a&gt; formats behind &lt;code&gt;float&lt;/code&gt; and &lt;code&gt;double&lt;/code&gt; store numbers in base 2, so most decimal fractions—even a humble &lt;code&gt;0.1&lt;/code&gt;—can only be approximated. &lt;code&gt;0.1 + 0.2 != 0.3&lt;/code&gt; is a punchline in introductory CS classes, right up until a trading bot sends an order quantity of &lt;code&gt;0.30000000000000004&lt;/code&gt; to Binance.US and gets bounced with &lt;code&gt;-1111&lt;/code&gt; (too much precision), or tiny rounding errors accumulate across thousands of maker fills and fees until your local position disagrees with the exchange.&lt;/p&gt;

&lt;p&gt;In Kestrel, market data ingestion, order sizing and tick/lot rounding, balances, fees, P&amp;amp;L (&lt;code&gt;PnlTracker&lt;/code&gt;), and database storage never convert through &lt;code&gt;float&lt;/code&gt; or &lt;code&gt;double&lt;/code&gt;. Everything in that path uses &lt;code&gt;kestrel::types::Decimal&lt;/code&gt; (&lt;code&gt;include/kestrel/types/decimal.hpp&lt;/code&gt; and &lt;code&gt;src/types/decimal.cpp&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Side Note:&lt;/strong&gt; There are two intentional exceptions. &lt;code&gt;MarketMaker&lt;/code&gt;‘s volatility-widened spread and its nonlinear &lt;code&gt;skew_power&lt;/code&gt;/&lt;code&gt;skew_age&lt;/code&gt; adjustments convert to &lt;code&gt;double&lt;/code&gt; briefly for fractional powers, then round back with &lt;code&gt;std::llround&lt;/code&gt;. Unquoted TOML floats in config files are converted through their shortest round-trip text with &lt;code&gt;std::to_chars&lt;/code&gt; before &lt;code&gt;Decimal::Parse&lt;/code&gt; sees them.&lt;/p&gt;

&lt;h3&gt;
  
  
  An &lt;code&gt;int64_t&lt;/code&gt; Mantissa With &lt;code&gt;__int128&lt;/code&gt; Scratch Space
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Decimal&lt;/code&gt; stores two fields: a signed 64-bit integer mantissa (&lt;code&gt;mMantissa&lt;/code&gt;) and a base-10 scale (&lt;code&gt;mScale&lt;/code&gt;) between &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;18&lt;/code&gt;, representing &lt;code&gt;mMantissa / 10^mScale&lt;/code&gt;. That gives exact representation for crypto quantities down to 18 decimal places as well as US equity prices. Comparisons work on numeric value rather than on the raw fields, so &lt;code&gt;1.50 == 1.5&lt;/code&gt;; the class gets all six comparison operators from &lt;code&gt;==&lt;/code&gt; and the three-way &lt;code&gt;&amp;lt;=&amp;gt;&lt;/code&gt; operator that arrived in &lt;a href="https://www.iso.org/standard/79358.html" rel="noopener noreferrer"&gt;C++20&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The tricky part of fixed-point math in C++ is intermediate overflow. Multiplying a price by a quantity carried at 18 decimal places, or aligning two values to a common scale before adding them, can easily blow past &lt;code&gt;int64_t&lt;/code&gt; before you ever get a chance to round the result back down. Because Kestrel targets GCC and Clang on Linux, &lt;code&gt;decimal.cpp&lt;/code&gt; leans on &lt;code&gt;__int128&lt;/code&gt; for intermediate scale alignment, multiplication, and division:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;` &lt;span class="n"&gt;__extension__&lt;/span&gt; &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="n"&gt;i128&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;__int128&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;constexpr&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;i128&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;39&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;MakePow10&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;i128&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;39&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="kt"&gt;size_t&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;size&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;constexpr&lt;/span&gt; &lt;span class="kd"&gt;auto&lt;/span&gt; &lt;span class="n"&gt;kPow10&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;MakePow10&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With that &lt;code&gt;constexpr&lt;/code&gt; powers-of-10 table (up to 10^38), every operation computes its exact result in &lt;code&gt;i128&lt;/code&gt; first. What happens next depends on the operation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;+&lt;/code&gt;, &lt;code&gt;-&lt;/code&gt;, and &lt;code&gt;*&lt;/code&gt;&lt;/strong&gt; narrow back to &lt;code&gt;int64_t&lt;/code&gt; through one helper, &lt;code&gt;FromWide&lt;/code&gt;. When a result needs more than 18 fractional digits or a mantissa wider than &lt;code&gt;int64_t&lt;/code&gt;, &lt;code&gt;FromWide&lt;/code&gt; drops fractional digits &lt;em&gt;once&lt;/em&gt; (rounding to nearest, avoiding double-rounding) until it fits. Only an integer part that won’t fit &lt;code&gt;int64_t&lt;/code&gt; throws &lt;code&gt;std::overflow_error&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Decimal::Parse&lt;/code&gt;&lt;/strong&gt; goes through the same &lt;code&gt;FromWide&lt;/code&gt; narrowing, but catches the overflow and returns it as a &lt;code&gt;kParse&lt;/code&gt; error (“value out of range”), since bad input from an exchange is a runtime problem, not a bug.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;&amp;lt;=&amp;gt;&lt;/code&gt;&lt;/strong&gt; compares the widened &lt;code&gt;i128&lt;/code&gt; values directly without narrowing at all.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Operations with a fixed target scale&lt;/strong&gt; (&lt;code&gt;RoundToIncrement&lt;/code&gt;, &lt;code&gt;Divide&lt;/code&gt;, widening &lt;code&gt;Rescale&lt;/code&gt;, and negating &lt;code&gt;INT64_MIN&lt;/code&gt;) check &lt;code&gt;FitsI64&lt;/code&gt; directly and throw &lt;code&gt;std::overflow_error&lt;/code&gt; if the scaled mantissa overflows. Kestrel treats that as a programming bug rather than a recoverable runtime error.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two small details in &lt;code&gt;decimal.cpp&lt;/code&gt; are easy to get wrong on a first pass:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Floor division on negative numbers:&lt;/strong&gt; C++’s &lt;code&gt;/&lt;/code&gt; and &lt;code&gt;%&lt;/code&gt; operators truncate toward zero, not toward −∞. &lt;code&gt;DivRound&lt;/code&gt; explicitly normalizes negative remainders (&lt;code&gt;if (r &amp;lt; 0) { r += d; --q; }&lt;/code&gt;) before applying &lt;code&gt;Rounding::kDown&lt;/code&gt; (toward −∞), &lt;code&gt;Rounding::kUp&lt;/code&gt; (toward +∞), or &lt;code&gt;Rounding::kNearest&lt;/code&gt; (ties away from zero).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parsing scientific notation and long decimals:&lt;/strong&gt; Exchanges occasionally return tiny numbers in scientific notation (like &lt;code&gt;1e-8&lt;/code&gt;) or long fractional strings. &lt;code&gt;Decimal::Parse&lt;/code&gt; parses directly from &lt;code&gt;std::string_view&lt;/code&gt; into &lt;code&gt;i128&lt;/code&gt;, tracking a &lt;code&gt;sticky&lt;/code&gt; flag if non-zero digits appear past its 2^120 (~36-digit) accumulation limit so rounding stays honest instead of silently truncating.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Side Note:&lt;/strong&gt; &lt;code&gt;__int128&lt;/code&gt; is a GCC/Clang extension, not standard C++. MSVC doesn’t provide it, so &lt;code&gt;decimal.cpp&lt;/code&gt; carries a &lt;code&gt;TODO&lt;/code&gt; for a small wide-integer fallback if I ever decide to support native Windows builds outside WSL.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keeping &lt;code&gt;double&lt;/code&gt; Out Of JSON—In Both Directions
&lt;/h3&gt;

&lt;p&gt;Building a &lt;code&gt;Decimal&lt;/code&gt; type doesn’t help much if your JSON library rounds every number to a &lt;code&gt;double&lt;/code&gt; the moment it parses it—and that is exactly what &lt;code&gt;nlohmann::json::parse()&lt;/code&gt; does by default. The &lt;a href="https://www.rfc-editor.org/rfc/rfc8259#section-6" rel="noopener noreferrer"&gt;JSON spec&lt;/a&gt; doesn’t actually require that. It lets parsers limit precision and points out that double precision is what most of them support, so that’s what most of them do. Crypto exchanges usually quote prices as strings (&lt;code&gt;"64210.50"&lt;/code&gt;), but Schwab and some metadata endpoints send raw JSON numbers (&lt;code&gt;182.35&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;On the &lt;strong&gt;inbound&lt;/strong&gt; side, &lt;code&gt;util::ParseJson&lt;/code&gt; (&lt;code&gt;src/util/json.cpp&lt;/code&gt;) uses a tiny &lt;code&gt;nlohmann::json_sax&amp;lt;json&amp;gt;&lt;/code&gt; subclass, &lt;code&gt;ExactNumberSax&lt;/code&gt;, that intercepts &lt;code&gt;number_float&lt;/code&gt; and stores the parser’s raw literal text as a JSON string instead of accepting the converted &lt;code&gt;double&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;`&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ExactNumberSax&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;nlohmann&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;json_sax&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="k"&gt;public&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;// ...&lt;/span&gt;
    &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="nf"&gt;number_float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;number_float_t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;string_t&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;literal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;override&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;literal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From there, &lt;code&gt;util::JsonDecimal&lt;/code&gt; parses strings via &lt;code&gt;Decimal::Parse&lt;/code&gt; and integers directly into &lt;code&gt;Decimal(value, 0)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The same trap exists on the &lt;strong&gt;outbound&lt;/strong&gt; side for Schwab, whose order API expects unquoted JSON numbers for &lt;code&gt;price&lt;/code&gt;, &lt;code&gt;stopPrice&lt;/code&gt;, and &lt;code&gt;quantity&lt;/code&gt;. Putting a fractional value into an &lt;code&gt;nlohmann::json&lt;/code&gt; object would pass it through &lt;code&gt;double&lt;/code&gt;, so &lt;code&gt;BuildSingleOrderJson&lt;/code&gt; (&lt;code&gt;src/trading/schwab_trading_venue.cpp&lt;/code&gt;) hand-formats the order payload directly from &lt;code&gt;Decimal::Normalized().ToString()&lt;/code&gt; and uses &lt;code&gt;nlohmann::json(schwab_symbol).dump()&lt;/code&gt; only to escape the string symbol. A price moves from the exchange’s response text into &lt;code&gt;Decimal&lt;/code&gt;, out to order payloads, and into PostgreSQL’s exact &lt;code&gt;NUMERIC&lt;/code&gt; columns without ever becoming a &lt;code&gt;double&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rounding In the Safe Direction Before an Order Hits the Wire
&lt;/h3&gt;

&lt;p&gt;Before any venue sends an order (paper or live), it runs through &lt;code&gt;ApplySymbolRules&lt;/code&gt; (&lt;code&gt;src/trading/order_rules.cpp&lt;/code&gt;) using the exchange’s &lt;code&gt;tick_size&lt;/code&gt;, &lt;code&gt;lot_size&lt;/code&gt;, &lt;code&gt;min_order_size&lt;/code&gt;, and &lt;code&gt;min_notional&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Limit buys&lt;/strong&gt; round &lt;code&gt;kDown&lt;/code&gt; to &lt;code&gt;tick_size&lt;/code&gt; (never bid more than the strategy asked).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limit sells&lt;/strong&gt; round &lt;code&gt;kUp&lt;/code&gt; to &lt;code&gt;tick_size&lt;/code&gt; (never offer for less than the strategy asked).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stops&lt;/strong&gt; round &lt;code&gt;kNearest&lt;/code&gt; to &lt;code&gt;tick_size&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quantities&lt;/strong&gt; always round &lt;code&gt;kDown&lt;/code&gt; to &lt;code&gt;lot_size&lt;/code&gt; (never order more than sized or funded). Orders below &lt;code&gt;min_order_size&lt;/code&gt;—and limit orders whose &lt;code&gt;limit_price * quantity&lt;/code&gt; falls below &lt;code&gt;min_notional&lt;/code&gt;—are rejected locally before spending a network call.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On Binance.US, there is one last wrinkle: the exchange rejects a price or quantity with &lt;code&gt;-1111&lt;/code&gt; if it carries more decimal places than the tick or lot allows, &lt;em&gt;even if the extra digits are trailing zeros&lt;/em&gt;. &lt;code&gt;AtScaleOf&lt;/code&gt; in &lt;code&gt;binanceus_trading_venue.cpp&lt;/code&gt; rescales every formatted number to &lt;code&gt;increment.Normalized().Scale()&lt;/code&gt; before putting it in the query string.&lt;/p&gt;




&lt;h2&gt;
  
  
  Safety: &lt;code&gt;std::expected&lt;/code&gt;, Never Blindly Retrying Orders, and Failing Closed
&lt;/h2&gt;

&lt;p&gt;Once your math is exact, the next way a trading system hurts you is ambiguity over the network.&lt;/p&gt;

&lt;h3&gt;
  
  
  Recoverable Errors As Values (&lt;code&gt;std::expected&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Anywhere I/O or exchange rules can fail, Kestrel returns a &lt;code&gt;types::Result&amp;lt;T&amp;gt;&lt;/code&gt;, which is an alias for &lt;code&gt;std::expected&amp;lt;T, types::Error&amp;gt;&lt;/code&gt;, the value-or-error type that &lt;a href="https://www.iso.org/standard/83626.html" rel="noopener noreferrer"&gt;C++23&lt;/a&gt; added to the standard library. A &lt;code&gt;types::Error&lt;/code&gt; carries a structured &lt;code&gt;ErrorCategory&lt;/code&gt; (&lt;code&gt;kNetwork&lt;/code&gt;, &lt;code&gt;kTimeout&lt;/code&gt;, &lt;code&gt;kRateLimit&lt;/code&gt;, &lt;code&gt;kAuth&lt;/code&gt;, &lt;code&gt;kRejected&lt;/code&gt;, &lt;code&gt;kWouldTake&lt;/code&gt;, &lt;code&gt;kInsufficientFunds&lt;/code&gt;, &lt;code&gt;kNotFound&lt;/code&gt;, &lt;code&gt;kParse&lt;/code&gt;, &lt;code&gt;kServer&lt;/code&gt;, and a few others), along with optional &lt;code&gt;http_status&lt;/code&gt;, &lt;code&gt;provider_code&lt;/code&gt;, and &lt;code&gt;retry_after&lt;/code&gt; fields.&lt;/p&gt;

&lt;p&gt;Keeping recoverable errors in the return type makes failure paths explicit at every call site, and lets the HTTP and retry layers distinguish between errors worth backing off from and errors that demand stopping immediately.&lt;/p&gt;

&lt;p&gt;A good example is Binance.US rate limits versus IP bans (&lt;code&gt;src/net/cpr_http_client.cpp&lt;/code&gt; and &lt;code&gt;src/trading/binanceus_api.cpp&lt;/code&gt;). A &lt;a href="https://www.rfc-editor.org/rfc/rfc6585#section-4" rel="noopener noreferrer"&gt;&lt;code&gt;429 Too Many Requests&lt;/code&gt;&lt;/a&gt; maps to &lt;code&gt;kRateLimit&lt;/code&gt;, which is transient, so it gets retried after the server’s &lt;code&gt;Retry-After&lt;/code&gt; delay. For an IP ban, Binance.US borrows &lt;code&gt;418&lt;/code&gt;—the joke “I’m a teapot” code from &lt;a href="https://www.rfc-editor.org/rfc/rfc2324#section-2.3.2" rel="noopener noreferrer"&gt;RFC 2324&lt;/a&gt;—and retrying into a ban only makes it longer. When &lt;code&gt;BinanceUSApi&lt;/code&gt; sees a &lt;code&gt;418&lt;/code&gt;, it records the ban window from &lt;code&gt;Retry-After&lt;/code&gt;, and &lt;code&gt;BinanceUSApi::CheckBan()&lt;/code&gt; then short-circuits every request locally until that window expires. Nothing reaches the exchange until the ban is over.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Kestrel Never Blindly Retries a Timed-Out Order
&lt;/h3&gt;

&lt;p&gt;For read-only requests—pulling historical bars, reading open orders, checking balances—retrying on transient failures is a no-brainer. &lt;code&gt;util::Retry&lt;/code&gt; (&lt;code&gt;include/kestrel/util/retry.hpp&lt;/code&gt;) wraps idempotent calls with exponential backoff (up to 5 attempts, &lt;code&gt;500 ms&lt;/code&gt; initial, &lt;code&gt;2x&lt;/code&gt; multiplier, &lt;code&gt;30 s&lt;/code&gt; cap, &lt;code&gt;±20%&lt;/code&gt; random jitter) whenever &lt;code&gt;error.IsTransient()&lt;/code&gt; is true (&lt;code&gt;kNetwork&lt;/code&gt;, &lt;code&gt;kTimeout&lt;/code&gt;, &lt;code&gt;kRateLimit&lt;/code&gt;, or &lt;code&gt;kServer&lt;/code&gt;), honoring any server-supplied &lt;a href="https://www.rfc-editor.org/rfc/rfc9110#section-10.2.3" rel="noopener noreferrer"&gt;&lt;code&gt;Retry-After&lt;/code&gt;&lt;/a&gt; header as a floor (capped at 1 hour).&lt;/p&gt;

&lt;p&gt;For &lt;code&gt;POST /api/v3/order&lt;/code&gt;, blind retries are a footgun.&lt;/p&gt;

&lt;p&gt;Suppose you send a market buy to an exchange and libcurl returns a timeout 15 seconds later—or a proxy drops the connection, or the server returns HTTP 502. You are now in an unknown state. Maybe your packet never reached the matching engine. Or maybe the matching engine filled your order 120 ms after you sent it, and the response got lost on the way back. If your HTTP wrapper blindly retries that &lt;code&gt;POST&lt;/code&gt;, you can easily end up buying twice.&lt;/p&gt;

&lt;p&gt;Kestrel splits this explicitly at the API layer. &lt;code&gt;BinanceUSApi::Send&lt;/code&gt; takes a &lt;code&gt;bool idempotent&lt;/code&gt; parameter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;`&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;idempotent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;attempt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;util&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Retry&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mOptions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;retry&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;attempt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mOptions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sleeper&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Order placements, OCO pairs, and cancels pass &lt;code&gt;idempotent = false&lt;/code&gt;, so &lt;code&gt;util::Retry&lt;/code&gt; never touches them. (The single automatic resend inside &lt;code&gt;Send&lt;/code&gt; is when Binance.US returns error &lt;code&gt;-1021&lt;/code&gt;—timestamp outside &lt;code&gt;recvWindow&lt;/code&gt;—because the exchange explicitly rejected the request before executing it; Kestrel resyncs its clock offset against &lt;code&gt;/api/v3/time&lt;/code&gt; and resends.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8g2kk4gsp2fx33165hgx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8g2kk4gsp2fx33165hgx.png" alt="Flowchart of how the Kestrel trading bot handles an order whose outcome is unknown: it sends the order once, looks it up by client order ID after a timeout or server error, and never sends it again." width="800" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Instead of retrying a timed-out order, Kestrel reconciles it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Tag every order up front.&lt;/strong&gt; &lt;code&gt;BinanceUSTradingVenue&lt;/code&gt; attaches a unique &lt;code&gt;newClientOrderId&lt;/code&gt; (&lt;code&gt;kst-&amp;lt;8-char random tag&amp;gt;-&amp;lt;monotonic counter&amp;gt;&lt;/code&gt;) to every order before sending it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Distinguish refusals from unknowns.&lt;/strong&gt; If &lt;code&gt;POST /api/v3/order&lt;/code&gt; fails with a definite refusal (insufficient funds, bad price filter, auth error), nothing was placed—return the error directly. If the error says the order may have gone through (&lt;code&gt;Error::MayHaveTakenEffect()&lt;/code&gt;: &lt;code&gt;kNetwork&lt;/code&gt;, &lt;code&gt;kTimeout&lt;/code&gt;, &lt;code&gt;kServer&lt;/code&gt;, or a 2xx body that won’t parse, &lt;code&gt;kParse&lt;/code&gt;), do &lt;strong&gt;not&lt;/strong&gt; send it again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Look up the client order ID.&lt;/strong&gt; Kestrel calls &lt;code&gt;LookupClientOrder&lt;/code&gt; (&lt;code&gt;GET /api/v3/order?origClientOrderId=...&lt;/code&gt;)—which &lt;em&gt;is&lt;/em&gt; an idempotent read—up to twice with a 1-second pause (&lt;code&gt;kLookupPause&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recover or surface the ambiguity loudly.&lt;/strong&gt; If the order shows up, Kestrel returns a normal &lt;code&gt;OrderAcknowledgement&lt;/code&gt; built from the exchange’s state and life goes on. If it is still not found (or the lookup itself fails), Kestrel returns the original error with the &lt;code&gt;client_order_id&lt;/code&gt; and a warning that the order may still exist.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The same rule holds across the other venues, adapted to what each API allows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Kraken (&lt;code&gt;KrakenTradingVenue&lt;/code&gt;)&lt;/strong&gt; assigns a &lt;code&gt;cl_ord_id&lt;/code&gt; and checks both &lt;code&gt;OpenOrders&lt;/code&gt; and &lt;code&gt;ClosedOrders&lt;/code&gt; on an unknown outcome. Kraken only enforces &lt;code&gt;cl_ord_id&lt;/code&gt; uniqueness among open orders, so when the caller supplied a custom ID, the &lt;code&gt;ClosedOrders&lt;/code&gt; lookup is bounded by time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Charles Schwab (&lt;code&gt;SchwabTradingVenue&lt;/code&gt;)&lt;/strong&gt; doesn’t accept a client order ID on equity orders, so Kestrel has to find the order another way:

&lt;ul&gt;
&lt;li&gt;Before sending the &lt;code&gt;POST&lt;/code&gt;, it takes an in-memory snapshot of the order IDs it has already seen (&lt;code&gt;KnownOrdersSnapshot()&lt;/code&gt;). That costs no extra HTTP round trip.&lt;/li&gt;
&lt;li&gt;If the &lt;code&gt;POST&lt;/code&gt; hits an unknown outcome—or returns 2xx without an order ID—&lt;code&gt;RecoverPlacedOrder&lt;/code&gt; polls recent account orders up to twice, &lt;code&gt;200 ms&lt;/code&gt; apart.&lt;/li&gt;
&lt;li&gt;It ignores IDs that were already known or claimed by concurrent polls, and looks for a single new order matching the symbol, side, type, time in force, quantity, price, and creation window.&lt;/li&gt;
&lt;li&gt;If more than one order matches, it logs a warning and refuses to guess.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OCO pairs on Binance.US (&lt;code&gt;PlaceOco&lt;/code&gt;)&lt;/strong&gt; guard against half-tracked exits too: if a 2xx response doesn’t yield both legs in &lt;code&gt;orderReports&lt;/code&gt;, Kestrel first looks up both legs by their client order IDs (&lt;code&gt;limit_id&lt;/code&gt; and &lt;code&gt;stop_id&lt;/code&gt;). If either lookup fails—or if an unknown-outcome lookup finds only one leg—it cancels the whole pair via &lt;code&gt;DELETE /api/v3/orderList&lt;/code&gt; rather than leaving an untracked leg resting on the book.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Side Note:&lt;/strong&gt; That list didn’t start out consistent. A cross-model review caught that each venue kept its own idea of what “may have taken effect” meant. Kraken and Schwab already treated an unparseable 2xx as an unknown outcome, but Binance.US returned &lt;code&gt;ParseOrder&lt;/code&gt;‘s &lt;code&gt;kParse&lt;/code&gt; error as if it were a refusal. Worse, &lt;code&gt;Breakout::PlaceStop&lt;/code&gt; (&lt;code&gt;src/strategy/breakout.cpp&lt;/code&gt;) treated any OCO error outside its own short list as a refusal and immediately placed a standalone &lt;code&gt;STOP_LOSS&lt;/code&gt; sell, which could put a second sell beside an already-resting OCO if a 2xx body came back garbled. The fix (commit &lt;code&gt;8e227a5&lt;/code&gt;) added one predicate, &lt;code&gt;Error::MayHaveTakenEffect()&lt;/code&gt;, which all three venues and &lt;code&gt;breakout&lt;/code&gt; now share. A garbled 2xx on Binance.US now gets looked up by client order ID like a timeout, and &lt;code&gt;breakout&lt;/code&gt; checks &lt;code&gt;GetOpenOrders&lt;/code&gt; before placing an unanswered stop, pair, or exit again. Sharing the lookup code itself across venues is still on the list in &lt;code&gt;TODO.md&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Few More C++ Safety Touches Around Live Orders
&lt;/h3&gt;

&lt;p&gt;Three smaller details in the networking, risk, and shutdown paths turned out to be worth far more than the lines of code they took.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Never follow redirects with API keys.&lt;/strong&gt; In &lt;code&gt;CprHttpClient::Send&lt;/code&gt;, &lt;code&gt;session-&amp;gt;SetRedirect(cpr::Redirect{false})&lt;/code&gt; is set unconditionally. Exchange REST endpoints don’t redirect, and libcurl will otherwise forward custom headers (&lt;code&gt;X-MBX-APIKEY&lt;/code&gt;, &lt;code&gt;API-Key&lt;/code&gt;, &lt;code&gt;API-Sign&lt;/code&gt;) across a 3xx redirect to another host.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Closing the &lt;code&gt;Halt()&lt;/code&gt; vs. &lt;code&gt;PlaceOrder()&lt;/code&gt; race.&lt;/strong&gt; When the kill switch in &lt;code&gt;RiskGatedVenue::Halt()&lt;/code&gt; trips, flipping &lt;code&gt;mHalted&lt;/code&gt; (&lt;code&gt;std::atomic&amp;lt;bool&amp;gt;&lt;/code&gt;) and calling &lt;code&gt;CancelAll()&lt;/code&gt; once isn’t quite enough. An order that checked &lt;code&gt;mHalted&lt;/code&gt; a microsecond earlier could still be in flight inside &lt;code&gt;PlaceOrder()&lt;/code&gt; or &lt;code&gt;PlaceOco()&lt;/code&gt;, landing on the exchange &lt;em&gt;after&lt;/em&gt; &lt;code&gt;CancelAll()&lt;/code&gt; returns.&lt;/p&gt;

&lt;p&gt;Both methods hold &lt;code&gt;mMutex&lt;/code&gt; from admission through the venue call. So &lt;code&gt;Halt()&lt;/code&gt; cancels all open orders, briefly acquires and releases &lt;code&gt;mMutex&lt;/code&gt; as a barrier to drain any in-flight placement, and calls &lt;code&gt;CancelAll()&lt;/code&gt; a second time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;`&lt;span class="n"&gt;mHalted&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;spdlog&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;warn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"risk: trading halted: {}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;auto&lt;/span&gt; &lt;span class="n"&gt;cancelled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mVenue&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;CancelAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// An order already inside PlaceOrder read the flag before it was set and&lt;/span&gt;
&lt;span class="c1"&gt;// can still land after the cancel above. PlaceOrder holds the order lock&lt;/span&gt;
&lt;span class="c1"&gt;// from its checks to the venue call, so once the lock is ours that order&lt;/span&gt;
&lt;span class="c1"&gt;// has landed, and any later one sees the halt. Cancel again to catch it.&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;lock_guard&lt;/span&gt; &lt;span class="nf"&gt;lock&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mMutex&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;auto&lt;/span&gt; &lt;span class="n"&gt;recancelled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mVenue&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;CancelAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even after a halt, &lt;code&gt;Admit()&lt;/code&gt; still lets position-reducing exits through.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Signal-safe shutdown without racing open entries.&lt;/strong&gt; In the first post I mentioned that &lt;code&gt;kestrel_app run&lt;/code&gt; cancels open entry orders on Ctrl-C / &lt;code&gt;SIGTERM&lt;/code&gt; while leaving protective exits resting on the book. Under the hood, that takes two pieces:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Signals:&lt;/strong&gt; &lt;code&gt;BlockStopSignals()&lt;/code&gt; (&lt;code&gt;app/commands/run.cpp&lt;/code&gt;) masks &lt;code&gt;SIGINT&lt;/code&gt; and &lt;code&gt;SIGTERM&lt;/code&gt; with &lt;code&gt;pthread_sigmask&lt;/code&gt; before any worker threads spawn. A dedicated &lt;code&gt;StopWatcher&lt;/code&gt; thread then collects them synchronously with &lt;code&gt;sigtimedwait&lt;/code&gt;, so the mutex-taking &lt;code&gt;Runner::Stop()&lt;/code&gt; never executes inside an async signal handler. A second signal calls &lt;code&gt;std::_Exit(130)&lt;/code&gt; if you want out immediately.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shutdown order:&lt;/strong&gt; &lt;code&gt;Runner::End()&lt;/code&gt; stops the fill poller, then cancels open entries via &lt;code&gt;EntriesToCancel()&lt;/code&gt; (sorting stops first and capping kept exits to actual holdings). It runs one final &lt;code&gt;PollFills()&lt;/code&gt; before &lt;code&gt;OnStop()&lt;/code&gt;, so an entry that filled mid-cancel still reaches &lt;code&gt;OnFill&lt;/code&gt; to place its protective stop.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Latency: Keeping Connections Warm (429 ms Down To 129 ms) and Measuring Everything
&lt;/h2&gt;

&lt;p&gt;Early on I had a hunch that calling Binance.US from my machine in California might be slow enough to matter for faster strategies like &lt;code&gt;market_maker&lt;/code&gt;. Rather than guess, I added instrumentation first.&lt;/p&gt;

&lt;h3&gt;
  
  
  Measuring the Latency of Every HTTP Call (&lt;code&gt;TimedHttpClient&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Every &lt;code&gt;HttpClient&lt;/code&gt; built by Kestrel’s factory is wrapped in &lt;code&gt;TimedHttpClient&lt;/code&gt; (&lt;code&gt;src/net/timed_http_client.cpp&lt;/code&gt;). Each &lt;code&gt;Send()&lt;/code&gt; times one individual attempt (so retries show up as separate samples) and records it into a thread-safe &lt;code&gt;LatencyStats&lt;/code&gt; keyed by &lt;code&gt;"METHOD url"&lt;/code&gt; (or a redacted label).&lt;/p&gt;

&lt;p&gt;Two design choices make the metrics practical to keep on all the time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No secrets in endpoint labels:&lt;/strong&gt; &lt;code&gt;HttpRequest&lt;/code&gt; separates &lt;code&gt;url&lt;/code&gt; from &lt;code&gt;raw_query&lt;/code&gt; (signed parameters) and lets callers supply an optional &lt;code&gt;label&lt;/code&gt; for paths containing account hashes or order IDs (as Schwab’s endpoints do). &lt;code&gt;TimedHttpClient&lt;/code&gt; only ever logs &lt;code&gt;MethodName(method) + " " + request.Label()&lt;/code&gt;, so API signatures and account IDs never leak into logs or database tables.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Two views, bounded memory:&lt;/strong&gt; &lt;code&gt;LatencyStats&lt;/code&gt; keeps a whole-run map (&lt;code&gt;Summarize()&lt;/code&gt;) logged when a command exits, and an independent window map (&lt;code&gt;TakeWindow()&lt;/code&gt;) drained every 60 seconds into PostgreSQL’s &lt;code&gt;venue_latency&lt;/code&gt; table by &lt;code&gt;RunRecorder&lt;/code&gt;. Each endpoint tracks exact call counts (&lt;code&gt;EndpointLatency::count&lt;/code&gt;, stored in SQL column &lt;code&gt;calls&lt;/code&gt;), &lt;code&gt;errors&lt;/code&gt;, &lt;code&gt;rate_limited&lt;/code&gt; (HTTP 429/418), &lt;code&gt;min_ms&lt;/code&gt;, and &lt;code&gt;max_ms&lt;/code&gt; across every request, plus a 4,096-sample ring buffer for nearest-rank &lt;code&gt;p50&lt;/code&gt;, &lt;code&gt;p95&lt;/code&gt;, and &lt;code&gt;p99&lt;/code&gt;. Any call taking at least &lt;code&gt;[http] slow_request_ms&lt;/code&gt; (default 2,000 ms) logs a warning immediately.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What the Numbers Showed—and Why Connection Pooling Cut 300 ms
&lt;/h3&gt;

&lt;p&gt;Once &lt;code&gt;venue_latency&lt;/code&gt; started filling up, runs 7 through 11 on Binance.US showed the same thing on every single endpoint: a median round trip around &lt;strong&gt;415 ms&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Digging into where those milliseconds were going turned up two compounding causes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Binance.US serves its REST API out of AWS Tokyo (&lt;code&gt;ap-northeast-1&lt;/code&gt;) behind a CloudFront edge (&lt;code&gt;SFO53&lt;/code&gt;, about 15 ms from me in California).&lt;/li&gt;
&lt;li&gt;My original &lt;code&gt;CprHttpClient&lt;/code&gt; constructed a fresh &lt;code&gt;cpr::Session&lt;/code&gt; (and underlying libcurl easy handle) on every single &lt;code&gt;Send()&lt;/code&gt;. That meant every REST call tore down and re-established DNS, TCP, and TLS from scratch.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The fix in &lt;code&gt;CprHttpClient&lt;/code&gt; (&lt;code&gt;src/net/cpr_http_client.cpp&lt;/code&gt;) is a small, thread-safe pool of up to &lt;code&gt;kMaxIdleSessions = 4&lt;/code&gt; idle &lt;code&gt;cpr::Session&lt;/code&gt; handles (&lt;code&gt;TakeSession()&lt;/code&gt; / &lt;code&gt;ReturnSession()&lt;/code&gt;), shared between a provider’s &lt;code&gt;DataSource&lt;/code&gt; and &lt;code&gt;TradingVenue&lt;/code&gt; by &lt;code&gt;factory.cpp&lt;/code&gt;. Each &lt;code&gt;Send()&lt;/code&gt; checks out its own session—so the &lt;code&gt;Runner&lt;/code&gt; thread and the background fill poller never touch the same libcurl handle concurrently—and returns it when the call finishes.&lt;/p&gt;

&lt;p&gt;Kraken is the one venue that still serializes signed calls on top of that pool. Kraken enforces strictly monotonic nonces per API key, so &lt;code&gt;KrakenTradingVenue::SendOnce&lt;/code&gt; holds &lt;code&gt;mSendMutex&lt;/code&gt; across both nonce assignment and &lt;code&gt;mHttp-&amp;gt;Send()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Reusing a &lt;code&gt;cpr::Session&lt;/code&gt; has two subtle sharp edges that are easy to miss:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sticky state between calls:&lt;/strong&gt; A reused &lt;code&gt;cpr::Session&lt;/code&gt; remembers options from the previous request. If you send a &lt;code&gt;POST&lt;/code&gt; with a JSON body and later reuse that handle for a &lt;code&gt;GET&lt;/code&gt; or &lt;code&gt;DELETE&lt;/code&gt; without explicitly resetting everything, stale query parameters, headers, or bodies leak into the next call. &lt;code&gt;CprHttpClient::Send&lt;/code&gt; overwrites the URL, parameters (explicitly clearing &lt;code&gt;cpr::Parameters{}&lt;/code&gt; when &lt;code&gt;raw_query&lt;/code&gt; is used), headers, timeout, redirect policy, and calls &lt;code&gt;session-&amp;gt;RemoveContent()&lt;/code&gt; whenever &lt;code&gt;request.body&lt;/code&gt; is empty.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dropping half-dead sockets (while keeping healthy HTTP errors):&lt;/strong&gt; Normal HTTP &lt;code&gt;4xx&lt;/code&gt; and &lt;code&gt;5xx&lt;/code&gt; responses still return the &lt;code&gt;cpr::Session&lt;/code&gt; to &lt;code&gt;mIdle&lt;/code&gt;, because the underlying TCP/TLS connection is healthy. Only when &lt;code&gt;r.error&lt;/code&gt; fires (a timeout or libcurl transport failure) does &lt;code&gt;Send()&lt;/code&gt; return early &lt;em&gt;without&lt;/em&gt; calling &lt;code&gt;ReturnSession()&lt;/code&gt;, destroying the &lt;code&gt;unique_ptr&amp;lt;cpr::Session&amp;gt;&lt;/code&gt; on the spot so a wedged socket is never reused.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To prove the pool actually worked without touching the internet, &lt;code&gt;tests/cpr_http_client_test.cpp&lt;/code&gt; spins up &lt;code&gt;LoopbackServer&lt;/code&gt;, a tiny in-process server that keeps connections open the way an &lt;a href="https://www.rfc-editor.org/rfc/rfc9112#section-9.3" rel="noopener noreferrer"&gt;HTTP/1.1&lt;/a&gt; server does, and verifies that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;five sequential requests open exactly one TCP connection;&lt;/li&gt;
&lt;li&gt;a &lt;code&gt;GET&lt;/code&gt; and &lt;code&gt;DELETE&lt;/code&gt; after a &lt;code&gt;POST&lt;/code&gt; carry none of its body or query;&lt;/li&gt;
&lt;li&gt;three concurrent threads open at most three connections;&lt;/li&gt;
&lt;li&gt;a transport failure is reported cleanly without poisoning subsequent calls;&lt;/li&gt;
&lt;li&gt;redirects are refused rather than forwarding signed headers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The pooling tests passed 20 repeats under ThreadSanitizer when the pool landed.&lt;/p&gt;

&lt;p&gt;Then I tested the old and new clients back-to-back against the live Binance.US API from California on October 29, 2026 using the exact same read-only &lt;code&gt;account --days 30&lt;/code&gt; command (34 signed requests):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Fresh &lt;code&gt;cpr::Session&lt;/code&gt; per call&lt;/th&gt;
&lt;th&gt;Reused session pool&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Median (&lt;code&gt;p50&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;429 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;129 ms&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Minimum&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;214 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;121 ms&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Shaving &lt;strong&gt;300 ms&lt;/strong&gt; off the median was a bigger win than eliminating a local TCP + TLS handshake to SFO53 (~15 ms away) could explain on its own. Keeping my HTTPS connection to CloudFront open appears to keep CloudFront’s upstream connection to Tokyo warm as well—turning a multi-round-trip cold start across the Pacific into a single warm round trip.&lt;/p&gt;




&lt;h2&gt;
  
  
  Throughput: Batching Quotes Into TimescaleDB Without Losing Order
&lt;/h2&gt;

&lt;p&gt;Recording historical bars is easy—even 1-minute bars across dozens of symbols only trickle in once a minute. Recording live tick-by-tick quotes (&lt;code&gt;kestrel_app stream 3600 --store&lt;/code&gt;) is a different animal. Binance.US’s &lt;code&gt;bookTicker&lt;/code&gt; feed and Schwab’s level-1 quote streamer fire constantly, often delivering multiple updates for the same symbol in the same millisecond.&lt;/p&gt;

&lt;p&gt;Trying to run one synchronous PostgreSQL &lt;code&gt;INSERT&lt;/code&gt; per quote inside the WebSocket callback breaks down immediately: the network and disk latency stalls the WebSocket thread, which delays quotes to the strategy or causes the socket buffer to back up.&lt;/p&gt;

&lt;h3&gt;
  
  
  Decoupling the WebSocket Thread From Database Writes (&lt;code&gt;QuoteWriter&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;QuoteWriter&lt;/code&gt; (&lt;code&gt;include/kestrel/db/quote_store.hpp&lt;/code&gt; and &lt;code&gt;src/db/quote_store.cpp&lt;/code&gt;) puts a bounded in-memory buffer and a dedicated writer thread between the WebSocket callbacks and PostgreSQL:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Number and buffer fast on the WebSocket thread:&lt;/strong&gt; &lt;code&gt;QuoteWriter::Push&lt;/code&gt; increments a per-&lt;code&gt;(venue, symbol)&lt;/code&gt; 64-bit sequence counter (&lt;code&gt;seq&lt;/code&gt;), appends the quote to &lt;code&gt;mBuffer&lt;/code&gt;, and returns immediately. If &lt;code&gt;mBuffer&lt;/code&gt; hits &lt;code&gt;kMaxBatch&lt;/code&gt; (1,000 quotes), it wakes the writer thread early; otherwise the writer thread wakes every &lt;code&gt;500 ms&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Swap and flush off-thread:&lt;/strong&gt; &lt;code&gt;QuoteWriter::Flush&lt;/code&gt; acquires &lt;code&gt;mMutex&lt;/code&gt; just long enough to &lt;code&gt;batch.swap(mBuffer)&lt;/code&gt;, then releases the lock so incoming quotes never wait on SQL I/O. &lt;code&gt;QuoteStore::Save&lt;/code&gt; packs up to 1,000 rows (&lt;code&gt;kRowsPerInsert = 1000&lt;/code&gt; × 12 columns = 12,000 bind parameters, comfortably under PostgreSQL’s 65,535-parameter limit) into a single multi-row parameterized &lt;code&gt;INSERT&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retry without OOM or duplicate-key death spirals:&lt;/strong&gt; An early version of &lt;code&gt;QuoteStore::Save&lt;/code&gt; had no &lt;code&gt;ON CONFLICT&lt;/code&gt; clause. When a flush held more than 1,000 quotes, it split into multiple &lt;code&gt;INSERT&lt;/code&gt; statements; if the second statement failed, &lt;code&gt;Flush&lt;/code&gt; put the entire batch back in the buffer to retry. On the next flush, the first 1,000 rows—already committed—tripped the unique constraint every single time, wedging the buffer until it overflowed and dropped quotes. Commit &lt;code&gt;1dce515&lt;/code&gt; added &lt;code&gt;ON CONFLICT (venue, symbol, received_time, seq) DO NOTHING&lt;/code&gt;, which made retries idempotent. Failed batches are prepended back in front of newer quotes (preserving chronological order), and total buffered quotes are capped at &lt;code&gt;kMaxBuffered = 100,000&lt;/code&gt; so a long database outage drops the oldest quotes instead of running the machine out of RAM.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Keeping Sub-Millisecond Arrival Order Intact
&lt;/h3&gt;

&lt;p&gt;Kestrel timestamps quotes in UTC milliseconds (&lt;code&gt;std::chrono::sys_time&amp;lt;milliseconds&amp;gt;&lt;/code&gt;). That is plenty for bars and strategy timers, but on a busy crypto pair or liquid ETF, several quotes routinely land with the exact same millisecond timestamp.&lt;/p&gt;

&lt;p&gt;Migration 3 added a &lt;code&gt;seq BIGINT NOT NULL&lt;/code&gt; column to &lt;code&gt;quotes&lt;/code&gt; with &lt;code&gt;UNIQUE (venue, symbol, received_time, seq)&lt;/code&gt;. Inside &lt;code&gt;QuoteWriter::Push&lt;/code&gt;, &lt;code&gt;mSeqMutex&lt;/code&gt; is held across both incrementing &lt;code&gt;seq&lt;/code&gt; and pushing into &lt;code&gt;mBuffer&lt;/code&gt;, guaranteeing that sequence order strictly matches arrival order.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Prime()&lt;/code&gt; lets a caller (like &lt;code&gt;kestrel_app stream&lt;/code&gt;) preload the highest stored &lt;code&gt;seq&lt;/code&gt; per symbol before the WebSocket opens, so numbering continues smoothly across restarts without hitting PostgreSQL on the first tick. If an unprimed symbol arrives, &lt;code&gt;Push()&lt;/code&gt; falls back to a lookup. When backtests call &lt;code&gt;QuoteStore::Load&lt;/code&gt;, the query orders by &lt;code&gt;seq&lt;/code&gt;, replaying every tick in the exact order Kestrel originally saw it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Database Timeouts, Index Trimming, and TimescaleDB Compression
&lt;/h3&gt;

&lt;p&gt;Two final lessons showed up once Kestrel had been recording live sessions for a while.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bound every database wait.&lt;/strong&gt; As I mentioned in the last post, &lt;code&gt;Database::Query&lt;/code&gt; (&lt;code&gt;src/db/database.cpp&lt;/code&gt;) never automatically re-runs a failed SQL statement after a dropped connection. It accepts arbitrary SQL, including non-idempotent inserts like &lt;code&gt;TradeStore::StartRun&lt;/code&gt;‘s &lt;code&gt;INSERT INTO runs ... RETURNING run_id&lt;/code&gt;, so &lt;code&gt;EnsureConnected()&lt;/code&gt; reconnects on the &lt;em&gt;next&lt;/em&gt; call instead.&lt;/p&gt;

&lt;p&gt;What I hadn’t originally wired up were connection and statement timeouts, which meant a stalled database could hang a live stream thread indefinitely. Commit &lt;code&gt;1dce515&lt;/code&gt; added explicit libpq bounds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;connect_timeout=10&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;TCP keepalives every 10 s after 30 s idle, with 3 probes&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tcp_user_timeout=60000&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;a configurable &lt;code&gt;statement_timeout&lt;/code&gt;, defaulting to 5 minutes—long enough for large backtest quote loads, short enough to break a hung call&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Quotes grow fast—trim indexes and compress old chunks.&lt;/strong&gt; Recording 33 Schwab symbols eats roughly &lt;strong&gt;320 MB per session&lt;/strong&gt; uncompressed (~10 MB per symbol per session). Two changes in commit &lt;code&gt;4f478b4&lt;/code&gt; kept that manageable:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Migration 10 dropped two redundant indexes&lt;/strong&gt; (&lt;code&gt;quotes_venue_symbol_time&lt;/code&gt; and TimescaleDB’s default &lt;code&gt;quotes_received_time_idx&lt;/code&gt;). Because every quote query in Kestrel filters on &lt;code&gt;(venue, symbol)&lt;/code&gt;, the remaining &lt;code&gt;quotes_seq_unique (venue, symbol, received_time, seq)&lt;/code&gt; and &lt;code&gt;quotes_venue_symbol_seq&lt;/code&gt; indexes already served every read. That alone cut quote index size from &lt;strong&gt;1.8 GB down to 1.1 GB&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automatic TimescaleDB compression:&lt;/strong&gt; When Kestrel connects to a TimescaleDB community build (&lt;code&gt;timescaledb.license = 'timescale'&lt;/code&gt;, version 2.11+ so compressed chunks still accept &lt;code&gt;ON CONFLICT&lt;/code&gt; upserts), &lt;code&gt;Database::Migrate()&lt;/code&gt; enables native columnar compression. For &lt;code&gt;quotes&lt;/code&gt;, that means segmenting by &lt;code&gt;venue, symbol&lt;/code&gt;, ordering by &lt;code&gt;received_time, seq&lt;/code&gt;, and compressing 1-day chunks after 2 days; &lt;code&gt;market_trades&lt;/code&gt; (after 14 days) and &lt;code&gt;bars&lt;/code&gt; (after 7 days) get the same treatment. Setup runs with &lt;code&gt;SET LOCAL lock_timeout = '5s'&lt;/code&gt;, so startup waits at most a few seconds behind a long backtest read instead of blocking indefinitely. On Debian/Ubuntu’s Apache-only package, it gracefully skips compression and keeps working.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Side Note:&lt;/strong&gt; Turning on compression exposed a sneaky startup trap during code review. If &lt;code&gt;QuoteStore::LastSeq()&lt;/code&gt; ran an unbounded &lt;code&gt;MAX(seq)&lt;/code&gt; for a symbol, TimescaleDB could end up scanning and decompressing weeks of old chunks just to find the last sequence number at startup. &lt;code&gt;LastSeq()&lt;/code&gt; now does a two-step lookup. First it grabs the newest &lt;code&gt;received_time&lt;/code&gt; via &lt;code&gt;ORDER BY received_time DESC, seq DESC LIMIT 1&lt;/code&gt;, which stops at the newest chunk thanks to TimescaleDB’s ordered &lt;code&gt;ChunkAppend&lt;/code&gt;. Then it takes &lt;code&gt;MAX(seq)&lt;/code&gt; over just the trailing 1-hour window &lt;code&gt;[received_time - 1 hour, received_time]&lt;/code&gt;. That window catches small backward clock steps (like an NTP adjustment where a higher &lt;code&gt;seq&lt;/code&gt; landed at an earlier millisecond) while still letting TimescaleDB prune every older compressed chunk.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;None of what I covered here is flashy. There is no custom kernel networking, no lock-free ring buffer written in inline assembly, and no secret indicator. It is mostly boring systems engineering:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep &lt;code&gt;double&lt;/code&gt; out of your accounting types &lt;em&gt;and&lt;/em&gt; out of your JSON boundary.&lt;/li&gt;
&lt;li&gt;Treat unknown network outcomes as unknown—never blindly retry a non-idempotent write.&lt;/li&gt;
&lt;li&gt;Measure latency per endpoint before guessing, and don’t throw away warm TLS connections on every call.&lt;/li&gt;
&lt;li&gt;Decouple hot streaming threads from disk I/O with bounded, idempotent batches and indexes that match your actual queries.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next up in the series is &lt;strong&gt;Integrating Crypto Exchanges and Charles Schwab&lt;/strong&gt; —what it took to put Binance.US, Kraken, and Charles Schwab behind one &lt;code&gt;DataSource&lt;/code&gt; and &lt;code&gt;TradingVenue&lt;/code&gt; interface, including Schwab’s 7-day OAuth refresh cycle, US equity market-hours gating, and the places where live exchange behavior disagreed with the official docs.&lt;/p&gt;

&lt;p&gt;If you’ve built financial or market-data systems in C++ (or another language), what subtle bug bit you first—floating-point drift, retry semantics, connection pooling, or database growth? Let me know in the comments!&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://blog.taylorbuiltsolutions.com/cpp-under-the-hood-trading-bot/" rel="noopener noreferrer"&gt;C++ Under the Hood: Money, Latency, and Safety&lt;/a&gt; appeared first on &lt;a href="https://blog.taylorbuiltsolutions.com" rel="noopener noreferrer"&gt;Taylor Built Solutions&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kestrel</category>
      <category>cpp23</category>
    </item>
    <item>
      <title>Building a C++23 Trading Tool With AI Coding Agents (Without Making Spaghetti)</title>
      <dc:creator>Taylor R Price</dc:creator>
      <pubDate>Wed, 18 Nov 2026 01:54:04 +0000</pubDate>
      <link>https://dev.to/trpricesoftware/building-a-c23-trading-tool-with-ai-coding-agents-without-making-spaghetti-5b98</link>
      <guid>https://dev.to/trpricesoftware/building-a-c23-trading-tool-with-ai-coding-agents-without-making-spaghetti-5b98</guid>
      <description>&lt;p&gt;&lt;strong&gt;BLUF –&lt;/strong&gt; AI coding agents will happily turn out thousands of lines of working-looking C++ in an afternoon. Left alone, they will also quietly bake in concurrency bugs, duplicated logic and optimistic assumptions about external APIs. Keeping Kestrel clean came down to two things: automated “house rules” set up early (narrow interfaces, &lt;code&gt;.clang-format&lt;/code&gt;, &lt;code&gt;.clang-tidy&lt;/code&gt;, sanitizers) and never letting a single AI model grade its own homework.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In this post:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What AI Coding Agents and Models Did I Use?&lt;/li&gt;
&lt;li&gt;Multi-Model AI Code Review: Never Let One Model Grade Its Own Homework&lt;/li&gt;
&lt;li&gt;C++ Guardrails for AI Coding Agents (How Not to Make Spaghetti)&lt;/li&gt;
&lt;li&gt;Real Live-Money Bugs Caught Before They Cost Anything&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In &lt;a href="https://blog.taylorbuiltsolutions.com/introducing-kestrel-stock-crypto-trading-tool/" rel="noopener noreferrer"&gt;my last post&lt;/a&gt; I introduced &lt;a href="https://github.com/trprice/kestrel" rel="noopener noreferrer"&gt;Kestrel&lt;/a&gt;, a C++23 library and command-line tool for pulling stock and cryptocurrency market data, backtesting trading strategies, paper trading, and placing live orders on Binance.US and Charles Schwab. (A Kraken live venue has just landed and is still waiting on its funded-account order check). One of my two main goals with Kestrel was to find out how far agentic AI coding tools can be pushed on a non-trivial C++ project before the codebase turns into a giant pile of spaghetti.&lt;/p&gt;

&lt;p&gt;When I started writing about AI on this blog last year (&lt;a href="https://blog.taylorbuiltsolutions.com/llms-using-ollama-and-open-webui/" rel="noopener noreferrer"&gt;setting up Ollama and Open WebUI at home&lt;/a&gt;, and then &lt;a href="https://blog.taylorbuiltsolutions.com/software-development-isnt-writing-code/" rel="noopener noreferrer"&gt;why software development isn’t writing code&lt;/a&gt;), I was firmly in the camp of engineers who didn’t want LLMs anywhere near production-style C++. Twenty years of maintaining legacy and embedded C++ will make you allergic to “magic” code nobody on the team actually understands. At the same time, burying my head in the sand wasn’t an option either.&lt;/p&gt;

&lt;p&gt;I intentionally didn’t hide the AI’s involvement in Kestrel. Almost every AI-written commit title starts with the model (and tool) that wrote it. As I write this, 102 of the first 132 commits carry an Opus 5.5 prefix, 5 are Gemini 4 work reviewed by Opus, 2 are Sonnet 5.5, and 1 carries an &lt;code&gt;OpenCode / GLM-5.3-Flash&lt;/code&gt; prefix (plus an earlier GLM review commit). Most of the rest are mine: formatting, the Dockerfile, sanitizer settings and TODO updates.&lt;/p&gt;

&lt;p&gt;In this post I’ll walk through which tools and models I used, the multi-model review workflow I settled into, and the C++ guardrails that kept a fast-moving AI-assisted project from collapsing under its own weight.&lt;/p&gt;

&lt;h2&gt;
  
  
  What AI Coding Agents and Models Did I Use?
&lt;/h2&gt;

&lt;p&gt;Rather than marrying myself to a single vendor or subscription, I rotated across three agentic coding tools and six models:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://claude.com/product/claude-code" rel="noopener noreferrer"&gt;&lt;strong&gt;Claude Code&lt;/strong&gt;&lt;/a&gt; running &lt;strong&gt;Claude Opus 5.5&lt;/strong&gt; and &lt;strong&gt;Sonnet 5.5&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://antigravity.google/" rel="noopener noreferrer"&gt;&lt;strong&gt;Antigravity&lt;/strong&gt;&lt;/a&gt; running &lt;strong&gt;Gemini 4 Carbon&lt;/strong&gt; and &lt;strong&gt;Gemini 4 Argon&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://opencode.ai/" rel="noopener noreferrer"&gt;&lt;strong&gt;OpenCode&lt;/strong&gt;&lt;/a&gt; running &lt;strong&gt;GLM-5.3&lt;/strong&gt; and &lt;strong&gt;GLM-5.3-Flash&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each combination ended up with its own personality and sweet spot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Opus 5.5 in Claude Code&lt;/strong&gt; did most of the heavy lifting: the initial architecture, multi-file C++23 changes, and the fiddly state machines (like the &lt;code&gt;Runner&lt;/code&gt; event loop and the strategies’ order lifecycles). &lt;strong&gt;Sonnet 5.5&lt;/strong&gt; ran in a subagent for quick first-pass reviews, and wrote a couple of smaller features itself (such as &lt;a href="https://github.com/trprice/kestrel/commit/56da6b2cd7531fe6581698e86d62cb1b6a23f99e" rel="noopener noreferrer"&gt;splitting HTTP latency stats into per-run and sliding-window views&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gemini 4 Carbon and Argon in Antigravity&lt;/strong&gt; were my cross-examination reviewers, and real feature builders too. They wrote Kestrel’s &lt;a href="https://github.com/trprice/kestrel/commit/b693c5300e9000f8c401550223afa85b5f102fcc" rel="noopener noreferrer"&gt;Fair Value Gap breakout setup&lt;/a&gt;, &lt;a href="https://github.com/trprice/kestrel/commit/a0281758d1d7af6fb9b198da8f7bb5313c61d9ab" rel="noopener noreferrer"&gt;closed the market-hours gaps in the risk gate&lt;/a&gt;, and replaced the Kraken live trading stub with a &lt;a href="https://github.com/trprice/kestrel/commit/99c153f896da388c4c4ac79ad48699ad424d27f8" rel="noopener noreferrer"&gt;full &lt;code&gt;KrakenTradingVenue&lt;/code&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GLM-5.3 and GLM-5.3-Flash in OpenCode&lt;/strong&gt; were a quick, independent third set of eyes for sweeping reviews, auditing &lt;code&gt;TODO.md&lt;/code&gt;, and tightening documentation around operational edge cases (like &lt;a href="https://github.com/trprice/kestrel/commit/1f26f47fbd6f28bfa4a36a8c4ab08af05037f393" rel="noopener noreferrer"&gt;spelling out what a live Binance.US run &lt;em&gt;can’t&lt;/em&gt; see at startup&lt;/a&gt; about spot holdings you already had).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Multi-Model AI Code Review: Never Let One Model Grade Its Own Homework
&lt;/h2&gt;

&lt;p&gt;The thing that helped Kestrel the most wasn’t a clever prompt template. It was pitting different models and tools against each other on uncommitted code.&lt;/p&gt;

&lt;p&gt;For a non-trivial feature, my loop usually looked like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Write, plus a subagent review, in Claude Code:&lt;/strong&gt;  &lt;strong&gt;Opus 5.5&lt;/strong&gt; implements the feature or fix (with GoogleTest coverage and doc updates), and a &lt;strong&gt;Sonnet 5.5&lt;/strong&gt; subagent reviews it first. The Opus agent makes fixes from the review and has Sonnet re-review to see if anything new was introduced.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-tool review in Antigravity:&lt;/strong&gt; Before committing anything, I copy Claude’s summary of the changes over to &lt;strong&gt;Antigravity&lt;/strong&gt; and ask &lt;strong&gt;Gemini 4&lt;/strong&gt; (Carbon or Argon) to read that summary and the uncommitted &lt;code&gt;git&lt;/code&gt; diff in the working tree, and give me a code review.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify and fix back in Claude Code:&lt;/strong&gt; I paste Gemini’s review back into &lt;strong&gt;Claude Code&lt;/strong&gt; and tell &lt;strong&gt;Opus 5.5&lt;/strong&gt; to check every finding against the actual code, fix what holds up, and push back on what doesn’t.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn4biks3igf63qxvlw4gv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn4biks3igf63qxvlw4gv.png" alt="Diagram of Kestrel's cross-model AI code review workflow: Opus 5.5 writes in Claude Code, Gemini 4 reviews the uncommitted diff in Antigravity, and Opus 5.5 verifies each finding before tests pass and commit, plus reverse reviews and periodic OpenCode GLM-5.3 sweeps." width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I ran the same loop in reverse too: &lt;strong&gt;Gemini 4 Carbon or Argon&lt;/strong&gt; writes the feature in Antigravity, and &lt;strong&gt;Opus 5.5 in Claude Code&lt;/strong&gt; plays the skeptical reviewer. That’s why several recent commits carry two names, like &lt;code&gt;Gemini 4 Carbon / Claude Opus 5.5&lt;/code&gt;. Every so often I’d also turn &lt;strong&gt;OpenCode&lt;/strong&gt; with &lt;strong&gt;GLM-5.3&lt;/strong&gt; or &lt;strong&gt;GLM-5.3-Flash&lt;/strong&gt; loose on a bigger section of the repository to see what the other two had walked past.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Cross-Model Code Reviews Work
&lt;/h3&gt;

&lt;p&gt;Why bother copying summaries back and forth between tools when Claude Code can already spawn its own review subagent Because a reviewer with different context finds different things.&lt;/p&gt;

&lt;p&gt;When an agent writes a feature, its context window is full of the dead ends it tried, the assumptions it made about an exchange’s API, and its own story of &lt;em&gt;why&lt;/em&gt; the approach should work. Even a fresh subagent from the same model family tends to share the same blind spots.&lt;/p&gt;

&lt;p&gt;Drop an uncommitted diff and a short summary into a separate tool running a different model family, and that second agent has none of the author’s sunk-cost context. All it sees is what you claimed you changed versus what the C++ in the working tree actually does. Over and over, the second model asked uncomfortable questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;“What happens if this order partially fills right before it expires?”&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;“What happens if a drawdown limit trips on a stock position at 5:30 PM, when the market is closed?”&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;“Does Kraken take a sell order’s fee from the base asset or the quote asset by default?”&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The other half matters just as much: &lt;strong&gt;I didn’t let the author model blindly accept every review comment either.&lt;/strong&gt; LLMs love to be agreeable (“You’re absolutely right!”), which is a great way to introduce &lt;em&gt;new&lt;/em&gt; bugs during a code review. Every finding had to be checked against the code and real exchange behavior before anything changed.&lt;/p&gt;

&lt;p&gt;Two examples from Kestrel’s history stand out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;During one project review, a reviewer flagged that Kestrel’s database wrapper didn’t automatically re-run a SQL statement if the PostgreSQL connection dropped mid-call, and that the backtester didn’t reject cached bar series with time gaps in them. Checking both against reality showed why leaving them out was right. Blindly re-running a statement after a lost connection can insert a fill twice. And exchanges have real maintenance outages that leave permanent gaps in historical bars, so a gap check would have every backtest re-downloading history forever.&lt;/li&gt;
&lt;li&gt;When &lt;a href="https://github.com/trprice/kestrel/commit/4a157826ab8d0e27fdd6591e471585014239cdda" rel="noopener noreferrer"&gt;testing Fair Value Gap setups across crypto and stocks&lt;/a&gt;, Opus re-ran Gemini’s standalone research simulation with its own independent code and found two simulator mistakes. One filled resting buy limits at the limit price even when a bar gapped open below it and the stop, which made losses look worse than they were. The other compared the gap entries against a control that bought at a shallower pullback. With fills at the open (the way Kestrel’s own backtester already does it) and the control at the same depth, the gaps filled and bounced like any other three-bar move of the same size, and none of the variations beat simply holding the same coins and stocks. Neither model’s first read of the results would have held up on its own. (As always, none of this is financial advice.)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  C++ Guardrails for AI Coding Agents (How Not to Make Spaghetti)
&lt;/h2&gt;

&lt;p&gt;Cross-model reviews catch logic flaws, business-rule edge cases and bad assumptions. What they &lt;em&gt;won’t&lt;/em&gt; save you from is structural drift, if the codebase doesn’t have mechanical guardrails.&lt;/p&gt;

&lt;p&gt;Right after the &lt;a href="https://github.com/trprice/kestrel/commit/e5b5ea112d9f7637d1265c8f39374200bf05b668" rel="noopener noreferrer"&gt;initial commit&lt;/a&gt; I hit pause on new features to set the ground rules for naming and formatting. The rest of the guardrails were layered on over the next three weeks: the offline Docker environment, then sanitizers, then CI, then &lt;code&gt;clang-tidy&lt;/code&gt;. From the day each one landed, every change, mine or an agent’s, had to get past it.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Clean Interfaces and One-Way Dependencies
&lt;/h3&gt;

&lt;p&gt;Spaghetti happens when everything is allowed to talk to everything else. As I covered in the introduction, Kestrel follows the same three-step loop I used on embedded control systems (read inputs, decide, write outputs), held in place by strict interfaces:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Strategies only see &lt;code&gt;Strategy&lt;/code&gt; hooks and a &lt;code&gt;Context&lt;/code&gt; interface. They know nothing about HTTP, JSON, WebSockets or SQL, or whether they’re talking to Binance.US, Kraken, Schwab, &lt;code&gt;PaperTradingVenue&lt;/code&gt; or &lt;code&gt;ReplayDataSource&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;WebSocket threads only push incoming events onto a queue. A single &lt;code&gt;Runner&lt;/code&gt; thread hands them to the strategy one at a time, so strategy code isn’t littered with mutexes.&lt;/li&gt;
&lt;li&gt;Dependencies flow one way (&lt;code&gt;app&lt;/code&gt; -&amp;gt; &lt;code&gt;factory&lt;/code&gt; -&amp;gt; domain interfaces), and early on I &lt;a href="https://github.com/trprice/kestrel/commit/cb08b71bbb196f4fe09ec6ffa7c45673a1730b05" rel="noopener noreferrer"&gt;stripped &lt;code&gt;main.cpp&lt;/code&gt; down to thin CLI11 subcommands&lt;/a&gt; so almost the whole application lives in &lt;code&gt;libkestrel&lt;/code&gt;, where &lt;a href="https://github.com/google/googletest" rel="noopener noreferrer"&gt;GoogleTest&lt;/a&gt; (&lt;code&gt;kestrel_tests&lt;/code&gt;) can hammer on it directly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Narrow interfaces keep agents on a short leash. When adding a strategy or an exchange means implementing one well-defined header, with fakes ready for the tests (&lt;code&gt;RecordingVenue&lt;/code&gt;, &lt;code&gt;FakeTradeLog&lt;/code&gt; and &lt;code&gt;RoutedHttp&lt;/code&gt;), an agent has a much harder time tangling unrelated parts of the system together.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Formatting and Readability Rules in the First Few Days
&lt;/h3&gt;

&lt;p&gt;When three model families edit the same C++ files, style consistency goes out the window unless a machine enforces it. The &lt;a href="https://github.com/trprice/kestrel/commit/96a0df8786a7d3670a11fd2e2840023d9cc1451a" rel="noopener noreferrer"&gt;second commit&lt;/a&gt; and the &lt;a href="https://github.com/trprice/kestrel/commit/d36e092254b30c62d166a62174dcad814945ca24" rel="noopener noreferrer"&gt;fourth&lt;/a&gt; set the rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Class member variables follow the &lt;code&gt;mVariable&lt;/code&gt; pattern, so member state jumps out when you’re reading a diff.&lt;/li&gt;
&lt;li&gt;Every &lt;code&gt;if&lt;/code&gt; statement, even a one-liner, was supposed to get braces on separate lines for human readability (and so nobody pulls a &lt;code&gt;goto fail&lt;/code&gt; during a merge). I did a pass on day one to add them, forgot to turn off Google style’s single-line &lt;code&gt;if&lt;/code&gt; allowance in &lt;code&gt;.clang-format&lt;/code&gt;, and the agents quietly slipped a hundred unbraced early-returns back in over the next month. Point proven: agents only keep style rules a machine actually enforces.&lt;/li&gt;
&lt;li&gt;A &lt;a href="https://clang.llvm.org/docs/ClangFormat.html" rel="noopener noreferrer"&gt;&lt;code&gt;.clang-format&lt;/code&gt;&lt;/a&gt; file based on the Google C++ style keeps whitespace, includes and alignment identical no matter which agent wrote the code.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Compiler Warnings and a Signal-Only &lt;code&gt;.clang-tidy&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Every target (&lt;code&gt;kestrel&lt;/code&gt;, &lt;code&gt;kestrel_app&lt;/code&gt; and &lt;code&gt;kestrel_tests&lt;/code&gt;) compiles with &lt;code&gt;-Wall -Wextra -Wpedantic&lt;/code&gt;, and the Docker test container and CI add &lt;code&gt;-Werror&lt;/code&gt; (&lt;code&gt;-DKESTREL_WERROR=ON&lt;/code&gt;), so a new warning breaks the build.&lt;/p&gt;

&lt;p&gt;On top of that, I added a &lt;a href="https://github.com/trprice/kestrel/commit/a9aea900a075b681dc77c5bbf285a7584302bc75" rel="noopener noreferrer"&gt;&lt;code&gt;.clang-tidy&lt;/code&gt; configuration&lt;/a&gt; that turns on the &lt;a href="https://clang.llvm.org/extra/clang-tidy/" rel="noopener noreferrer"&gt;clang-tidy&lt;/a&gt; check families that actually find C++ bugs: &lt;code&gt;bugprone-*&lt;/code&gt;, &lt;code&gt;performance-*&lt;/code&gt;, &lt;code&gt;concurrency-*&lt;/code&gt;, &lt;code&gt;clang-analyzer-*&lt;/code&gt;, &lt;code&gt;cppcoreguidelines-*&lt;/code&gt; and &lt;code&gt;misc-*&lt;/code&gt; (minus the style-only rules).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Side Note:&lt;/strong&gt; If you turn on every &lt;code&gt;clang-tidy&lt;/code&gt; rule in a modern C++23 codebase and hand the output to an AI agent, it will happily spend hours mangling clean code to silence style nits. Kestrel’s first pass gave 556 warnings. None were live bugs, a handful were worth hardening, and the rest were noise. We fixed the handful and turned the noisy checks off right in &lt;code&gt;.clang-tidy&lt;/code&gt;, &lt;em&gt;with a comment on each saying why&lt;/em&gt;. For example, &lt;code&gt;bugprone-unchecked-optional-access&lt;/code&gt; flagged 158 spots, and every one we sampled was already guarded by a container or an earlier check it couldn’t see. The hardening:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Made the base interfaces non-copyable, since their implementations stop background streams in their destructors and a copy would stop a stream twice;&lt;/li&gt;
&lt;li&gt;Marked the stream classes &lt;code&gt;final&lt;/code&gt;, so a destructor’s &lt;code&gt;Stop()&lt;/code&gt; call can’t miss an override;&lt;/li&gt;
&lt;li&gt;Zeroed struct members that had been left uninitialized;&lt;/li&gt;
&lt;li&gt;Added top-level exception logging in &lt;code&gt;main&lt;/code&gt;, so an escaping error can’t end in a silent &lt;code&gt;std::terminate&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Sanitizers (ASan, UBSan and TSan)
&lt;/h3&gt;

&lt;p&gt;C++ will let code compile cleanly, pass its tests nine times out of ten, and still hide undefined behavior or data races. In &lt;code&gt;CMakeLists.txt&lt;/code&gt;, &lt;code&gt;-DKESTREL_SANITIZE=address,undefined&lt;/code&gt; and &lt;code&gt;-DKESTREL_SANITIZE=thread&lt;/code&gt; instrument Kestrel &lt;em&gt;and&lt;/em&gt; the dependencies it fetches with &lt;a href="https://clang.llvm.org/docs/AddressSanitizer.html" rel="noopener noreferrer"&gt;AddressSanitizer&lt;/a&gt;, &lt;a href="https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html" rel="noopener noreferrer"&gt;UndefinedBehaviorSanitizer&lt;/a&gt; or &lt;a href="https://clang.llvm.org/docs/ThreadSanitizer.html" rel="noopener noreferrer"&gt;ThreadSanitizer&lt;/a&gt;. &lt;code&gt;-fno-sanitize-recover=undefined&lt;/code&gt; makes undefined behavior abort the test on the spot instead of printing a polite warning and carrying on.&lt;/p&gt;

&lt;p&gt;ThreadSanitizer &lt;a href="https://github.com/trprice/kestrel/commit/5d291765aae72659167cca4c9f0bc2c62e35f1c9" rel="noopener noreferrer"&gt;paid for itself on its very first run&lt;/a&gt;. Kestrel’s &lt;code&gt;Runner&lt;/code&gt;, WebSocket streams, venue pollers, and &lt;code&gt;QuoteWriter&lt;/code&gt; all run on their own threads, and TSan immediately flagged a race in our own test harness: a &lt;code&gt;RunnerTest&lt;/code&gt; polled &lt;code&gt;log-&amp;gt;snapshots.size()&lt;/code&gt; from the main test thread while &lt;code&gt;Runner::Run()&lt;/code&gt; was appending to that same &lt;code&gt;FakeTradeLog&lt;/code&gt; on the runner thread. Without TSan, that kind of bug sits quietly until it corrupts memory on some random CI run months later.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. An Offline Docker Sandbox (&lt;code&gt;--network none&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Letting an agent run shell commands to build and test a live-trading application has an obvious hazard: you &lt;em&gt;really&lt;/em&gt; don’t want a test run touching live exchange endpoints or reading real API keys.&lt;/p&gt;

&lt;p&gt;So Kestrel has an &lt;a href="https://github.com/trprice/kestrel/commit/99ae44a80271492e511df2c7b4357740428710cc" rel="noopener noreferrer"&gt;Ubuntu 26.04 &lt;code&gt;Dockerfile&lt;/code&gt;&lt;/a&gt; that pre-installs GCC, CMake, Ninja, &lt;code&gt;linux-perf&lt;/code&gt;, IXWebSocket, and PostgreSQL 18 with TimescaleDB. It sets up a non-superuser &lt;code&gt;kestrel_test&lt;/code&gt; database when the image is built, and then, when the container runs, builds Kestrel and runs all 1,000+ tests with the network unplugged. That includes the database integration tests, which use real market data checked in under &lt;code&gt;tests/data/market/&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="sb"&gt;`docker build -t kestrel-test .
docker run --rm --network none -v "$PWD":/src kestrel-test`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/trprice/kestrel/commit/e44c315436580f8e12965eb78e2cc86d94a306ed" rel="noopener noreferrer"&gt;GitHub Actions CI&lt;/a&gt; runs the same &lt;code&gt;--network none&lt;/code&gt; container on every push. If an agent writes a test or startup path that reaches out over the network instead of going through a fake or a fixture, it fails right there, every time.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. &lt;code&gt;docs/&lt;/code&gt; and &lt;code&gt;TODO.md&lt;/code&gt; as External Memory
&lt;/h3&gt;

&lt;p&gt;An underrated trap with AI coding agents is amnesia. Every session starts fresh and, if your design rules only live in yesterday’s chat, today’s agent will happily invent a second way of calculating P&amp;amp;L or parsing the config file. Additionally it provides me a way of reasoning about the code when much of it was written by a model.&lt;/p&gt;

&lt;p&gt;In Kestrel, documentation isn’t written at the end of a milestone. It’s part of the definition of done for almost every commit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;docs/design.md&lt;/code&gt; lays out the thread model, the data flow and which class owns what (&lt;code&gt;PnlTracker&lt;/code&gt; is the single average-cost calculation; &lt;code&gt;factory.cpp&lt;/code&gt; is the only place that maps config names to concrete classes).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docs/strategies&lt;/code&gt;and &lt;code&gt;docs/venues&lt;/code&gt; provide locations for documentation of strategies and venue specific gotchas.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;TODO.md&lt;/code&gt; tracks priorities, in-progress checklists (like the real-account checks for Schwab and Kraken), known limitations, and notes on &lt;em&gt;why&lt;/em&gt; certain ideas were tested and rejected, so a future session doesn’t suggest them all over again.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Real Live-Money Bugs Caught Before They Cost Anything
&lt;/h2&gt;

&lt;p&gt;To make this concrete, here are a few real bugs that cross-model reviews and scripted tests caught before they could bite a live account:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Refusing to sell during a risk halt on Binance.US:&lt;/strong&gt; When &lt;code&gt;RiskGatedVenue&lt;/code&gt; trips a halt or the daily loss limit, it blocks new entries and only lets through sells up to what’s currently held. On the paper venue, &lt;code&gt;GetPositions()&lt;/code&gt; reports holdings. Binance.US spot has no “positions” endpoint, though, so it came back empty. During an emergency halt on Binance.US, the risk gate saw &lt;code&gt;0&lt;/code&gt; held and &lt;em&gt;refused the protective sell trying to close what the run had just bought!&lt;/em&gt; Cross-review caught it, and &lt;a href="https://github.com/trprice/kestrel/commit/a53be43c9fc8fc80ad18fe30bf671df1b7a0fcde" rel="noopener noreferrer"&gt;the gate now counts the larger of the venue’s positions and what has filled during the run&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manual CLI orders skipping &lt;code&gt;[risk]&lt;/code&gt;:&lt;/strong&gt; The &lt;code&gt;Runner&lt;/code&gt; wrapped venues in &lt;code&gt;RiskGatedVenue&lt;/code&gt;, but the standalone &lt;code&gt;kestrel_app order&lt;/code&gt; command originally talked straight to the raw venue. That skipped &lt;code&gt;max_order_notional&lt;/code&gt; and the symbol allowlist unless you kept every rule in your head. It now &lt;a href="https://github.com/trprice/kestrel/commit/a53be43c9fc8fc80ad18fe30bf671df1b7a0fcde" rel="noopener noreferrer"&gt;goes through &lt;code&gt;ManualOrderLimits&lt;/code&gt; by default&lt;/a&gt; (&lt;code&gt;--test&lt;/code&gt; orders included).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Partially filled entries left unprotected:&lt;/strong&gt; &lt;code&gt;PaperTradingVenue&lt;/code&gt; fills stop orders whole, which hid a live-venue bug in the &lt;code&gt;breakout&lt;/code&gt; strategy. If an entry partially filled on a real order book and the rest expired or was cancelled, that partial position could sit open with no protective stop. Review caught the hole in the state machine, and the fix came with &lt;a href="https://github.com/trprice/kestrel/commit/30dc9a3669f7c7190672ff4f9743633e551b1bea" rel="noopener noreferrer"&gt;scripted partial-fill tests&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fee drift on Kraken:&lt;/strong&gt; By default, Kraken takes a sell’s fee out of the base asset (the coin), while fill reports state the fee in the quote currency. Kestrel’s position tracking would have drifted a little on every sell. Now &lt;a href="https://github.com/trprice/kestrel/commit/99c153f896da388c4c4ac79ad48699ad424d27f8" rel="noopener noreferrer"&gt;every Kraken order passes &lt;code&gt;oflags=fciq&lt;/code&gt;&lt;/a&gt; to take the fee in the quote currency, and &lt;a href="https://github.com/trprice/kestrel/commit/a0281758d1d7af6fb9b198da8f7bb5313c61d9ab" rel="noopener noreferrer"&gt;&lt;code&gt;PnlTracker&lt;/code&gt; takes any fee paid in the base asset off what’s held&lt;/a&gt; for the cases where one still happens.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Back in the summer of 2025 I wrote that &lt;a href="https://blog.taylorbuiltsolutions.com/software-development-isnt-writing-code/" rel="noopener noreferrer"&gt;software development isn’t writing code&lt;/a&gt;. Building Kestrel with AI coding agents has provided great evidence for that.&lt;/p&gt;

&lt;p&gt;Opus 5.5, Sonnet 5.5, Gemini 4 Carbon and Argon, and GLM-5.3 and its Flash variant turned months of C++23 boilerplate, exchange REST and WebSocket plumbing, SQL migrations and test scaffolding into weeks. But my job didn’t turn into clicking “Accept All.” Nearly all of it moved into the parts of engineering that actually prevent spaghetti: designing clean interfaces, setting up ruthless automated checks (&lt;code&gt;.clang-tidy&lt;/code&gt;, ASan/UBSan/TSan, offline Docker tests), running reviews across models that don’t share each other’s blind spots, and checking every claim against recorded data and the real APIs.&lt;/p&gt;

&lt;p&gt;Next up in the Kestrel series is &lt;strong&gt;C++ Under the Hood: Money, Latency, and Safety&lt;/strong&gt;. I’ll cover fixed-point &lt;code&gt;Decimal&lt;/code&gt; math with &lt;code&gt;__int128&lt;/code&gt;, why Kestrel never blindly retries a timed-out order placement, how keeping HTTPS connections open cut the median call to Binance.US’s servers in Tokyo from about 430 ms to 130 ms, and keeping TimescaleDB fast with a steady stream of quotes coming in.&lt;/p&gt;

&lt;p&gt;Have you tried pitting AI models against each other in code reviews on your own projects, or found other guardrails that keep agents honest in C++? Let me know in the comments or reach out. I’d love to hear what’s working (and what isn’t) for you!&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://blog.taylorbuiltsolutions.com/building-with-ai-coding-agents/" rel="noopener noreferrer"&gt;Building a C++23 Trading Tool With AI Coding Agents (Without Making Spaghetti)&lt;/a&gt; appeared first on &lt;a href="https://blog.taylorbuiltsolutions.com" rel="noopener noreferrer"&gt;Taylor Built Solutions&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kestrel</category>
      <category>aicodingagents</category>
      <category>clangtidy</category>
      <category>claudecode</category>
    </item>
    <item>
      <title>Introducing Kestrel – A C++23 Stock and Crypto Trading Tool</title>
      <dc:creator>Taylor R Price</dc:creator>
      <pubDate>Sun, 15 Nov 2026 18:49:26 +0000</pubDate>
      <link>https://dev.to/trpricesoftware/introducing-kestrel-a-c23-stock-and-crypto-trading-tool-5h2i</link>
      <guid>https://dev.to/trpricesoftware/introducing-kestrel-a-c23-stock-and-crypto-trading-tool-5h2i</guid>
      <description>&lt;p&gt;In a couple of my recent posts I talked about &lt;a href="https://blog.taylorbuiltsolutions.com/back-to-the-job-hunt/" rel="noopener noreferrer"&gt;figuring out what is next in my career&lt;/a&gt; and my &lt;a href="https://blog.taylorbuiltsolutions.com/bitcoin-solo-mining-adventure/" rel="noopener noreferrer"&gt;adventure into solo mining cryptocurrency&lt;/a&gt;. Two themes came out of those posts: I like giving my computers something interesting to do while I’m not sitting at them, and I wanted to spend serious time learning how far agentic AI programming tools can be pushed without letting them turn a codebase into a plate of spaghetti. Those two interests collided over the last month and turned into my latest project: &lt;a href="https://github.com/trprice/kestrel" rel="noopener noreferrer"&gt;Kestrel&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Before going any further I’ll start with the same kind of disclaimer I gave in my solo mining post: nothing here is financial advice, and I am under no illusion that throwing a trading bot at the stock or crypto markets is an easy way to print money. In fact, one of the most interesting parts of building Kestrel has been watching it prove (with math and recorded market data) why several obvious trading ideas lose money once fees, slippage, and network latency enter the picture.&lt;/p&gt;

&lt;p&gt;There is quite a bit going on in this project, so this post will be the first in a multi-part series. Today I’d like to introduce what Kestrel is at a high level, how it is put together, how to get it up and running, and preview what I plan to cover in upcoming posts.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What Is Kestrel?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;BLUF&lt;/strong&gt; – Kestrel is a C++23 library and command-line tool (&lt;code&gt;kestrel_app&lt;/code&gt;) for gathering stock and cryptocurrency price data, backtesting trading strategies, paper trading on live feeds, and executing live orders.&lt;/p&gt;

&lt;p&gt;At the time of writing Kestrel talks to three providers across both crypto and traditional US equities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Binance.US&lt;/strong&gt; – Crypto spot market data (REST historical bars, live WebSocket quotes and bars, and public trade history) along with full live order execution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kraken&lt;/strong&gt; – Crypto spot market data over REST and WebSocket. Paper trading works today; the live trading venue is still a stub on the TODO list.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Charles Schwab&lt;/strong&gt; – US stocks and ETFs via Schwab’s OAuth API and WebSocket streamer, complete with US equity market-hours awareness. Paper trading works out of the box, and the live trading venue has placed real test market orders (kept behind an explicit config flag (&lt;code&gt;[schwab] live_trading = true&lt;/code&gt;) while I finish verifying resting limits, stops, and OCO – &lt;code&gt;one-cancels-other&lt;/code&gt; – pairs).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How Is Kestrel Put Together?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In my last job I worked on embedded C++ applications that followed a strict, time-bound three-step control loop:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Read information from the inputs&lt;/li&gt;
&lt;li&gt;Decide what to do based on current state&lt;/li&gt;
&lt;li&gt;Write commands out to the outputs&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When you squint at an automated trading system, it wants to be the exact same loop. Market data comes in, a strategy decides whether to act, and orders go out.&lt;/p&gt;

&lt;p&gt;The core design goal in Kestrel was to keep those boundaries clean behind interfaces so a strategy never knows (or cares) whether it is running in a historical backtest, paper trading on live data, or trading real money:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;data::DataSource&lt;/code&gt;&lt;/strong&gt; handles the read side: pulling historical &lt;a href="https://en.wikipedia.org/wiki/Open-high-low-close_chart" rel="noopener noreferrer"&gt;OHLCV bars&lt;/a&gt;, looking up symbol tick/lot rules, and streaming live quotes or closed bars over WebSockets. Provider-specific quirks (like whether Bitcoin is called &lt;code&gt;BTCUSDT&lt;/code&gt;, &lt;code&gt;XXBTZUSD&lt;/code&gt;, or &lt;code&gt;BTC/USD&lt;/code&gt;) stop at the edge; inside Kestrel a pair always has the form &lt;code&gt;BTC/USD&lt;/code&gt; and a stock is &lt;code&gt;AAPL&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Strategy&lt;/code&gt; and &lt;code&gt;Runner&lt;/code&gt;&lt;/strong&gt; handle the decision step. WebSocket threads only push incoming events onto a queue. A single &lt;code&gt;Run()&lt;/code&gt; thread pulls events off one at a time and calls hooks on the strategy (&lt;code&gt;OnBar&lt;/code&gt;, &lt;code&gt;OnQuote&lt;/code&gt;, &lt;code&gt;OnFill&lt;/code&gt;, &lt;code&gt;OnOrderUpdate&lt;/code&gt;, &lt;code&gt;OnTimer&lt;/code&gt;, and session open/close hooks). Because one thread runs the strategy sequentially, strategy code doesn’t have to juggle mutexes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;trading::TradingVenue&lt;/code&gt;&lt;/strong&gt; handles the write side: placing and cancelling market, limit, stop, and OCO orders, and reporting balances and fills.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you switch &lt;code&gt;[general] mode&lt;/code&gt; in the TOML configuration file from &lt;code&gt;"paper"&lt;/code&gt; to &lt;code&gt;"live"&lt;/code&gt;, nothing in the strategy changes. A factory swaps &lt;code&gt;PaperTradingVenue&lt;/code&gt; (which simulates fills, maker/taker fees, slippage, and latency against live quotes) for the live venue. For a backtest, &lt;code&gt;ReplayDataSource&lt;/code&gt; feeds recorded bars and quotes from a PostgreSQL / &lt;a href="https://www.timescale.com/" rel="noopener noreferrer"&gt;TimescaleDB&lt;/a&gt; database into the exact same &lt;code&gt;Runner&lt;/code&gt; on a simulated clock.&lt;/p&gt;

&lt;p&gt;Rather than letting a strategy talk straight to an exchange, the &lt;code&gt;Runner&lt;/code&gt; also puts safety layers in front of the venue (&lt;code&gt;OrderTracker&lt;/code&gt;, &lt;code&gt;SessionGatedVenue&lt;/code&gt;, and &lt;code&gt;RiskGatedVenue&lt;/code&gt;) to track open orders, block stock orders outside market hours, and enforce &lt;code&gt;[risk]&lt;/code&gt; limits and kill switches. Live runs flat-out refuse to start without a &lt;code&gt;[risk]&lt;/code&gt; section configured.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;A Quick Look At Running Kestrel&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Building and running Kestrel on Linux (or Ubuntu under WSL, where I spend a lot of my time) takes CMake 3.25+ and GCC 12+ or Clang 16+:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="sb"&gt;`cmake -S . -B build &amp;amp;&amp;amp; cmake --build build -j
cp config/kestrel.example.toml config/kestrel.toml`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;kestrel_app&lt;/code&gt; uses &lt;a href="https://github.com/CLIUtils/CLI11" rel="noopener noreferrer"&gt;CLI11&lt;/a&gt; so each subcommand only does the one job you ask of it. Paper mode requires zero API credentials on Kraken or Binance.US:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="sb"&gt;`# Pull the last 24 hourly bars for the configured symbols:
./build/kestrel_app -c config/kestrel.toml bars 1h 24

# Stream live quotes for 60 seconds (add --store to save to TimescaleDB):
./build/kestrel_app -c config/kestrel.toml stream 60

# Backtest a strategy over a historical window:
./build/kestrel_app -c config/kestrel.toml backtest ma_crossover \
    --from 2026-09-01 --to 2026-10-01

# Run a strategy on live market data (paper or live depending on config):
./build/kestrel_app -c config/kestrel.toml run ma_crossover`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Side Note: When &lt;code&gt;run&lt;/code&gt; stops on &lt;code&gt;Ctrl-C&lt;/code&gt; or &lt;code&gt;SIGTERM&lt;/code&gt;, Kestrel cancels any open &lt;em&gt;entry&lt;/em&gt; orders so nothing fills unintentionally after you walk away, while intentionally leaving protective &lt;em&gt;exit&lt;/em&gt; orders (like a position’s stop-loss) resting on the book.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What Is Coming Up In This Series?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Rather than turning this introductory post into a novel, I plan to break the most interesting parts of building and testing Kestrel out into their own posts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Building C++23 With AI Coding Agents (Without Making Spaghetti)&lt;/strong&gt; – I didn’t hide the involvement of AI coding agents (Claude, Gemini, and OpenCode) in Kestrel’s git history. I’ll walk through how I set the house rules early with &lt;code&gt;.clang-format&lt;/code&gt;, &lt;code&gt;.clang-tidy&lt;/code&gt;, &lt;code&gt;ASan&lt;/code&gt;/&lt;code&gt;UBSan&lt;/code&gt;/&lt;code&gt;TSan&lt;/code&gt; sanitizers, an offline Docker test environment, and code reviews to catch subtle concurrency bugs and overly optimistic LLM assumptions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;C++ Under the Hood: Money, Latency, and Safety&lt;/strong&gt; – Why &lt;a href="https://en.wikipedia.org/wiki/IEEE_754" rel="noopener noreferrer"&gt;IEEE-754 floating-point math&lt;/a&gt; doesn’t belong anywhere near order sizes (&lt;code&gt;Decimal&lt;/code&gt;), why Kestrel never blindly retries a timed-out order placement, how keeping TLS sessions warm shaved hundreds of milliseconds off calls to an API hosted in Tokyo, and how Kestrel batches tick-by-tick quotes into TimescaleDB while keeping sub-millisecond arrival order intact.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integrating Crypto Exchanges and Charles Schwab&lt;/strong&gt; – What it took to put Binance.US, Kraken, and Schwab behind one interface, including dealing with Schwab’s 7-day OAuth refresh cycle, market-hours gating, and the places where live API behavior differed from the documentation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When Trading Strategies Meet Reality&lt;/strong&gt; – Kestrel currently includes five strategies (&lt;code&gt;ma_crossover&lt;/code&gt;, &lt;code&gt;market_maker&lt;/code&gt;, &lt;code&gt;breakout&lt;/code&gt;, &lt;code&gt;momentum_rotation&lt;/code&gt;, and &lt;code&gt;mean_reversion&lt;/code&gt;). In a dedicated post I’ll dig into the backtest and live test numbers: why adding realistic network latency completely flipped a “profitable” market maker on its head, how a short live run verified the simulator’s post-fill markouts, and which slower daily strategies actually held up after costs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Kestrel is already doing real work on paper and live accounts, and &lt;a href="https://github.com/trprice/kestrel/blob/main/TODO.md" rel="noopener noreferrer"&gt;&lt;code&gt;TODO.md&lt;/code&gt;&lt;/a&gt; still has plenty left to tackle (including finishing the remaining live order and margin-account checks on Schwab, building out Kraken’s live trading venue, wiring Binance.US and Schwab’s WebSocket execution streams behind &lt;code&gt;StreamExecutions&lt;/code&gt; so live runs don’t have to poll REST for fills, and setting up TimescaleDB compression and retention policies before &lt;code&gt;quotes&lt;/code&gt; fills up my disk). It has been a fun way to combine modern C++, networking, databases, and performance measurement while putting agentic coding tools through a real stress test.&lt;/p&gt;

&lt;p&gt;If you want to poke around ahead of the next posts, the code, design docs, and strategy research notes are all up on GitHub under an MIT license at &lt;a href="https://github.com/trprice/kestrel" rel="noopener noreferrer"&gt;github.com/trprice/kestrel&lt;/a&gt;. Let me know if you have any questions or topics you’d particularly like me to cover first, and stay tuned for more!&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://blog.taylorbuiltsolutions.com/introducing-kestrel-stock-crypto-trading-tool/" rel="noopener noreferrer"&gt;Introducing Kestrel – A C++23 Stock and Crypto Trading Tool&lt;/a&gt; appeared first on &lt;a href="https://blog.taylorbuiltsolutions.com" rel="noopener noreferrer"&gt;Taylor Built Solutions&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>finance</category>
      <category>daytrading</category>
    </item>
    <item>
      <title>Bitcoin Solo Mining Adventure</title>
      <dc:creator>Taylor R Price</dc:creator>
      <pubDate>Tue, 01 Sep 2026 18:51:58 +0000</pubDate>
      <link>https://dev.to/trpricesoftware/bitcoin-solo-mining-adventure-418l</link>
      <guid>https://dev.to/trpricesoftware/bitcoin-solo-mining-adventure-418l</guid>
      <description>&lt;p&gt;I’ve always been interested in allowing my computer to do &lt;em&gt;something&lt;/em&gt; while I’m not sitting at it. During my time at college that meant running Folding@Home or &lt;a href="mailto:SETI@Home"&gt;SETI@Home&lt;/a&gt;. In recent years that has turned to &lt;a href="https://www.coinbase.com/learn/crypto-basics/what-is-mining" rel="noopener noreferrer"&gt;mining cryptocurrency&lt;/a&gt;. I am aware that I’m late enough to the game that trying to mine much of anything with my GPUs won’t be terribly efficient. Application Specific Integrated Circuits (ASICs) can do the mining calculations so much efficiently than GPUs that the great majority of mining is done by them these days. While I don’t intend to buy enough hardware to become a significant cryptocurrency miner I did buy several &lt;a href="https://www.solosatoshi.com/product-category/bitcoin-miners/solo-miners/" rel="noopener noreferrer"&gt;solo miners&lt;/a&gt; to experiment with (yes I’m aware that, like my GPUs, these devices are not powerful enough to earn a significant amount of money). In this post I’d like to go over what I bought, what I’m doing with them, and what I hope to get out of this.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Did I Buy?
&lt;/h2&gt;

&lt;p&gt;I’ve purchased two &lt;a href="https://www.bitaxe.org/" rel="noopener noreferrer"&gt;Bitaxe&lt;/a&gt; solo miners from &lt;a href="https://www.solosatoshi.com/" rel="noopener noreferrer"&gt;SoloSatoshi&lt;/a&gt;. The two models I picked are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.solosatoshi.com/product/bitaxe-gamma/" rel="noopener noreferrer"&gt;Bitaxe Gamma (model 602)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.solosatoshi.com/product/bitaxe-duo-bitcoin-solo-miner-650-model/" rel="noopener noreferrer"&gt;Bitaxe Gamma Duo (model 650)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7yk2rpqih2liectp991z.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7yk2rpqih2liectp991z.jpeg" alt="Bitaxe Gamma Model 602 with a single Bitmain BM1370 ASIC" width="649" height="1024"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My reasoning for purchasing these two devices is that they are cheap and they use a fairly common microcontroller (the &lt;a href="https://www.espressif.com/en/products/socs/esp32-s3" rel="noopener noreferrer"&gt;Espressif ESP32-S3&lt;/a&gt;). I figured that I could get the basics down of solo mining and pool mining and, given my &lt;a href="https://blog.taylorbuiltsolutions.com/back-to-the-job-hunt/" rel="noopener noreferrer"&gt;recent experience&lt;/a&gt; with embedded programming, possibly contribute to the &lt;a href="https://github.com/bitaxeorg/ESP-Miner" rel="noopener noreferrer"&gt;Bitaxe ESP-Miner&lt;/a&gt; project.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Am I Doing With Them?
&lt;/h2&gt;

&lt;p&gt;I’ll start this section with this disclaimer (again): &lt;em&gt;I know that these are not powerful enough to guarantee hitting a Bitcoin block within any reasonable amount of time. They’re effectively permanent lottery tickets.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There are several mining methods I’m exploring with these:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Solo mining Digibyte (DGB) or Bitcoin Cash (BCH) to my own nodes for these cryptocurrencies&lt;/li&gt;
&lt;li&gt;Hybrid pool mining Bitcoin (BTC) to &lt;a href="https://parasite.space/" rel="noopener noreferrer"&gt;Parasite Pool&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Solo Mining – Hosting DGB and BCH Pools
&lt;/h3&gt;

&lt;p&gt;While Bitcoin is the biggest and most stable cryptocurrency at the time of writing this post it has some downsides for this experiement. The downside for me is that there are so many people attempting to mine Bitcoin that the difficulty of finding a block is effectively out of reach for me. Smaller cryptocurrencies such as DGB or BCH have less miners active and, as such, have a much higher chance of the two Bitaxe miners I have being able to find a block. If I happen to find a block of DGB or BCH with my miners they can be traded for BTC.&lt;/p&gt;

&lt;p&gt;Bear in mind that this “much higher chance” is still VERY LOW. I’m mostly using this as a chance to learn how mining pools work and to host my own pools for DGB and BCH. As the term “solo” mining indicates I’ll be the only one connecting to them to mine. If anyone reading this is interested I can make the pools available publicly; please let me know by reaching out or commenting.&lt;/p&gt;

&lt;p&gt;I used &lt;a href="https://github.com/TheRetroMike" rel="noopener noreferrer"&gt;TheRetroMike’s&lt;/a&gt; guide to setting up Umbrel, setting up their marketplace, and setting up both a &lt;a href="https://www.youtube.com/watch?v=USMyMPOsiJ8" rel="noopener noreferrer"&gt;DGB&lt;/a&gt; &amp;amp; &lt;a href="https://www.youtube.com/watch?v=4zRwuE7W9E0" rel="noopener noreferrer"&gt;BCH&lt;/a&gt; node along with MiningCore to act as the pool. This guide worked perfectly for me; the two nodes downloaded their blockchains, the MiningCore configuration was easy, and the two Bitaxe devices connected seamlessly and started working. The two links on DGB and BCH are to the YouTube video guides for each of these setups.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pool Mining With Parasite
&lt;/h3&gt;

&lt;p&gt;A definition of “pool” is in order at this point. A “pool” in terms of cryptocurrency mining is used with the definition of “pooling together our resources to achieve a common goal”. When someone in a mining pool finds a block the reward for finding that block will be split among all the participants in the pool commensurate with the amount of work they did toward finding the block. If, instead, you are solo mining and your miner finds a block you get the whole reward.&lt;/p&gt;

&lt;p&gt;So, why Parasite? There are two main reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The way that Parasite Pool divides up the reward&lt;/li&gt;
&lt;li&gt;Parasite pool isn’t one of the large pools that finds most of the blocks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Regarding the way that the block reward is divided &lt;a href="https://minebest.com/blog/pps-vs-fpps-vs-pplns-vs-pps-mining-pool-payouts-explained" rel="noopener noreferrer"&gt;here&lt;/a&gt; is a description of many of the popular ways to do so. The short version: Whenever your miner has found a possible solution for the block it sends it to the pool and the pool marks it as a “share”. Pools pay out the reward based on the number of shares that your miners have sent. Parasite is different in that it reserves 1 BTC out of the 3.125 BTC reward for the miner that actually finds the block and divides up the other 2.125 BTC between the rest of the pool based on their submitted shares. This makes Parasite something of a hybrid of solo and pool mining.&lt;/p&gt;

&lt;p&gt;The fact that Parasite Pool is a small pool is attractive to me from an idealistic point of few. From my understanding of the way that blocks are mined the pool gathers a set of unconfirmed transactions and passes those plus some other data to the miners. From there the miners try to compute a hash that will be accepted as the identifier for the new block (&lt;a href="https://www.lightspark.com/glossary/block" rel="noopener noreferrer"&gt;reference&lt;/a&gt;). Many miners gravitate toward large pools because they have a better chance of finding a block and, thus, a better chance to pay. This effectively consolidates the power to control which transactions make it into the next block into these large pools. This defeats the purpose of decentralizing the control over the currency. Is this idealistic? Yes. But I would not make much money with these miners anyway which means I can afford to be idealistic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I am hoping to learn a fair amount about cryptocurrency and mining through this adventure. Additionally I am looking forward to finding ways to contribute to the ESP-Miner code base that the Bitaxe miners use to advance my embedded programming skills. I would love to hear from you with questions about anything I’ve written here.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://blog.taylorbuiltsolutions.com/bitcoin-solo-mining-adventure/" rel="noopener noreferrer"&gt;Bitcoin Solo Mining Adventure&lt;/a&gt; appeared first on &lt;a href="https://blog.taylorbuiltsolutions.com" rel="noopener noreferrer"&gt;Taylor Built Solutions&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>cryptocurrency</category>
      <category>bitaxe</category>
      <category>bitcoin</category>
      <category>digibyte</category>
    </item>
    <item>
      <title>Back To The Job Hunt</title>
      <dc:creator>Taylor R Price</dc:creator>
      <pubDate>Fri, 28 Aug 2026 01:05:22 +0000</pubDate>
      <link>https://dev.to/trpricesoftware/back-to-the-job-hunt-2619</link>
      <guid>https://dev.to/trpricesoftware/back-to-the-job-hunt-2619</guid>
      <description>&lt;p&gt;In an unfortunate turn of events I recently parted ways with my most recent employer. While it’s cliche to say this I did learn a ton in the five years I was at that position. While I am scared and worried about my near term future I plan for this post to work through what I learned and what is next.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Did I Work On During My Recent Employment
&lt;/h2&gt;

&lt;p&gt;Much of my work at my recent employer involved updating, maintaining, and testing a C++ code base run on computers with limited processing power. I also worked on a test bench for these computers that involved a Matlab simulation, a National Instruments PXI chassis, and the I/O hardware to shuttle data between the target computers and the simulation (including the hardware in the physical product which we chose to emulate).&lt;/p&gt;

&lt;p&gt;I wrote and debugged lots of what we considered “drivers”. I put that in quotes because these were really interfaces between the APIs for the I/O hardware and the C++ emulators that were running in the Matlab simulation. These APIs are provided by the companies that provided the I/O hardware (e.g. National Instruments, Keysight, and Astronics-Ballard). Our drivers weren’t drivers from the perspective that they interacted &lt;em&gt;directly&lt;/em&gt; with the hardware. They did, however, need to have detailed knowledge of the I/O hardware, how to read information from them, and how to write information to them.&lt;/p&gt;

&lt;p&gt;Additionally I was able to work on both the code running on the target computers and the simulation. These were similar in the sense that both followed a time bound control loop of 3 major steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Read information from each piece of input hardware&lt;/li&gt;
&lt;li&gt;Decide what to do with that information based on current state&lt;/li&gt;
&lt;li&gt;Write information out to each piece of output hardware&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Given that these three steps were time bound (i.e. they had to be done within a specified number of milliseconds) I had to keep an eye on the performance of the code. The biggest area that performance was an issue was in talking to the hardware and not in any particularly interesting algorithm. As an example: How long does it take to write a serial message out? If your answer was “when the system call returns” that is not completely correct. In most operating systems the call to write a serial message to hardware will return &lt;em&gt;immediately after the OS has the bytes in it’s memory&lt;/em&gt; and NOT when the bytes have actually been written to the wire (let alone received by the listener). As such I spent a lot of time trying to figure out how to read or write bytes/statuses from hardware as quickly as possible.&lt;/p&gt;

&lt;p&gt;Lastly I got to dip my toe into the deep waters of electrical engineering. There were many cases where the software on both sides of the test bench (simulation and target) were correct but there was an issue with the wiring. One of my favorites was an issue with a discrete (on/off) signal coming from the target computer through a &lt;a href="https://www.ni.com/en/shop/hardware/digital-i-o/model-pxi-6528?srsltid=AfmBOorgYFkpA8vllav_Mz7nFrGPPjjfD-ViBwP5sCNRHbCccZuxvIfI" rel="noopener noreferrer"&gt;National Instruments PXIe-6528&lt;/a&gt; discrete card. The circuit on the target was a ground (off) / open (on) circuit. This meant that there were 0 volts when off was indicated and &lt;em&gt;not very much&lt;/em&gt; voltage when on was indicated (so long as it was not 0 / ground). The NI card, however, requires there to be 3.2V+ to consider a signal as on. I got a chance to work with our electrical engineers to solve things like this that were simple to them but interesting to me as a software guy. (The answer was to use a resistor to a voltage source that was greater than 3.2V)&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is Next?
&lt;/h2&gt;

&lt;p&gt;There are three main things I am focusing on in the near term. While they’re vague and obvious I will still state them out loud:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Searching for work based on my recently used skills&lt;/li&gt;
&lt;li&gt;Working on projects that will expand my skills as a software engineer&lt;/li&gt;
&lt;li&gt;Focusing on my family and home.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What Kind Of Work Am I Looking For Presently?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;BLUF –&lt;/strong&gt; Presently I’m looking for work in the embedded software space because it matches my recent experience.&lt;/p&gt;

&lt;p&gt;My most recent experience is in the embedded software space in the defense sector. That is obviously the experience that will be most relevant experience to my next employer. That being said I have described my last job as “really cool toys; morally ambiguous mission.” Why morally ambiguous? While we didn’t directly make weapons the product went to the military. Additionally the tech would have been created whether I like it or not, and I’d rather have been on the team developing it than eventually be the target of its use. Because of this I would prefer to work in a sector that isn’t the defense sector going forward but wouldn’t say no to a company that reaches out.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Kind Of Projects / Learning Will I Be Doing?
&lt;/h3&gt;

&lt;p&gt;My initial plan to a two pronged approach:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Play with embedded programming by working on the &lt;a href="https://github.com/bitaxeorg/ESP-Miner" rel="noopener noreferrer"&gt;Bitaxe ESP-Miner&lt;/a&gt; project along with the &lt;a href="https://www.solosatoshi.com/product/bitaxe-gamma/" rel="noopener noreferrer"&gt;Bitaxe Gamma&lt;/a&gt; that I recently picked up. As part of this I’ll also be playing with Umbrel and hosting my own mining pool for solo mining.&lt;/li&gt;
&lt;li&gt;Play with Large Language Models and Agents at home using Ollama and OpenWebUI.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Will the knowledge I gain from these be marketable? &lt;strong&gt;I hope so&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Bitaxe Gamma uses an ESP32-S3 microcontroller. It is my hope that helping with the ESP-Miner project will help me to learn how this particular microcontroller works and practice making code more performant. With regard to LLMs – the use of AI and agentic programming has been exploding. While I don’t completely &lt;em&gt;trust&lt;/em&gt; LLMs to generate good code I know that I will get left behind if I don’t learn more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I’m now in the “Great In Between” in my career. I am scared, nervous, and excited. I am still walking through the stages of grief over the loss of the job, the security that comes with it, and the friendships made along the way. I have contacted friends whom I know work at places where I might be able to get work and I’ve started sending out resumes. If you’ve got a position that you think I would be interested in please feel free to reach out to me in any of the following ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="mailto:taylor@tayorbuiltsolutions.com"&gt;taylor@tayorbuiltsolutions.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="mailto:trprice@gmail.com"&gt;trprice@gmail.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.linkedin.com/in/taylor-price-0273048/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/taylor-price-0273048/&lt;/a&gt;
&amp;lt;!-- CONTENT END 6 --&amp;gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The post &lt;a href="https://blog.taylorbuiltsolutions.com/back-to-the-job-hunt/" rel="noopener noreferrer"&gt;Back To The Job Hunt&lt;/a&gt; appeared first on &lt;a href="https://blog.taylorbuiltsolutions.com" rel="noopener noreferrer"&gt;Taylor Built Solutions&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>jobhunt</category>
    </item>
    <item>
      <title>What does try_files do in Nginx’s Config</title>
      <dc:creator>Taylor R Price</dc:creator>
      <pubDate>Wed, 17 Jun 2026 04:52:39 +0000</pubDate>
      <link>https://dev.to/trpricesoftware/what-does-tryfiles-do-in-nginxs-config-3o2f</link>
      <guid>https://dev.to/trpricesoftware/what-does-tryfiles-do-in-nginxs-config-3o2f</guid>
      <description>&lt;p&gt;Recently I setup a new WordPress instance on Linode that I planned to copy a backup of this blog to. The instance was easy to setup and UpdraftPlus made it easy to import the backup. Normal issues with restoring a back up to a new instance such as making sure the domain of the site is correct were fixed with ease. So what was the problem?&lt;/p&gt;

&lt;p&gt;When viewing the blog to make sure everything worked as normal I noticed that the front page with a list of posts loaded fine. The posts themselves returned 404 Not Found. This was confusing because the content of the posts were available from the admin panel. I could edit them and see all their details but not load them as a user would.&lt;/p&gt;

&lt;p&gt;What, pray tell, does this have to do with &lt;a href="https://nginx.org/" rel="noopener noreferrer"&gt;nginx&lt;/a&gt; and &lt;a href="https://nginx.org/en/docs/http/ngx_http_core_module.html#try_files" rel="noopener noreferrer"&gt;try_files&lt;/a&gt;? In this particular case the WordPress image used to create the WordPress “Quick DeployApp” uses nginx and set the &lt;code&gt;try_files&lt;/code&gt; fall back code to 404.&lt;/p&gt;

&lt;h2&gt;
  
  
  So what does try_files &lt;em&gt;actually&lt;/em&gt; do?
&lt;/h2&gt;

&lt;p&gt;In short try_files is a way for nginx to look for files (in this case posts) under a specified location in an nginx server. If the file that is being requested can’t be found try_files can specify a page to return. It can also specify a code to be returned. The nginx server setup was created in the quick deploy app looked as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="sb"&gt;`location / {
&lt;/span&gt;    &lt;span class="na"&gt;try_files $uri $uri/ /index.php?$args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="sb"&gt;`
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What did I do to fix the situation?
&lt;/h2&gt;

&lt;p&gt;My initial suspicion from reading the first part of the try_files documentation was to assume that the code at the end was the reason I was getting the 404 Not Found when trying to view posts. Changing the configuration as follows allows the posts to be viewed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="sb"&gt;`location / {
&lt;/span&gt;    &lt;span class="n"&gt;try_files&lt;/span&gt; $&lt;span class="n"&gt;uri&lt;/span&gt; $&lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;php&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;$&lt;span class="n"&gt;args&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="sb"&gt;`
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  But why does this work?
&lt;/h2&gt;

&lt;p&gt;There is a great breakdown of how try_files works on the &lt;a href="https://www.getpagespeed.com/server-setup/nginx/nginx-try-files" rel="noopener noreferrer"&gt;Get Page Speed blog&lt;/a&gt;. I’ll summarize the details of this specific problem here. The &lt;code&gt;$uri&lt;/code&gt; and &lt;code&gt;$uri/&lt;/code&gt; arguments to try_files look for the requested URI as a file/page then a directory respectively. WordPress, however, stores the posts in its database and needs index.php to be used with the requested post (contained in &lt;code&gt;$args&lt;/code&gt; in this case) to be able to return the desired post.&lt;/p&gt;

&lt;p&gt;This explains why my the updated configuration works but &lt;em&gt;not&lt;/em&gt; why having the code as the fallback option returns the fallback instead of going through index.php. The nearest explanation that I have seen so far is the possibility that the configuration rules for php files isn’t setup to forward requests to php-fpm correctly. Given that I am not an expert on how to setup nginx and WordPress I need to test this before claiming that it is the answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;While I am not completely sure why the posts weren’t returned by the &lt;code&gt;/index.php?$args&lt;/code&gt; section of the try_files statement and 404 was returned I can be relatively confident that the fix &lt;em&gt;works&lt;/em&gt;. The posts are viewable now. Trying to enter a post name that doesn’t exist causes the WordPress processor to return a page not found screen. This is better than returning a 404 Not Found in my opinion.&lt;/p&gt;

&lt;p&gt;If you know why the fallback was returned in the initial configuration I would love to hear from you!&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://blog.taylorbuiltsolutions.com/what-does-try_files-do-in-nginx-config/" rel="noopener noreferrer"&gt;What does try_files do in Nginx’s Config&lt;/a&gt; appeared first on &lt;a href="https://blog.taylorbuiltsolutions.com" rel="noopener noreferrer"&gt;Taylor Built Solutions&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>nginx</category>
    </item>
    <item>
      <title>Getting Neovim Up and Running</title>
      <dc:creator>Taylor R Price</dc:creator>
      <pubDate>Thu, 06 Nov 2025 04:56:41 +0000</pubDate>
      <link>https://dev.to/trpricesoftware/getting-neovim-up-and-running-35fd</link>
      <guid>https://dev.to/trpricesoftware/getting-neovim-up-and-running-35fd</guid>
      <description>&lt;p&gt;Early in my career I had reason to use Vim when working on Linux based applications. I found that it made the editing, compile, test loop faster than it would be if I was editing on Windows. In recent years, however, many of the applications I have worked on have been either Windows based or embedded on a limited *nix box. The biggest I have missed about using Vim is the ability to do everything from the keyboard. With an &lt;a href="https://blog.taylorbuiltsolutions.com/ergodox-ez-keyboard-review/" rel="noopener noreferrer"&gt;ergonomic keyboard&lt;/a&gt; it was nice to not have to reach for the mouse. Even now many of the keybindings are burned into my muscle memory. Given all the above I decided to try &lt;a href="https://neovim.io" rel="noopener noreferrer"&gt;Neovim&lt;/a&gt; to see if it scratches nostalgic itch for Vim.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Neovim Specifically?
&lt;/h2&gt;

&lt;p&gt;There are a few reasons that I wanted to use Neovim:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;There are a lot of plugins available that are under active development&lt;/li&gt;
&lt;li&gt;There are a &lt;a href="https://github.com/folke/lazy.nvim" rel="noopener noreferrer"&gt;few&lt;/a&gt; &lt;a href="https://github.com/NvChad/NvChad" rel="noopener noreferrer"&gt;plugin&lt;/a&gt; &lt;a href="https://github.com/wbthomason/packer.nvim" rel="noopener noreferrer"&gt;managers&lt;/a&gt; that make it easy to get functionality rivaling other GUI based IDEs&lt;/li&gt;
&lt;li&gt;It can be run on Windows as well as Linux&lt;/li&gt;
&lt;li&gt;It is a “new” fad in the Vim community given the number of &lt;a href="https://youtu.be/w7i4amO_zaE?si=1T5ypYBQNCAkOXEI" rel="noopener noreferrer"&gt;guides&lt;/a&gt; &lt;a href="https://youtu.be/Z1qEKUf0ibk?si=nrUrtfNGMVFaDXJn" rel="noopener noreferrer"&gt;available&lt;/a&gt; &lt;a href="https://youtu.be/VljhZ0e9zGE?si=5MkXcDypaCkWOTZn" rel="noopener noreferrer"&gt;on&lt;/a&gt; &lt;a href="https://youtu.be/m8C0Cq9Uv9o?si=loNKkOfKAogx3bLC" rel="noopener noreferrer"&gt;Youtube&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Environment Considerations
&lt;/h2&gt;

&lt;p&gt;Much of this setup will apply to anywhere you’re setting up Neovim. That being said it is necessary to explain where/why I’m installing Neovim. I’m using a fresh install of Ubuntu 24.04 running under WSL 2 on Windows 11. While I also use it in Windows I’ve been somewhat burned out on CMake WSL builds being kicked off from Windows and want to be able to just edit, compile, and test directly in WSL.&lt;/p&gt;

&lt;p&gt;The warning I want to give specifically for Ubuntu is that apt has an old version of neovim. Using snap has a much more recent version. See below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4lx4l425t86847dz56du.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4lx4l425t86847dz56du.png" width="799" height="288"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Notice that apt has version 0.9.5 which, at this time, is several builds behind.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy9kzz0hd9pag5udbp3wf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy9kzz0hd9pag5udbp3wf.png" width="800" height="474"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Snap has the v.0.11.5 which is the latest release as of the writing of this post.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Additionally, because I’m using Linux/Ubuntu, the files are going under the &lt;code&gt;~/.config&lt;/code&gt;directory. If you’re not on Linux open &lt;code&gt;nvim&lt;/code&gt;and run &lt;code&gt;&amp;lt;code&amp;gt;:echo stdpath('config')&lt;/code&gt;. The result of this command will tell you the directory you need to put the nvim folder in. On Windows this is &lt;code&gt;C:\Users\&amp;lt;username&amp;gt;\AppData\Local\nvim&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Setting Up Lazy.vim
&lt;/h2&gt;

&lt;p&gt;Lazy.vim is under somewhat active development and, as such, I decided to use it for the package manager for my install. The installation instructions can be found &lt;a href="https://www.lazyvim.org/installation" rel="noopener noreferrer"&gt;here&lt;/a&gt; though I’ll still walk through it in this post. This set of instructions uses a starter configuration whose files can be seen on Github &lt;a href="https://github.com/LazyVim/starter" rel="noopener noreferrer"&gt;here&lt;/a&gt;. I’ll endeavor to explain what is going on in these files.&lt;/p&gt;
&lt;h3&gt;
  
  
  Getting The Starter Configuration
&lt;/h3&gt;

&lt;p&gt;If you’ve already got a NeoVim configuration you’ll want to back up your configuration, downloaded plugins, and state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="sb"&gt;`# required
mv ~/.config/nvim{,.bak}

# optional but recommended
mv ~/.local/share/nvim{,.bak}
mv ~/.local/state/nvim{,.bak}
mv ~/.cache/nvim{,.bak}`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we want to get the config files that represent the LazyVim starter. Take note that, if you’re on a Windows machine you can’t refer to your home directory as &lt;code&gt;~&lt;/code&gt;. You may want to &lt;code&gt;cd&lt;/code&gt; into your home directory and use &lt;code&gt;.config/nvim&lt;/code&gt; in place of the directory to clone to.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="sb"&gt;`git clone https://github.com/LazyVim/starter ~/.config/nvim`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to commit your changes to a git repository you’ll want to remove the &lt;code&gt;.git&lt;/code&gt; folder that points at Github. This has the same caveat as above for a Windows machine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="sb"&gt;`rm -rf ~/.config/nvim/.git`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start up &lt;code&gt;nvim&lt;/code&gt; and you’re good to go! When you start up nvim you’ll see the Lazy screen that allows you to see what plugins are loaded, check for updates, etc. You can get out of this by pressing &lt;code&gt;q&lt;/code&gt;. You can bring it back up by typing &lt;code&gt;:Lazy&lt;/code&gt; or typing &lt;code&gt;&amp;lt;leader&amp;gt;l&lt;/code&gt; where the leader character is the space character by default in LazyVim (more on the leader character later).&lt;/p&gt;

&lt;h3&gt;
  
  
  Side Note About Starter Projects
&lt;/h3&gt;

&lt;p&gt;One thing I do want to note here: I’m not a &lt;em&gt;huge&lt;/em&gt; fan of starter projects like this but I’ve been around long enough to know that it’s helpful. What you’ll notice with LazyVim is that they recommend using the lua/plugins directory under your config directory to setup which plugins you’d like to use. HOWEVER! The plugins that come with the starter are NOT all setup under this directory. They’re hidden by LazyVim’s own set of plugins and the config files for these plugins are not in the .config directory; they’re hidden in the .local directory. If, for instance, you want to use &lt;a href="https://github.com/nvim-neo-tree/neo-tree.nvim" rel="noopener noreferrer"&gt;Neo-Tree&lt;/a&gt; for a file explorer instead of &lt;a href="https://github.com/folke/snacks.nvim/blob/main/docs/explorer.md" rel="noopener noreferrer"&gt;Snacks Explorer&lt;/a&gt; that’s fine but Snacks Explorer gets automatically installed with the starter. You’ll have to do some mucking with the config files to disable Snacks Explorer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Plugins – Where the magic happens
&lt;/h2&gt;

&lt;p&gt;From here we still have one more thing to setup; the plugins we want to use. There are tons of plugins available in addition to the ones that LazyVim bundles. First, however, we have to know how to configure these plugins&lt;/p&gt;

&lt;h3&gt;
  
  
  Where Are My Configuration Files?
&lt;/h3&gt;

&lt;p&gt;As mentioned earlier, the LazyVim starter comes with Snacks Explorer by default. This can be opened by pressing &lt;code&gt;&amp;lt;leader&amp;gt;e&lt;/code&gt;. &lt;em&gt;Side Note: When you press the space key a small menu will pop up showing you the options you have.&lt;/em&gt; As you can see here we have three main directories:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;.config/nvim&lt;/li&gt;
&lt;li&gt;.local/share/nvim&lt;/li&gt;
&lt;li&gt;.local/state/nvim&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foggg4ohl5ombk0f1ftlk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foggg4ohl5ombk0f1ftlk.png" width="800" height="527"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The most interaction we will have, however, will be in the .config directory. I’ve expanded it to show the &lt;code&gt;lua/config&lt;/code&gt; and &lt;code&gt;lua/plugins&lt;/code&gt; directories.&lt;/p&gt;

&lt;h3&gt;
  
  
  Important Files
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.config/nvim/init.lua&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;This is/would be the main configuration file for nvim in a configuration without LazyVim. With LazyVim, however, the only thing it’s going to do is tell nvim to load LazyVim.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.config/nvim/lua/config/lazy.lua&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;This is the main configuration file for LazyVim itself.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.config/nvim/lua/plugins&lt;/code&gt; folder

&lt;ul&gt;
&lt;li&gt;Under here we’re going to create separate lua files for the plugins we want to use. Technically all the lua files here will get rolled up into a single file by nvim. Breaking up the configuration by plugin, however, makes each file more readable by being specific to the plugin in question.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This is really only the setup of Neovim for me. As I use it more I know there will be more plugins I find that I need as well as tools to setup to make the functionality that comes with LazyVim work. I hope you found this helpful. Stay tuned for more!&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://blog.taylorbuiltsolutions.com/getting-neovim-up-and-running/" rel="noopener noreferrer"&gt;Getting Neovim Up and Running&lt;/a&gt; appeared first on &lt;a href="https://blog.taylorbuiltsolutions.com" rel="noopener noreferrer"&gt;Taylor Built Solutions&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>neovim</category>
      <category>vi</category>
      <category>vim</category>
    </item>
    <item>
      <title>Software Development Isn’t Writing Code</title>
      <dc:creator>Taylor R Price</dc:creator>
      <pubDate>Tue, 29 Jul 2025 04:28:40 +0000</pubDate>
      <link>https://dev.to/trpricesoftware/software-development-isnt-writing-code-3phl</link>
      <guid>https://dev.to/trpricesoftware/software-development-isnt-writing-code-3phl</guid>
      <description>&lt;p&gt;Ok, yes, that headline is a hot take that borders on clickbait. And it is also true for many Software Developers/Engineers; typing code is often the smallest part of the job. From my experience figuring out &lt;em&gt;what&lt;/em&gt; to type is the hard and time consuming part of the work. “&lt;em&gt;So What?”&lt;/em&gt; you might ask. This post is intended to be a reminder to myself and other engineers to be patient with the process of creating, modifying, or fixing a product as a whole&lt;/p&gt;

&lt;p&gt;At the end of the day the goal of any engineer is to _ &lt;strong&gt;solve a problem&lt;/strong&gt; &lt;em&gt;. We’re trying to resolve _this&lt;/em&gt; particular problem (whatever &lt;em&gt;this&lt;/em&gt; is). The steps to solving a problem in software is the same as solving a problem in any other job with only the language used to solve the problem being different.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are the steps to solving a problem?
&lt;/h2&gt;

&lt;p&gt;In order to solve any problem there are always steps to be taken. These include&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understanding the problem / requirements gathering&lt;/li&gt;
&lt;li&gt;Breaking down the problem into discrete steps&lt;/li&gt;
&lt;li&gt;Updating the problem statement / requirements based on research found while breaking down the problem&lt;/li&gt;
&lt;li&gt;Work the steps (&lt;em&gt;hint: this is where the writing code goes. Even then it’s &lt;strong&gt;still&lt;/strong&gt; a small part)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Update your problem statement / requirements &lt;strong&gt;&lt;em&gt;again&lt;/em&gt;&lt;/strong&gt; based on how working through the steps of the problem turned out&lt;/li&gt;
&lt;li&gt;Clean up&lt;/li&gt;
&lt;li&gt;Prepare for delivery&lt;/li&gt;
&lt;li&gt;Presentation of the solution&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Be patient with yourself and your solution
&lt;/h2&gt;

&lt;p&gt;This headline comes from a mantra that I have to tell myself. I tend to be very hard on myself for not immediately understanding a problem, knowing what the solution is, and having it typed out &lt;em&gt;right now.&lt;/em&gt; I have to remind myself to be patient enough to really understand the problem I’m trying to solve and ask clarifying questions of those who understand what we’re trying to solve. This patience, while it may cause me to take a little longer to produce a solution &lt;em&gt;now&lt;/em&gt;, usually grants me a better solution long term.&lt;/p&gt;

&lt;h2&gt;
  
  
  Slow is Smooth; Smooth is Fast
&lt;/h2&gt;

&lt;p&gt;Take note that this patience doesn’t mean you have to move slowly to solve a problem. It simply means that you need to take your time to understand, prioritize, and make peace with that prioritization. Yes you should work hard. Yes you should work extra hours &lt;strong&gt;IF&lt;/strong&gt; there’s a good reason to. And, yes, you should re-evaluate your expectations if they turn out to be unreasonable. Take the time to work smoothly and you’ll find yourself finishing work faster than if you rushed.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://blog.taylorbuiltsolutions.com/software-development-isnt-writing-code/" rel="noopener noreferrer"&gt;Software Development Isn’t Writing Code&lt;/a&gt; appeared first on &lt;a href="https://blog.taylorbuiltsolutions.com" rel="noopener noreferrer"&gt;Taylor Built Solutions&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>AI Schooled Me – Or How I Re-learned To KISS</title>
      <dc:creator>Taylor R Price</dc:creator>
      <pubDate>Wed, 21 May 2025 23:34:35 +0000</pubDate>
      <link>https://dev.to/trpricesoftware/ai-schooled-me-or-how-i-re-learned-to-kiss-djg</link>
      <guid>https://dev.to/trpricesoftware/ai-schooled-me-or-how-i-re-learned-to-kiss-djg</guid>
      <description>&lt;p&gt;Recently I started my &lt;a href="https://blog.taylorbuiltsolutions.com/llms-using-ollama-and-open-webui/" rel="noopener noreferrer"&gt;journey on learning to use AI&lt;/a&gt; for writing and programming. My first post was about the tools I chose to use and getting them setup on my computer. The next post I planned to write is about using coding specific LLMs to help write a tool to use the CloudFlare API to update DNS records using modern C++, a JSON library, and a library to make web calls. Instead I’m writing this post about how I’ve forgotten and re-learned the KISS principle over my career.&lt;/p&gt;

&lt;h2&gt;
  
  
  Goals For The DNS Updater Project
&lt;/h2&gt;

&lt;p&gt;I have been somewhat stuck in the versions of C++ and libraries I have been able to use in my day jobs by necessity of their businesses. C++ has become a much safer language since the C++11 standard but I haven’t been able to make much use of these modern features due to the C++ toolsets in use at work. Additionally I haven’t been able to do much programming that touches the internet and, given my knowledge of C++ and the possible performance it can bring to projects, I’ve wanted to see how C++ running on a server can handle communications. These are areas I’ve wanted to learn about but was lacking a project to do so.&lt;/p&gt;

&lt;p&gt;When I started hosting some servers at home I found the need to update DNS records for my domains whenever my internet provider changed my external IP. This provided a project for me to do some of the above learning. Yes, I’m aware that this is a very simple thing to update and that I could automate this with bash, curl, and cron relatively easily. But it’s an opportunity to learn something. Or so I thought.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Happened With This Project?
&lt;/h2&gt;

&lt;p&gt;A year or so ago I started the process of spinning up a CMake and C++ project (because CMake is another thing I needed practice at). I began implementing a class to handle domains to update via reading in a JSON configuration file using the &lt;a href="https://github.com/nlohmann/json" rel="noopener noreferrer"&gt;JSON for Modern C++ library&lt;/a&gt; by Niels Lohmann, logic to get the current external IP address of the computer the program is running on, a class that would handle communications via the &lt;a href="https://developers.cloudflare.com/api/resources/dns/subresources/records/methods/edit/" rel="noopener noreferrer"&gt;CloudFlare API&lt;/a&gt; and &lt;a href="https://github.com/libcpr/cpr" rel="noopener noreferrer"&gt;libcpr&lt;/a&gt;, and the logic to call everything. I was developing everything as I would a large project at work and I was LEARNING! Yay!&lt;/p&gt;

&lt;p&gt;And, after a while, the project seemed to becoming ever more complicated and I stopped finding the time and energy to work on it. My family will always be my first priority and we had things going on. The further away from the project I got the less impending the need seemed to be and the less time I spent on it. And, lo and behold, here we are a long time later looking at trying to use AI to help me get the project done.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Did The AI/LLM Suggest As A Solution?
&lt;/h2&gt;

&lt;p&gt;I prompted the AI to write a program in C++ that would read in a JSON configuration file with domain information and call the CloudFlare API with it to update the DNS records. It generated a single file that would do this in roughly 100 lines. ONE HUNDRED LINES.&lt;/p&gt;

&lt;p&gt;This solution is way simpler than the design I came up with myself. I stared at the code it generated gobsmacked. Not because the code was astoundingly good but because it reminded me that, in my desire to learn, I had overcomplicated things and that I need to return to the “Keep It Simple, Stupid” concept. I need to just get the thing done.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I have not tested the code that the LLM generated yet but I will soon. I already recognize that there are things about the suggested code that should change. But this has reminded me of a guiding principle that I have claimed to cherish through my software engineering career but forgot in this case: Write code that is clear, concise, and easily understandable (or provide clear, concise comments if the code can’t be). In other words KISS.&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://blog.taylorbuiltsolutions.com/ai-schooled-me/" rel="noopener noreferrer"&gt;AI Schooled Me – Or How I Re-learned To KISS&lt;/a&gt; appeared first on &lt;a href="https://blog.taylorbuiltsolutions.com" rel="noopener noreferrer"&gt;Taylor Built Solutions&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>cpp</category>
    </item>
    <item>
      <title>Starting the Journey With AI &amp; LLMs Using Ollama and Open WebUI</title>
      <dc:creator>Taylor R Price</dc:creator>
      <pubDate>Tue, 20 May 2025 03:10:18 +0000</pubDate>
      <link>https://dev.to/trpricesoftware/starting-the-journey-with-ai-llms-using-ollama-and-open-webui-2353</link>
      <guid>https://dev.to/trpricesoftware/starting-the-journey-with-ai-llms-using-ollama-and-open-webui-2353</guid>
      <description>&lt;p&gt;I’ve been a software engineer for roughly twenty years now. For most of my career I have worked on what many would consider “legacy code”; applications such as payroll calculations and some embedded applications. Nothing that is on the bleeding edge of technology. This has often put me solidly in the camp of those resistant to new technologies because I’ve needed to build on an old code base with techniques and tools that have been proven to work. Having seen AI rise in power and productivity in the form of LLMs I realized that I cannot continue in my career without getting some level of familiarity with the technology. As such I’ve installed &lt;a href="https://ollama.com/" rel="noopener noreferrer"&gt;Ollama&lt;/a&gt; and &lt;a href="https://github.com/open-webui/open-webui" rel="noopener noreferrer"&gt;Open Webui&lt;/a&gt; and have started playing with LLMs locally.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are my goals for using LLMs?
&lt;/h2&gt;

&lt;p&gt;In the short term my goals are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run an LLM locally so that I don’t have to spend a lot of money to familiarize myself with the technology&lt;/li&gt;
&lt;li&gt;Help write this post to practice writing queries for text&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Getting the tools installed
&lt;/h2&gt;

&lt;p&gt;Presently the tools I am using are Ollama, Docker Desktop, and Open WebUI.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing Ollama Locally
&lt;/h3&gt;

&lt;p&gt;I am running Ollama directly on my Windows machine so that I don’t have to deal with passing my GPUs through to a Docker container. I know it’s possible and likely not that hard but I put a priority on simplifying what I need to learn at any one time. I installed Ollama by going to the &lt;a href="https://ollama.com/download" rel="noopener noreferrer"&gt;download page&lt;/a&gt; of their website, downloading the Windows installer from there, and running it.&lt;/p&gt;

&lt;p&gt;For my current use, however, the only thing I &lt;em&gt;really&lt;/em&gt; needed to do was get Ollama to download a model. Because my hardware is relatively limited (a 12GB RTX 3060 and a 6GB GTX 1660 Super) I decided to try to go with a relatively small model from &lt;a href="https://ollama.com/search" rel="noopener noreferrer"&gt;list of models&lt;/a&gt; that are supported. For general purpose queries like writing blog posts I chose the 8 billion parameter version of &lt;a href="https://ollama.com/library/llama3.1" rel="noopener noreferrer"&gt;Llama 3.1&lt;/a&gt;. To get Ollama to download this model I ran:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ollama pull llama3.1:8b
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Installing Docker Desktop
&lt;/h3&gt;

&lt;p&gt;The Docker Desktop installer can be downloaded from their &lt;a href="https://www.docker.com/products/docker-desktop/" rel="noopener noreferrer"&gt;main site&lt;/a&gt;. Run the installer once it’s downloaded. Given that this post is not about Docker directly and is geared toward technically inclined folks I’m going to presume that you’re able to get it installed and move on to the next step.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting Open WebUI
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/open-webui/open-webui" rel="noopener noreferrer"&gt;Open WebUI&lt;/a&gt; is pretty easy to get going once you’ve got Docker Desktop installed. There are &lt;a href="https://github.com/open-webui/open-webui?tab=readme-ov-file#quick-start-with-docker-" rel="noopener noreferrer"&gt;instructions here&lt;/a&gt; but, to save time, you can run the following to get it running with the instance of Ollama running on our machine. For options with Ollama running elsewhere see the instructions page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the container is up and running you can access it via &lt;a href="http://blog.taylorbuiltsolutions.com:3000" rel="noopener noreferrer"&gt;http://blog.taylorbuiltsolutions.com:3000&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What does the Open WebUI page look like?
&lt;/h2&gt;

&lt;p&gt;The main page is pretty simple. There is a drop down at the top left that will allow you to choose the model you want to query against, a text box to query in the center, and a banner along the left allow you to save conversations. Note that the models you see here are ones I’ve already downloaded via Ollama in hopes that I might actually use them at some point.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz5b2qv2rkipuaa3fkp30.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz5b2qv2rkipuaa3fkp30.png" width="800" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Given that I am still in the beginning of my journey with LLMs I am not going to go into any of the many seeings that are possible with this tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  How did it work for me?
&lt;/h2&gt;

&lt;p&gt;I used the llama3.1 8 billion parameter model to try to write this post. I used the following query to get things kicked off hoping that it would produce a guide to installing the tools that looked somewhat like how I write my posts.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Write a blog post in the style of the posts on &lt;a href="https://blog.taylorbuiltsolutions.com/" rel="noopener noreferrer"&gt;https://blog.taylorbuiltsolutions.com/&lt;/a&gt; about installing Ollama, Docker Desktop, and open-webui on Windows so that someone can get started using LLMs&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The output was … ok. There were some errors in the installation guide (which I’ll discuss below) and the initial text produced didn’t include any summary about why someone might want to even use these tools. I was able to get it to produce this with further queries but the text produced didn’t sound like how I’d want to say things.&lt;/p&gt;

&lt;p&gt;In the end I still ended up writing much of the post myself. The generated content, however, did provide a decent jumping off point. One of the points of research for me is to see if I can get information from live websites (like Github) so that the content produced by the LLM is accurate.&lt;/p&gt;

&lt;h3&gt;
  
  
  Errors in the LLM generated post
&lt;/h3&gt;

&lt;p&gt;The first issue I noticed is that it suggested that the reader use the command line to install Ollama. This isn’t a big issue and is certainly possible from Windows though it isn’t likely the first thing most Windows users would do (albeit that developers would be likely to). It, however, had the script section tagged as Bash and was using &lt;code&gt;curl&lt;/code&gt; (again, not a big stretch but definitely something that would be done by default on Linux and not Windows). I prompted the LLM to indicate that I was using Windows and to use powershell and it changed the box to use powershell and Invoke-WebRequest. This is ok so far.&lt;/p&gt;

&lt;p&gt;The second major problem in the post is that it got the github address and file to download totally wrong. The address and file that it recommended I download is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;https://github.com/ollama-dev/ollama/releases/download/latest/ollama.exe&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The actual github URL to the ollama repository is: &lt;code&gt;https://github.com/ollama/ollama/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Additionally, there is no ollama.exe on the releases page. There are zip or tarballs for different operating systems. There is an installer for Windows but it is called OllamaSetup.exe. Now this is the point where you can point out “you just didn’t frame your query correctly!” and you’re very likely correct. I need to learn more about how to query properly and/or get it to read websites and return the correct data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Using LLMs is definitely going to be an interesting learning process and I’m excited to continue with it. The generated content for this post was not the most useful but it did provide me a jumping off point. There are more topics for posts that have been rattling around in my head that I intend to practice querying with. That being said I doubt I will take posts wholesale. I’m still too much of a control curmudgeon to want to allow an LLM to speak for me.&lt;/p&gt;

&lt;p&gt;I also intend to use some of the coding models to work on generating a server maintenance tool I’ve wanted to write. It will provide me a &lt;a href="https://blog.taylorbuiltsolutions.com/ai-schooled-me/" rel="noopener noreferrer"&gt;chance to practice querying&lt;/a&gt; and learn modern C++ (so I don’t continue to stay in the dark ages). So, more to come soon!&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://blog.taylorbuiltsolutions.com/llms-using-ollama-and-open-webui/" rel="noopener noreferrer"&gt;Starting the Journey With AI &amp;amp; LLMs Using Ollama and Open WebUI&lt;/a&gt; appeared first on &lt;a href="https://blog.taylorbuiltsolutions.com" rel="noopener noreferrer"&gt;Taylor Built Solutions&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
    </item>
    <item>
      <title>How To Create A Backup Schedule For Your Minecraft Server In Pterodactyl</title>
      <dc:creator>Taylor R Price</dc:creator>
      <pubDate>Sun, 11 Feb 2024 20:31:41 +0000</pubDate>
      <link>https://dev.to/trpricesoftware/how-to-create-a-backup-schedule-for-your-minecraft-server-in-pterodactyl-6b6</link>
      <guid>https://dev.to/trpricesoftware/how-to-create-a-backup-schedule-for-your-minecraft-server-in-pterodactyl-6b6</guid>
      <description>&lt;p&gt;If you have a Minecraft world that you’ve spent time building, it is important to back up that world. There are many things that could happen on your world that might make you want to restore it to a previous state (a creeper destroying something you’ve built for example). As part of our &lt;a href="https://www.taylorbuiltsolutions.com/minecraft_hosting/" rel="noopener noreferrer"&gt;Minecraft hosting service&lt;/a&gt; we provide the Pterodactyl panel to manage your world. Given that, let’s go over how to create a schedule to back up your world with Pterodactyl.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq3gmdqi9l0tfbfmu6buj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fq3gmdqi9l0tfbfmu6buj.png" alt="Is your Minecraft world backed up? If so you can restore the world even if if goes up in flames like this iron golem" width="799" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How is a backup created?
&lt;/h2&gt;

&lt;p&gt;Companies that host Minecraft worlds often provide a service like Pterodactyl to help run and manage these worlds. Part of managing the Minecraft world is providing a way to back it up. But what does “backing up” a Minecraft world mean? Backing up a world means copying the files that contain the state of the world to a storage service that can keep them reliably safe. If you &lt;a href="http://www.taylorbuiltsolutions.com/minecraft_hosting/" rel="noopener noreferrer"&gt;host your world&lt;/a&gt; with us the files are securely saved to &lt;a href="https://aws.amazon.com/pm/serv-s3/" rel="noopener noreferrer"&gt;Amazon Web Services Simple Storage Service (S3)&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a scheduled backup with Pterodactyl
&lt;/h2&gt;

&lt;p&gt;With an understanding of why we want to back up a Minecraft world let’s log into our Pterodactyl panel to see how to do it. When we log in to the Pterodactyl panel for your server we will see a screen like the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo1j4yootxqxjhfnwr4bw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fo1j4yootxqxjhfnwr4bw.png" alt="This is the Pterodactyl panel page showing the basic information about the Minecraft world along with a console showing logs." width="800" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are two links on this page that we will use to manage our backups: &lt;em&gt;Schedules&lt;/em&gt; and &lt;em&gt;Backups&lt;/em&gt;. The schedules link allows us to setup scheduled tasks for this server. The backups link gives us a way to interact with backups that already exist. Let’s start with the Schedule link so we can schedule our backup. You should come to the following screen. If a schedule has already been setup it will be shown here. Otherwise it will be blank like this one:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5ckzko8jwd7dheypk32m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5ckzko8jwd7dheypk32m.png" alt="This shows the schedule page of Pterodactyl without any existing schedules." width="800" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From here click on “Create Schedule”. We’ll come to this page. While it might look complicated don’t worry; there’s a cheat sheet that will help understand how to create the schedule.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa0neszshwzpz28zcv38n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa0neszshwzpz28zcv38n.png" alt="This shows the &amp;quot;Create Schedule&amp;quot; window for Pterodactyl with the cheatsheet visible" width="800" height="649"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While we’re on this page we need to decide how often to back up our world. How often to back up the world depends on how fast things change in the world. Personally I back up my world once a week since there are only a couple people playing on it and things don’t change too often. As such I changed the values in the boxes to match the “every Monday” example. I also give the schedule a name such as “Backup”. This looks like the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fye6tb42ehf1dk6pwythy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fye6tb42ehf1dk6pwythy.png" alt="The pterodactyl schedule creation window with a weekly schedule filled in." width="799" height="648"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you would like to create a schedule that doesn’t match one of the provided examples &lt;a href="https://crontab.guru/" rel="noopener noreferrer"&gt;Crontab Guru&lt;/a&gt; can help you understand how to create a schedule.&lt;/p&gt;

&lt;p&gt;You’ll notice that this screen only has information regarding the creation of a schedule but not what the schedule will &lt;em&gt;do&lt;/em&gt;. We will specify the task the schedule will perform in another step. For the moment, click “Create Schedule”. That will bring us to the following screen:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4jdmawqk9z1yxqb44htj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4jdmawqk9z1yxqb44htj.png" alt="Pterodactyl showing an active schedule" width="799" height="188"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can see that we have a schedule that has the details we just entered and that it is marked as active. To specify what we want to happen click on the entry to access more details about it. That brings us here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpxxgwb9vfie61ntwf2j3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fpxxgwb9vfie61ntwf2j3.png" alt="Pterodactyl screen showing schedule details." width="799" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can see that this page allows us to specify a “New Task” to be run when this schedule occurs. Go ahead and click on “New Task” and this window will open:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fevmysa3xbj9yeusfwsgx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fevmysa3xbj9yeusfwsgx.png" width="800" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On this window, click on the “Action” drop down. From here you can select “Create Backup”. There aren’t any there options that need to be set on this page so “Create Task” can be clicked. At this point your scheduled backup is complete!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;em&gt;Side Note:&lt;/em&gt; A possible error
&lt;/h3&gt;

&lt;p&gt;Please note that there is a possible error at this point as pictured in the following image. If this error is shown please reach out to the customer support of your hosting provider. They will be able to resolve this for you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6571yec1s2tmz8fku5mx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6571yec1s2tmz8fku5mx.png" alt="asd;lfkj" width="771" height="552"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Creating a backup copy of digital items you care about is important. Minecraft hosting providers will provide ways to do this for worlds you are hosting with them. If you have any questions on this or anything else related to your hosted Minecraft world please reach out to us!&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://blog.taylorbuiltsolutions.com/minecraft-backup-pterodactyl/" rel="noopener noreferrer"&gt;How To Create A Backup Schedule For Your Minecraft Server In Pterodactyl&lt;/a&gt; appeared first on &lt;a href="https://blog.taylorbuiltsolutions.com" rel="noopener noreferrer"&gt;Taylor Built Solutions&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>minecraft</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
