<?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: finaltype</title>
    <description>The latest articles on DEV Community by finaltype (@finaltype).</description>
    <link>https://dev.to/finaltype</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%2F4089379%2Fc8248cd8-86bb-41c0-a181-9f13f26132f8.jpg</url>
      <title>DEV Community: finaltype</title>
      <link>https://dev.to/finaltype</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/finaltype"/>
    <language>en</language>
    <item>
      <title>[261116~261120] 실계좌 자동매매 주간 현황</title>
      <dc:creator>finaltype</dc:creator>
      <pubDate>Fri, 20 Nov 2026 23:11:13 +0000</pubDate>
      <link>https://dev.to/finaltype/261116261120-silgyejwa-jadongmaemae-jugan-hyeonhwang-1jd3</link>
      <guid>https://dev.to/finaltype/261116261120-silgyejwa-jadongmaemae-jugan-hyeonhwang-1jd3</guid>
      <description>&lt;p&gt;&lt;em&gt;이번 주 보유 비중과 NAV 지수 흐름으로 보는 실계좌 상태&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;이 글은 실계좌(E1) 자동매매의 매주 발행되는 정형 리포트다(2026-11-16~2026-11-20). 절대 금액·&lt;br&gt;
보유 종목명은 공개하지 않고, 비중(%)과 NAV 지수(시드일=100 기준)만 다룬다.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  보유 비중 (2026-11-20 기준)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;보유 1위: 비중 10.60% (KOSPI)&lt;/li&gt;
&lt;li&gt;보유 2위: 비중 10.59% (KOSPI)&lt;/li&gt;
&lt;li&gt;보유 3위: 비중 10.29% (KOSDAQ)&lt;/li&gt;
&lt;li&gt;보유 4위: 비중 10.15% (KOSPI)&lt;/li&gt;
&lt;li&gt;보유 5위: 비중 9.14% (KOSPI)&lt;/li&gt;
&lt;li&gt;보유 6위: 비중 8.94% (KOSPI)&lt;/li&gt;
&lt;li&gt;보유 7위: 비중 8.36% (KOSDAQ)&lt;/li&gt;
&lt;li&gt;보유 8위: 비중 8.29% (KOSPI)&lt;/li&gt;
&lt;li&gt;보유 9위: 비중 8.26% (KOSPI)&lt;/li&gt;
&lt;li&gt;보유 10위: 비중 7.74% (KOSPI)&lt;/li&gt;
&lt;li&gt;보유 11위: 비중 7.62% (KOSPI)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  이번 주 매매 동향
&lt;/h2&gt;

&lt;p&gt;신규진입 7건 · 증가 3건 · 감소 5건 · 청산 6건&lt;/p&gt;

&lt;h2&gt;
  
  
  NAV 지수 (시드일 2026-09-10 = 100)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;2026-11-16: 73.35&lt;/li&gt;
&lt;li&gt;2026-11-17: 70.36&lt;/li&gt;
&lt;li&gt;2026-11-18: 71.33&lt;/li&gt;
&lt;li&gt;2026-11-19: 72.48&lt;/li&gt;
&lt;li&gt;2026-11-20: 68.63&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>quant</category>
      <category>trading</category>
      <category>livetrading</category>
    </item>
    <item>
      <title>[261116~261120] Live Account Auto-Trading Weekly Report</title>
      <dc:creator>finaltype</dc:creator>
      <pubDate>Fri, 20 Nov 2026 23:10:13 +0000</pubDate>
      <link>https://dev.to/finaltype/261116261120-live-account-auto-trading-weekly-report-52g1</link>
      <guid>https://dev.to/finaltype/261116261120-live-account-auto-trading-weekly-report-52g1</guid>
      <description>&lt;p&gt;&lt;em&gt;This week's live-account snapshot, told through position weights and the NAV index&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is the English version of a post originally written in Korean for my &lt;a href="https://finaltype.github.io/quant-blog/architecture/01_project_architecture/" rel="noopener noreferrer"&gt;algorithmic trading system devlog&lt;/a&gt;(new tab). It's an automatically generated, fixed-format weekly report for the live (E1) account (2026-11-16 to 2026-11-20) — no absolute amounts or holding names are disclosed, only position weights (%) and a NAV index (100 = seed date).&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Position Weights (as of 2026-11-20)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Holding #1: weight 10.60% (KOSPI)&lt;/li&gt;
&lt;li&gt;Holding #2: weight 10.59% (KOSPI)&lt;/li&gt;
&lt;li&gt;Holding #3: weight 10.29% (KOSDAQ)&lt;/li&gt;
&lt;li&gt;Holding #4: weight 10.15% (KOSPI)&lt;/li&gt;
&lt;li&gt;Holding #5: weight 9.14% (KOSPI)&lt;/li&gt;
&lt;li&gt;Holding #6: weight 8.94% (KOSPI)&lt;/li&gt;
&lt;li&gt;Holding #7: weight 8.36% (KOSDAQ)&lt;/li&gt;
&lt;li&gt;Holding #8: weight 8.29% (KOSPI)&lt;/li&gt;
&lt;li&gt;Holding #9: weight 8.26% (KOSPI)&lt;/li&gt;
&lt;li&gt;Holding #10: weight 7.74% (KOSPI)&lt;/li&gt;
&lt;li&gt;Holding #11: weight 7.62% (KOSPI)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  This Week's Trading Activity
&lt;/h2&gt;

&lt;p&gt;New entry 7 · Increased 3 · Reduced 5 · Exited 6&lt;/p&gt;

&lt;h2&gt;
  
  
  NAV Index (seed date 2026-09-10 = 100)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;2026-11-16: 73.35&lt;/li&gt;
&lt;li&gt;2026-11-17: 70.36&lt;/li&gt;
&lt;li&gt;2026-11-18: 71.33&lt;/li&gt;
&lt;li&gt;2026-11-19: 72.48&lt;/li&gt;
&lt;li&gt;2026-11-20: 68.63&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>quant</category>
      <category>trading</category>
      <category>livetrading</category>
    </item>
    <item>
      <title>예약 작업이 전부 실패했는데도 일회용 슬롯을 소진한 버그 - 아무 일도 안 한 실행이 자원을 먹었다</title>
      <dc:creator>finaltype</dc:creator>
      <pubDate>Fri, 20 Nov 2026 23:04:07 +0000</pubDate>
      <link>https://dev.to/finaltype/yeyag-jageobi-jeonbu-silpaehaessneundedo-ilhoeyong-seulroseul-sojinhan-beogeu-amu-ildo-an-han-silhaengi-jaweoneul-meogeossda-2nb8</link>
      <guid>https://dev.to/finaltype/yeyag-jageobi-jeonbu-silpaehaessneundedo-ilhoeyong-seulroseul-sojinhan-beogeu-amu-ildo-an-han-silhaengi-jaweoneul-meogeossda-2nb8</guid>
      <description>&lt;p&gt;&lt;em&gt;달력 라이브러리가 1년에 한 번뿐인 특수일을 틀리게 돌려줬고, 그 위에서 "실행=슬롯 소비"라는 전제가 백업 경로를 망가뜨렸습니다&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;제 자동매매 시스템은 하루 중 정해진 시각에 매매 라운드를 자동으로 돕니다. 각 라운드에는 "오늘 이 라운드는 이미 돌았다"를 표시하는 일회용 슬롯이 하나씩 붙어 있습니다.&lt;/p&gt;

&lt;p&gt;같은 라운드가 하루에 두 번 집행되는 걸 막기 위한 장치입니다. 이 슬롯 구조는 종목을 고르는 판단 로직이 아니라 주문 실행·안전장치 계층에 속합니다. 전체 설계는 &lt;a href="https://finaltype.github.io/quant-blog/architecture/05_execution_architecture/" rel="noopener noreferrer"&gt;실전 계좌 적용편&lt;/a&gt;(새 창)에 정리해 뒀습니다.&lt;/p&gt;

&lt;p&gt;그리고 아침 첫 라운드가 어떤 이유로 못 돌면, 조금 뒤에 한 번 더 시도하는 백업 라운드가 따로 있습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  무슨 일이 있었나
&lt;/h2&gt;

&lt;p&gt;어느 특수일에 문제가 터졌습니다. 그날은 국가적인 시험이 있어서 증권거래소가 평소보다 한 시간 늦게 개장하는 날이었습니다.&lt;/p&gt;

&lt;p&gt;그런데 아침 첫 라운드는 평소 시각에 그대로 발화했습니다. 시장이 아직 열리지도 않은 시각이었습니다.&lt;/p&gt;

&lt;p&gt;당연히 모든 주문이 거래소에서 "시장 미개장"이라는 코드로 전량 거절됐습니다. 한 건도 체결되지 않았고, 사실상 아무 일도 일어나지 않은 실행이었습니다.&lt;/p&gt;

&lt;p&gt;문제는 그다음이었습니다. 시장이 실제로 열린 뒤 백업 라운드가 돌긴 했는데, 평소의 정상 경로가 아니라 격하된 폴백 모드로만 돌았습니다.&lt;/p&gt;

&lt;p&gt;이유를 보니, 아침에 전량 거절됐던 그 첫 라운드가 이미 일회용 슬롯을 소진해버린 상태였습니다. 백업 라운드 입장에서는 "오늘 이 슬롯은 이미 쓰였다"고 보였던 겁니다.&lt;/p&gt;

&lt;p&gt;한 건도 체결하지 못한, 환경 때문에 통째로 실패한 실행이 그날의 자원을 먹어버린 셈입니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  처음엔 뭐라고 생각했나
&lt;/h2&gt;

&lt;p&gt;처음엔 타이밍 쪽을 의심했습니다. 라운드가 엉뚱한 시각에 발화한 걸 보고 "스케줄러 설정이 잘못됐나" 하고 스케줄 정의부터 뒤졌습니다.&lt;/p&gt;

&lt;p&gt;스케줄은 정상이었습니다. 라운드는 평소대로 정해진 아침 시각에 발화한 게 맞았습니다.&lt;/p&gt;

&lt;p&gt;문제는 라운드가 발화한 시각이 아니라, 그 시각에 "시장이 열려 있다"고 가정한 쪽이었습니다. 평소에는 그 가정이 맞았고, 그날만 틀렸습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  진짜 원인 — 두 개의 층
&lt;/h2&gt;

&lt;p&gt;원인은 두 층으로 나뉘어 있었습니다.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;첫 번째 층: 달력 라이브러리가 특수일을 틀리게 돌려줬다.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;시스템은 "오늘 몇 시에 개장하는가"를 외부 거래소 달력 라이브러리에서 받아 썼습니다. 평소 거래일에는 이 값이 정확했습니다.&lt;/p&gt;

&lt;p&gt;그런데 이 특수일(개장이 한 시간 늦춰지는 날)에 대해서는 라이브러리가 평소 개장 시각을 그대로 돌려줬습니다. 1년에 한 번 있을까 말까 한 날이라 라이브러리도 이 예외를 반영하지 못하고 있었던 겁니다.&lt;/p&gt;

&lt;p&gt;그래서 코드는 "지금은 개장 이후"라고 믿고 평소대로 주문을 냈습니다.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;두 번째 층 — 이게 진짜 교훈인데: 슬롯을 "실행을 시작한 순간"에 소비했다.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;슬롯을 소비하는 로직은 라운드가 실제로 뭔가를 해냈는지가 아니라, 라운드가 "시작됐다"는 사실만 보고 슬롯을 먹었습니다.&lt;/p&gt;

&lt;p&gt;그래서 주문이 100% 거절돼 아무 체결도 없었던 실행도, 코드 입장에서는 "오늘 이 라운드는 돌았다"로 기록됐습니다.&lt;/p&gt;

&lt;p&gt;실행의 성공/실패와 자원 소비가 분리돼 있지 않았던 겁니다. 첫 번째 층(달력 오류)이 없었어도, 다른 환경적 이유로 라운드가 통째로 거절되는 날이 오면 똑같은 문제가 재발할 구조였습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  어떻게 고쳤나
&lt;/h2&gt;

&lt;p&gt;달력 라이브러리를 고칠 수는 없으니, 신뢰할 수 있는 개장 시각 판정을 따로 만들었습니다.&lt;/p&gt;

&lt;p&gt;평소에는 라이브러리 값을 그대로 쓰되, 미리 알고 있는 특수일(개장 지연일)은 수동으로 관리하는 표에서 먼저 조회하게 했습니다. 이 수동 표가 어떤 이유로든 비어 있으면 안전한 기본값으로 떨어지도록 방향도 정해뒀습니다.&lt;/p&gt;

&lt;p&gt;그리고 아침 라운드가 발화할 때, 이 판정으로 "지금이 개장 이후인가"를 먼저 확인하는 게이트를 뒀습니다. 개장 전이면 라운드를 보류하고, 시장이 실제로 열린 뒤 백업 라운드로 넘깁니다.&lt;/p&gt;

&lt;p&gt;여기서 한 가지 설계 선택을 짚고 넘어갈 만합니다. "그냥 전량 거절된 라운드는 슬롯을 자동으로 반납하게 하면 되지 않나" 싶었습니다.&lt;/p&gt;

&lt;p&gt;실제로 그 안도 검토했습니다. 하지만 자동 반납을 넣지 않기로 했습니다.&lt;/p&gt;

&lt;p&gt;이유는 두 가지였습니다. 하나는 이 상황 자체가 수년에 한 번 수준으로 드물어서, 자동 반납 로직이 늘 켜져 있을 만큼의 값어치가 없었습니다.&lt;/p&gt;

&lt;p&gt;다른 하나가 더 중요했는데, 자동 반납은 이중 집행 위험을 새로 만듭니다. "실패했으니 슬롯을 돌려준다 → 다시 집행한다"는 경로는, 판정이 애매한 경우 같은 라운드를 두 번 발주할 창을 엽니다.&lt;/p&gt;

&lt;p&gt;그래서 자동 반납 대신, 전량 거절이 감지되면 경보를 띄우고 사람이 수동으로 처리하는 쪽을 택했습니다. 드물고 위험한 자동 복구보다, 명시적인 경보 + 수동 개입이 더 안전하다고 봤습니다.&lt;/p&gt;

&lt;p&gt;슬롯을 발주 전에 claim하는 순서 자체도 그대로 뒀습니다. 슬롯을 발주 뒤로 미루면 경합 상황에서 이중 매수가 가능해지기 때문입니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  일반화하면
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;자원을 "시작했으니 소비"하지 말고, "무슨 일을 했는가"에 묶으세요.&lt;/strong&gt; 일회용 슬롯·토큰·멱등성 키 같은 걸 "실행을 시작한 순간"에 소비하면, 아무 일도 못 하고 실패한 실행이 그 자원을 먹어버립니다.&lt;/p&gt;

&lt;p&gt;"실행됐다"와 "일을 해냈다"는 다른 문장입니다. 환경적 이유(외부 의존성이 안 떠 있음, 사전 조건 미충족)로 통째로 실패한 실행은, 자원을 소비한 게 아니라 아예 안 일어난 것으로 취급돼야 할 때가 많습니다.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1년에 한 번뿐인 엣지 케이스야말로 라이브러리 기본값이 틀려 있는 자리입니다.&lt;/strong&gt; 자주 쓰이는 경로는 많은 사람이 밟아서 버그가 일찍 드러납니다. 반대로 드문 특수일·윤초·서머타임 전환 같은 건 테스트도 적고 사용자도 적어서, 외부 라이브러리가 조용히 틀린 값을 돌려주기 쉽습니다.&lt;/p&gt;

&lt;p&gt;그런 희귀 경로는 라이브러리를 맹신하지 말고, 검증된 수동 오버라이드를 얇게 얹어두는 편이 쌉니다.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;격하된 폴백 경로가 있다면, 주 경로의 실패가 폴백을 오염시키지 않는지 확인하세요.&lt;/strong&gt; 백업 라운드는 "주 라운드가 못 돌았을 때"를 위해 존재했는데, 정작 주 라운드가 망가진 방식(슬롯을 먹고 실패)이 백업을 정상 모드로 못 돌게 만들었습니다.&lt;/p&gt;

&lt;p&gt;실패 대비 경로를 설계할 때는, 그 경로가 전제하는 상태(여기선 "슬롯이 아직 비어 있다")가 주 경로 실패 시에도 유지되는지를 따로 점검해야 합니다.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;자동 복구를 "넣지 않는 것"도 설계 결정입니다.&lt;/strong&gt; 실패를 자동으로 되돌리는 로직은 멋있어 보이지만, 복구 경로 자체가 새로운 위험(여기선 이중 집행)을 만들 수 있습니다.&lt;/p&gt;

&lt;p&gt;실패가 드물고, 자동 복구가 더 위험한 실패를 새로 만든다면, 경보 + 수동 개입이 더 나은 선택일 수 있습니다. 모든 걸 자동화하는 게 항상 옳은 건 아니었습니다.&lt;/p&gt;

&lt;p&gt;이 사건 이후로는, 일회용 자원을 소비하는 코드를 새로 짤 때마다 "이 소비가 실행 시작에 묶여 있나, 실제 성과에 묶여 있나"를 한 번 더 확인하는 습관이 생겼습니다.&lt;/p&gt;

</description>
      <category>softwarequality</category>
      <category>postmortem</category>
      <category>debugging</category>
      <category>quant</category>
    </item>
    <item>
      <title>A Scheduled Job Failed Every Action but Still Consumed Its One-Time Slot - A Run That Did Nothing Ate the Resource</title>
      <dc:creator>finaltype</dc:creator>
      <pubDate>Fri, 20 Nov 2026 23:04:06 +0000</pubDate>
      <link>https://dev.to/finaltype/a-scheduled-job-failed-every-action-but-still-consumed-its-one-time-slot-a-run-that-did-nothing-2emo</link>
      <guid>https://dev.to/finaltype/a-scheduled-job-failed-every-action-but-still-consumed-its-one-time-slot-a-run-that-did-nothing-2emo</guid>
      <description>&lt;p&gt;&lt;em&gt;A calendar library returned the wrong value for a once-a-year special day, and on top of that a "running = slot consumed" assumption poisoned the backup path&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is the English version of a post originally written in Korean for my &lt;a href="https://finaltype.github.io/quant-blog/en/architecture/01_project_architecture/" rel="noopener noreferrer"&gt;algorithmic trading system devlog&lt;/a&gt;(new tab).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;My automated trading system runs trading rounds on a fixed schedule during the day. Each round has a one-time slot attached to it that records "this round already ran today."&lt;/p&gt;

&lt;p&gt;It's there to stop the same round from executing twice in one day. This slot mechanism isn't part of the stock-picking logic — it belongs to the order execution/safety layer, whose full design I've written up separately in &lt;a href="https://finaltype.github.io/quant-blog/en/architecture/05_execution_architecture/" rel="noopener noreferrer"&gt;the live-account post&lt;/a&gt;(new tab).&lt;/p&gt;

&lt;p&gt;And if the morning's first round can't run for some reason, there's a separate backup round that tries once more a little later.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happened
&lt;/h2&gt;

&lt;p&gt;The problem showed up on a special day. It was a day with a national exam, when the stock exchange opens an hour later than usual.&lt;/p&gt;

&lt;p&gt;But the first morning round still fired at its normal time. That was a time when the market hadn't opened yet.&lt;/p&gt;

&lt;p&gt;Naturally, every order was rejected by the exchange with a "market not open" code. Not a single one filled — effectively, nothing happened in that run.&lt;/p&gt;

&lt;p&gt;The real trouble came next. When the market actually opened and the backup round ran, it ran only in a degraded fallback mode instead of the normal path.&lt;/p&gt;

&lt;p&gt;Looking into why, the first round that had been rejected wholesale that morning had already consumed the one-time slot. From the backup round's point of view, the slot for today was "already used."&lt;/p&gt;

&lt;p&gt;A run that filled nothing — that failed entirely for environmental reasons — had eaten up the day's resource.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I thought at first
&lt;/h2&gt;

&lt;p&gt;At first I suspected the timing. Seeing the round fire at an odd hour, I assumed the scheduler was misconfigured and started digging through the schedule definitions.&lt;/p&gt;

&lt;p&gt;The schedule was fine. The round had fired at its normal morning time, exactly as intended.&lt;/p&gt;

&lt;p&gt;The problem wasn't the time the round fired — it was the assumption that the market was open at that time. That assumption was right on every normal day, and wrong only on this one.&lt;/p&gt;

&lt;h2&gt;
  
  
  The real cause — two layers
&lt;/h2&gt;

&lt;p&gt;The cause had two layers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer one: the calendar library returned the wrong value for the special day.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The system read "what time does the market open today" from an external exchange-calendar library. On normal trading days, this value was correct.&lt;/p&gt;

&lt;p&gt;But for this special day (the one where the open is pushed back an hour), the library returned the usual opening time. It's a day that happens at most once a year, so the library hadn't accounted for the exception either.&lt;/p&gt;

&lt;p&gt;So the code believed "we're past the open" and placed orders as usual.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer two — and this is the real lesson: the slot was consumed at "the moment the run started."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The slot-consuming logic ate the slot based on the fact that the round had "started," not on whether the round had actually accomplished anything.&lt;/p&gt;

&lt;p&gt;So a run where 100% of the orders were rejected and nothing filled was still recorded, as far as the code was concerned, as "today's round ran."&lt;/p&gt;

&lt;p&gt;Success and failure of a run weren't separated from resource consumption. Even without layer one (the calendar bug), the same problem would recur on any day a round got rejected wholesale for some other environmental reason.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I fixed it
&lt;/h2&gt;

&lt;p&gt;I can't fix the calendar library, so I built a separate, trustworthy opening-time decision.&lt;/p&gt;

&lt;p&gt;On normal days it still uses the library's value, but for special days I know about in advance (delayed-open days) it first consults a manually maintained table. If that manual table is empty for any reason, I made it fall back to a safe default.&lt;/p&gt;

&lt;p&gt;Then, when the morning round fires, I put a gate that first checks "are we past the open?" using this decision. If we're before the open, it holds the round and lets the backup round take over once the market has actually opened.&lt;/p&gt;

&lt;p&gt;One design choice here is worth calling out. I thought, "couldn't I just make a fully rejected round release its slot automatically?"&lt;/p&gt;

&lt;p&gt;I did consider that option. But I decided not to add automatic release.&lt;/p&gt;

&lt;p&gt;There were two reasons. One is that this situation itself is rare — on the order of once every few years — so an auto-release path wouldn't be worth having switched on all the time.&lt;/p&gt;

&lt;p&gt;The other, more important one, is that automatic release creates a new double-execution risk. The path of "it failed, so return the slot → execute again" opens a window to place the same round twice when the decision is ambiguous.&lt;/p&gt;

&lt;p&gt;So instead of auto-release, I chose to raise an alert when a wholesale rejection is detected and let a human handle it manually. I judged explicit alert + manual intervention to be safer than rare, risky automatic recovery.&lt;/p&gt;

&lt;p&gt;I also kept the ordering where the slot is claimed before orders are placed. If you defer the slot claim until after placing orders, you open the door to double buys under contention.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generalizing
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Don't consume a resource because you "started" — tie it to "what you actually did."&lt;/strong&gt; If you consume a one-time slot, token, or idempotency key at "the moment the run starts," a run that failed without doing anything eats that resource.&lt;/p&gt;

&lt;p&gt;"It ran" and "it did the work" are different statements. A run that failed entirely for environmental reasons (a dependency wasn't up, a precondition wasn't met) often should be treated as not having happened at all, rather than as having consumed the resource.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The once-a-year edge case is exactly where a library's default is wrong.&lt;/strong&gt; Frequently used paths get walked by many people, so bugs surface early. Rare special days, leap seconds, daylight-saving transitions — these have fewer tests and fewer users, so an external library quietly returns a wrong value more easily.&lt;/p&gt;

&lt;p&gt;For those rare paths, it's cheaper to not blindly trust the library and instead lay a thin, verified manual override on top.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If you have a degraded fallback path, check that the main path's failure doesn't poison the fallback.&lt;/strong&gt; The backup round existed for "when the main round couldn't run," yet the very way the main round broke (consuming the slot and failing) is what kept the backup from running in normal mode.&lt;/p&gt;

&lt;p&gt;When you design a failure-contingency path, you have to separately verify that the state it assumes (here, "the slot is still free") survives a main-path failure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Choosing &lt;em&gt;not&lt;/em&gt; to add automatic recovery is also a design decision.&lt;/strong&gt; Logic that automatically undoes a failure looks elegant, but the recovery path itself can create a new risk (here, double execution).&lt;/p&gt;

&lt;p&gt;If a failure is rare and auto-recovery introduces a worse new failure, alert + manual intervention can be the better choice. Automating everything isn't always the right call.&lt;/p&gt;

&lt;p&gt;Since this incident, whenever I write new code that consumes a one-time resource, I've picked up the habit of checking once more: "is this consumption tied to the start of the run, or to the actual outcome?"&lt;/p&gt;

</description>
      <category>softwarequality</category>
      <category>postmortem</category>
      <category>debugging</category>
      <category>quant</category>
    </item>
    <item>
      <title>[261120] 플립플롭 경보 재조사 - 사자마자 되파는 원인은 밴드 진동이 아니라 종목 수 변화</title>
      <dc:creator>finaltype</dc:creator>
      <pubDate>Fri, 20 Nov 2026 13:03:56 +0000</pubDate>
      <link>https://dev.to/finaltype/261120-peulribpeulrob-gyeongbo-jaejosa-sajamaja-doepaneun-weonineun-baendeu-jindongi-anira-jongmog-su-byeonhwa-30pp</link>
      <guid>https://dev.to/finaltype/261120-peulribpeulrob-gyeongbo-jaejosa-sajamaja-doepaneun-weonineun-baendeu-jindongi-anira-jongmog-su-byeonhwa-30pp</guid>
      <description>&lt;p&gt;&lt;em&gt;자동매매가 어떤 종목을 샀다가 바로 다음 라운드에 일부를 되파는 "플립플롭" 경보가 또 울렸다. 설계 당시엔 반올림 경계의 가격 흔들림을 의심했는데, 두 달치 집행 기록을 읽기전용으로 다시 집계해보니 진짜 원인은 보유 대상 종목 수가 바뀌면서 종목당 목표금액이 줄어든 것이었다. 스위치를 끄는 대신 관찰을 유지하기로 한 판단 과정을 정리했다.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  사자마자 되파는 "플립플롭" 경보
&lt;/h2&gt;

&lt;p&gt;제 &lt;a href="https://finaltype.github.io/quant-blog/architecture/05_execution_architecture/" rel="noopener noreferrer"&gt;주문 실행·안전장치 계층&lt;/a&gt;(새 창)에는 "플립플롭" 경보라는 게 있습니다.&lt;/p&gt;

&lt;p&gt;어떤 종목을 샀는데, 바로 다음 라운드에서 그 종목의 일부를 다시 파는 상황을 잡아내는 장치입니다.&lt;/p&gt;

&lt;p&gt;사고파는 걸 반복하면 그만큼 매도세와 수수료가 새어나가니까, 그런 왕복이 보이면 "뭔가 꼬였을 수 있다"고 신호를 띄웁니다.&lt;/p&gt;

&lt;p&gt;오늘 아침, 그 경보가 또 한 종목에서 울렸습니다. 올해 들어 같은 종류의 경보가 네 번째였습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  재발 조건이 충족돼서, 그냥 넘길 수 없었다
&lt;/h2&gt;

&lt;p&gt;이 경보에는 처리 규칙이 미리 정해져 있었습니다.&lt;/p&gt;

&lt;p&gt;"같은 종류 경보가 다시 나거나 건수가 늘면, 그때는 대응안을 다시 검토한다"는 조건입니다.&lt;/p&gt;

&lt;p&gt;오늘로 네 번째였으니 그 조건에 걸렸습니다. 그래서 그냥 넘기지 않고, 원인을 처음부터 다시 조사하기로 했습니다.&lt;/p&gt;

&lt;p&gt;조사는 읽기 전용으로만 했습니다. 두 달 남짓한 기간의 집행 기록을 직접 집계했을 뿐, 코드·설정·주문은 한 줄도 건드리지 않았습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  경보의 이름과 실제 원인이 달랐다
&lt;/h2&gt;

&lt;p&gt;여기서 흥미로운 게 나왔습니다.&lt;/p&gt;

&lt;p&gt;이 경보는 원래 "밴드 모서리의 가격 흔들림"을 잡으려고 만든 겁니다. 목표 수량을 계산할 때 소수점을 올림/내림하는 경계에서, 가격이 아주 조금만 움직여도 보유 목표가 한 칸 왔다 갔다 하는 현상이죠.&lt;/p&gt;

&lt;p&gt;그래서 8월에 "한 칸 정도의 흔들림은 무시한다"는 완충 장치를 넣어뒀습니다. 그 장치는 설계한 대로 모서리 흔들림을 잘 막고 있었습니다.&lt;/p&gt;

&lt;p&gt;그런데 지금 울리는 경보는 원인이 달랐습니다.&lt;/p&gt;

&lt;p&gt;집계해보니, 플립플롭이 난 사례의 대부분은 &lt;strong&gt;가격 때문이 아니라 "보유 대상 종목 수"가 늘어났기 때문&lt;/strong&gt;이었습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  종목 수가 늘면 종목당 목표가 줄어든다
&lt;/h2&gt;

&lt;p&gt;구조는 이렇습니다.&lt;/p&gt;

&lt;p&gt;포트폴리오는 정해진 예산을 여러 종목에 나눠 담습니다. 담을 종목이 많아지면, 한 종목에 배정되는 목표 금액은 그만큼 줄어듭니다.&lt;/p&gt;

&lt;p&gt;밤사이 신호가 바뀌어서 담을 종목이 몇 개 늘어나면, 어제 적정했던 보유량이 오늘은 "너무 많다"가 됩니다. 그러면 다음 라운드에서 초과분을 되팔게 됩니다.&lt;/p&gt;

&lt;p&gt;즉 어제 산 종목을 오늘 되파는 건, 그 종목 가격이 흔들려서가 아니라 &lt;strong&gt;옆에 담을 종목이 늘어서&lt;/strong&gt; 벌어진 일이었습니다.&lt;/p&gt;

&lt;p&gt;8월에 넣은 완충 장치가 겨냥한 건 가격 쪽 흔들림이었습니다. 지금 울리는 건 금액 배분 쪽 변화라, 애초에 그 장치로는 막히지 않는 다른 종류의 문제였던 겁니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  스위치를 끄는 게 답일까
&lt;/h2&gt;

&lt;p&gt;대응안 중 하나는, 유휴 현금을 마저 채우려고 조금씩 추가 매수하는 기능을 아예 꺼버리는 것이었습니다.&lt;/p&gt;

&lt;p&gt;이 추가 매수분이 다음 라운드에 되팔리는 경우가 많았으니까요. 끄면 플립플롭 경보 자체가 거의 사라집니다.&lt;/p&gt;

&lt;p&gt;하지만 따져보니 이게 단순히 "플립플롭 수선"이 아니었습니다.&lt;/p&gt;

&lt;p&gt;그 기능을 끄면 그만큼이 현금으로 남습니다. 결국 "현금을 조금 더 들고 가겠다"는 노출 조정 결정과 같아집니다.&lt;/p&gt;

&lt;p&gt;그런데 두 달치 기록으로는 그 추가 매수분이 현금보다 더 벌었다는 증거도, 덜 벌었다는 증거도 뚜렷하지 않았습니다. 표본이 짧고 하락장 한 구간이라 부호를 확정할 수가 없었습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  지금은 관찰을 유지하기로 했다
&lt;/h2&gt;

&lt;p&gt;그래서 오늘은 스위치를 끄지 않고 &lt;strong&gt;관찰을 유지&lt;/strong&gt;하기로 했습니다.&lt;/p&gt;

&lt;p&gt;이유는 세 가지였습니다.&lt;/p&gt;

&lt;p&gt;하나, 플립플롭 때문에 새어나가는 비용 자체가 작았습니다. 며칠 더 기다리는 비용은 무시할 만했습니다.&lt;/p&gt;

&lt;p&gt;둘, 이 기능을 끄는 건 노출을 바꾸는 일인데, 마침 다음 달에 중요한 성과 판정 창이 걸려 있습니다. 그 창 한가운데서 구성·노출을 또 손대면 판정 해석이 지저분해집니다.&lt;/p&gt;

&lt;p&gt;셋, 진짜 원인은 추가 매수 기능이 아니라 그 위쪽, 즉 &lt;strong&gt;종목당 목표금액을 나누는 방식&lt;/strong&gt;에 있었습니다. 그건 스위치 하나로 끌 문제가 아니라, 성과 판정이 끝난 뒤 사이징 설계를 통째로 다시 볼 안건입니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  경보의 재발 조건을 바꿨다
&lt;/h2&gt;

&lt;p&gt;대신 이 경보의 처리 규칙을 손봤습니다.&lt;/p&gt;

&lt;p&gt;지금까지는 "같은 경보가 또 나면 재검토"였는데, 이제는 &lt;strong&gt;종목 수가 늘어서 생긴 플립플롭은 더 이상 재검토 사유가 아니라고&lt;/strong&gt; 명시했습니다. 원인이 뭔지 이미 알았으니까요.&lt;/p&gt;

&lt;p&gt;대신 새 재검토 조건을 걸었습니다 — 종목 수가 늘지 않았는데도 경보가 뜨면(그건 완충 장치가 막는 데 실패했다는 진짜 신호입니다), 또는 경보 빈도가 눈에 띄게 잦아지면, 그때 다시 본다.&lt;/p&gt;

&lt;p&gt;경보를 끄거나 수준을 낮춘 건 아닙니다. 계속 울립니다. 다만 "이 경보가 울렸을 때 뭘 해야 하는가"의 기준을 원인에 맞게 다시 쓴 것뿐입니다.&lt;/p&gt;

&lt;p&gt;이런 외부 검토를 다른 AI에게 맡겼는데, 경보 이름에 끌려가지 않고 두 달치 기록을 직접 집계해 "이름과 실제 원인이 다르다"는 걸 짚어낸 게 이번 조사의 핵심이었습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  곁가지 — 수출 루프 무응답 수정 검증
&lt;/h2&gt;

&lt;p&gt;데이터 쪽에서도 하나 확인했습니다.&lt;/p&gt;

&lt;p&gt;매일 장 마감 뒤 종목 가격 데이터를 내보내는(수출) 과정에서, 특정 종목 하나에서 응답이 안 와 루프가 걸리는 일이 간간이 있었습니다.&lt;/p&gt;

&lt;p&gt;그 수정이 제대로 먹었는지 오늘 검증했는데, 아침 점검에서 전 종목이 빠짐없이 처리됐고 밤 수출에서도 탈락 종목이 0이었습니다.&lt;/p&gt;

&lt;p&gt;함께 보던 "잠정치 비율"(아직 확정 안 된 가격이 섞인 비율)은 사흘째 같은 대역에 머물러 있습니다. 판정표에 "며칠 더 지켜본다"로 적힌 구간이라, 기준은 그대로 두고 하루 더 관찰하기로 했습니다.&lt;/p&gt;

</description>
      <category>quant</category>
      <category>trading</category>
      <category>devlog</category>
    </item>
    <item>
      <title>Re-Investigating the Flip-Flop Alert - The Cause Was a Change in Stock Count, Not Band Oscillation</title>
      <dc:creator>finaltype</dc:creator>
      <pubDate>Fri, 20 Nov 2026 13:02:56 +0000</pubDate>
      <link>https://dev.to/finaltype/re-investigating-the-flip-flop-alert-the-cause-was-a-change-in-stock-count-not-band-oscillation-36j3</link>
      <guid>https://dev.to/finaltype/re-investigating-the-flip-flop-alert-the-cause-was-a-change-in-stock-count-not-band-oscillation-36j3</guid>
      <description>&lt;p&gt;&lt;em&gt;An alert fired again because the trading system bought a stock and sold part of it right back the next round - a "flip-flop." The design had blamed price jitter at the rounding edge, but re-tallying two months of execution logs read-only showed the real cause was the number of target holdings growing, which shrinks each stock's target amount. Here is how I decided to keep observing instead of flipping the switch off.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is the English version of a post originally written in Korean for my &lt;a href="https://finaltype.github.io/quant-blog/en/architecture/01_project_architecture/" rel="noopener noreferrer"&gt;algorithmic trading system devlog&lt;/a&gt;(new tab).&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The "flip-flop" alert — buy, then sell right back
&lt;/h2&gt;

&lt;p&gt;My &lt;a href="https://finaltype.github.io/quant-blog/en/architecture/05_execution_architecture/" rel="noopener noreferrer"&gt;order-execution and safety layer&lt;/a&gt;(new tab) has an alert I call "flip-flop."&lt;/p&gt;

&lt;p&gt;It catches the case where the system buys a stock and then, in the very next round, sells part of that same stock back.&lt;/p&gt;

&lt;p&gt;Buying and selling in quick succession leaks commission and sell-side tax, so when that kind of round trip shows up, the alert says "something may be tangled."&lt;/p&gt;

&lt;p&gt;This morning it fired again on one stock. It was the fourth time this year for the same kind of alert.&lt;/p&gt;

&lt;h2&gt;
  
  
  The re-review condition had been met, so I couldn't just let it pass
&lt;/h2&gt;

&lt;p&gt;This alert came with a pre-set handling rule.&lt;/p&gt;

&lt;p&gt;The rule: "if the same kind of alert recurs or the count grows, re-review the response options."&lt;/p&gt;

&lt;p&gt;Today was the fourth, so the condition tripped. Rather than wave it off, I decided to investigate the cause from scratch.&lt;/p&gt;

&lt;p&gt;The investigation was read-only. I tallied a bit over two months of execution logs directly — not a single line of code, config, or orders was touched.&lt;/p&gt;

&lt;h2&gt;
  
  
  The alert's name and its real cause didn't match
&lt;/h2&gt;

&lt;p&gt;This is where it got interesting.&lt;/p&gt;

&lt;p&gt;The alert was originally built to catch "price jitter at the band edge." When the system computes a target quantity, it rounds a fractional number up or down, and near that boundary even a tiny price move can flip the target holding up or down by one notch.&lt;/p&gt;

&lt;p&gt;So back in August I added a cushion: "ignore wobble of about one notch." That cushion was doing its job — it was blocking the edge jitter as designed.&lt;/p&gt;

&lt;p&gt;But the alert firing now had a different cause.&lt;/p&gt;

&lt;p&gt;When I tallied the cases, most of the flip-flops happened &lt;strong&gt;not because of price, but because the number of target holdings had grown.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  More stocks means a smaller target per stock
&lt;/h2&gt;

&lt;p&gt;Here's the structure.&lt;/p&gt;

&lt;p&gt;The portfolio splits a fixed budget across several stocks. The more stocks it needs to hold, the smaller the target amount allotted to each one.&lt;/p&gt;

&lt;p&gt;If the signal shifts overnight and a few more stocks need to be held, yesterday's reasonable position becomes "too much" today. So the next round sells off the excess.&lt;/p&gt;

&lt;p&gt;In other words, selling today a stock I bought yesterday wasn't because that stock's price wobbled — it was because &lt;strong&gt;more stocks got added alongside it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The cushion I added in August targeted the price-side wobble. What's firing now is a change on the money-allocation side, a different class of problem the cushion was never built to stop.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is flipping the switch off the answer?
&lt;/h2&gt;

&lt;p&gt;One of the response options was to simply turn off the feature that tops up positions a little to use up idle cash.&lt;/p&gt;

&lt;p&gt;Those top-up lots were often the ones sold back the next round, so turning it off makes the flip-flop alert nearly disappear.&lt;/p&gt;

&lt;p&gt;But when I thought it through, this wasn't a plain "fix the flip-flop."&lt;/p&gt;

&lt;p&gt;Turning that feature off leaves that much as cash. It ends up being the same as an exposure decision: "I'll carry a bit more cash."&lt;/p&gt;

&lt;p&gt;And two months of logs showed no clear evidence that those top-up lots earned more than cash would have — nor that they earned less. The sample is short and spans one down-market stretch, so the sign couldn't be pinned down.&lt;/p&gt;

&lt;h2&gt;
  
  
  For now, I chose to keep observing
&lt;/h2&gt;

&lt;p&gt;So today I did not flip the switch off; I chose to &lt;strong&gt;keep observing.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Three reasons.&lt;/p&gt;

&lt;p&gt;One, the cost leaking out of the flip-flops themselves was small. The cost of waiting a few more days was negligible.&lt;/p&gt;

&lt;p&gt;Two, turning this feature off changes exposure, and there happens to be an important performance-judgment window coming next month. Touching composition and exposure again in the middle of that window makes the judgment messy to interpret.&lt;/p&gt;

&lt;p&gt;Three, the real cause wasn't the top-up feature but the layer above it — &lt;strong&gt;the way the per-stock target amount is divided.&lt;/strong&gt; That's not something one switch turns off; it's an agenda to revisit the whole sizing design after the performance judgment is done.&lt;/p&gt;

&lt;h2&gt;
  
  
  I changed the alert's re-review condition
&lt;/h2&gt;

&lt;p&gt;Instead, I reworked the alert's handling rule.&lt;/p&gt;

&lt;p&gt;Until now it was "re-review if the same alert recurs." Now I've written explicitly that &lt;strong&gt;a flip-flop caused by more stocks being held is no longer grounds for re-review&lt;/strong&gt; — because I already know what causes it.&lt;/p&gt;

&lt;p&gt;In its place I set new re-review conditions: if the alert fires &lt;em&gt;without&lt;/em&gt; the stock count growing (that would be the real signal that the cushion failed to block something), or if the alert frequency climbs noticeably, then look again.&lt;/p&gt;

&lt;p&gt;I did not silence the alert or lower its level. It still fires. I only rewrote the "what should I do when this fires" standard to match the actual cause.&lt;/p&gt;

&lt;p&gt;I handed this outside review to another AI, and the heart of the investigation was that it didn't get led by the alert's name — it tallied two months of logs directly and pointed out that the name and the real cause were different.&lt;/p&gt;

&lt;h2&gt;
  
  
  Side note — verifying the export-loop no-response fix
&lt;/h2&gt;

&lt;p&gt;I also confirmed one thing on the data side.&lt;/p&gt;

&lt;p&gt;In the process that exports stock-price data after the market closes each day, there was an occasional case where one particular stock never responded and the loop stalled.&lt;/p&gt;

&lt;p&gt;I verified today that the fix held: the morning check processed every stock with none missed, and the night export had zero dropouts.&lt;/p&gt;

&lt;p&gt;The "provisional ratio" I've been watching alongside it (the share of prices not yet finalized) has sat in the same band for a third day. The decision table marks that band as "watch a few more days," so I'm leaving the criteria as-is and observing one more day.&lt;/p&gt;

</description>
      <category>quant</category>
      <category>trading</category>
      <category>devlog</category>
    </item>
    <item>
      <title>[261119] 개장 1시간 지연일에 아침 매매 라운드가 오발화 - 개장시각 게이트로 막다</title>
      <dc:creator>finaltype</dc:creator>
      <pubDate>Thu, 19 Nov 2026 13:03:00 +0000</pubDate>
      <link>https://dev.to/finaltype/261119-gaejang-1sigan-jiyeonile-acim-maemae-raundeuga-obalhwa-gaejangsigag-geiteuro-magda-2ge3</link>
      <guid>https://dev.to/finaltype/261119-gaejang-1sigan-jiyeonile-acim-maemae-raundeuga-obalhwa-gaejangsigag-geiteuro-magda-2ge3</guid>
      <description>&lt;p&gt;&lt;em&gt;시장이 1시간 늦게 열리는 날, 멈춰뒀던 스케줄 타이머를 다시 켜는 순간 지나간 발화 시각이 즉시 실행되면서 아침 라운드가 닫힌 시장에 주문을 냈다. 전건이 거절됐고, 그 라운드가 집행 슬롯을 선점한 탓에 뒤 라운드까지 막혔다. 원인을 추적해 '실제 개장 시각'을 달력에서 읽어 개장 전 라운드를 보류하도록 고친 과정을 정리했다.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  시장이 1시간 늦게 열리는 날이 있다
&lt;/h2&gt;

&lt;p&gt;한국 증시에는 1년에 한 번, 대학수학능력시험일에 개장이 1시간 늦춰지는 날이 있습니다.&lt;/p&gt;

&lt;p&gt;보통은 오전 9시에 열리지만, 이날은 오전 10시에 엽니다. 새해 첫 거래일도 비슷하게 10시 개장인 경우가 있습니다.&lt;/p&gt;

&lt;p&gt;제 &lt;a href="https://finaltype.github.io/quant-blog/architecture/05_execution_architecture/" rel="noopener noreferrer"&gt;주문 실행·안전장치 계층&lt;/a&gt;(새 창)은 아침·점심·오후 세 번의 라운드로 나눠 돌아갑니다. 그런데 아침 라운드의 스케줄이 "9시 개장"을 전제로 박혀 있었습니다.&lt;/p&gt;

&lt;p&gt;오늘이 바로 그 1시간 지연 개장일이었습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  멈춰뒀던 타이머를 다시 켜자 지나간 발화가 즉시 실행됐다
&lt;/h2&gt;

&lt;p&gt;사고는 두 가지가 겹쳐서 났습니다.&lt;/p&gt;

&lt;p&gt;하나는 스케줄 타이머의 동작 특성입니다. 아침 라운드를 돌리는 타이머를 잠깐 멈췄다가 다시 켜는 상황이 있었는데, 이런 종류의 달력 기반 타이머는 "다시 켜는 순간, 이미 지나가버린 발화 시각을 즉시 한 번 실행"합니다.&lt;/p&gt;

&lt;p&gt;다른 하나는 앞서 말한 개장 시각 전제입니다. 시스템은 아직 9시 개장인 줄 알고 있었습니다.&lt;/p&gt;

&lt;p&gt;이 둘이 겹치면서, 오전 9시가 막 지난 시각에 아침 라운드가 &lt;strong&gt;아직 열리지도 않은 시장&lt;/strong&gt;을 향해 주문을 냈습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  전건 거절, 그리고 슬롯 선점
&lt;/h2&gt;

&lt;p&gt;결과는 깔끔하게 전부 거절이었습니다.&lt;/p&gt;

&lt;p&gt;시장이 안 열렸으니 증권사는 모든 주문을 "장이 안 열렸다"는 사유로 되돌려보냈습니다. 한 건도 체결되지 않았습니다.&lt;/p&gt;

&lt;p&gt;여기까지는 오히려 안전했습니다. 닫힌 시장에 잘못 나간 주문이 체결될 리 없으니까요.&lt;/p&gt;

&lt;p&gt;진짜 문제는 그 다음이었습니다. 아침 라운드는 "오늘 아침 집행은 내가 맡았다"는 표식(집행 슬롯)을 먼저 선점하고 시작합니다. 중복 실행을 막기 위한 장치입니다.&lt;/p&gt;

&lt;p&gt;그런데 이 라운드가 통째로 거절당해놓고도 슬롯은 선점한 채였습니다. 그래서 10시에 시장이 실제로 열렸을 때, 정상적으로 떠야 할 아침 라운드가 "이미 누가 맡았다"며 뜨지 못할 뻔했습니다.&lt;/p&gt;

&lt;p&gt;오늘은 그 선점된 슬롯을 손으로 풀어준 뒤, 10시 5분에 대체 라운드를 다시 돌려서 정상 실행을 확인했습니다. 사람이 끼어들어 메운 셈입니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  고친 것 — 실제 개장 시각을 달력에서 읽는다
&lt;/h2&gt;

&lt;p&gt;저녁에 근본 원인을 손봤습니다.&lt;/p&gt;

&lt;p&gt;핵심은 "9시 개장"이라는 전제를 코드에서 지우는 것이었습니다. 대신 그날의 &lt;strong&gt;실제 개장 시각을 달력에서 읽어오도록&lt;/strong&gt; 바꿨습니다.&lt;/p&gt;

&lt;p&gt;지연 개장일은 1년에 한 번뿐이라 자동으로 완벽히 알아내기 애매합니다. 그래서 수능일처럼 미리 아는 날은 수동 표에 등록해두고, 그 밖에는 거래소 달력을, 둘 다 실패하면 기본값 9시를 쓰도록 3단으로 쌓았습니다.&lt;/p&gt;

&lt;p&gt;이렇게 실제 개장 시각을 알면, 아침 라운드가 개장 전에 발화하려 할 때 "아직 안 열렸다"며 스스로 보류하고, 실제 개장 직후의 대체 시각에 다시 돌게 됩니다.&lt;/p&gt;

&lt;p&gt;평소 거래일(9시 개장)의 동작은 전혀 바뀌지 않습니다. 오직 지연 개장일에만 이 보류가 작동합니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  경보는 넣되, 자동 해제는 넣지 않았다
&lt;/h2&gt;

&lt;p&gt;하나 더, 한 라운드의 주문이 &lt;strong&gt;전부&lt;/strong&gt; "장이 안 열렸다"는 사유로 거절되면 그 사실을 저널에 남기고 경보를 띄우도록 했습니다.&lt;/p&gt;

&lt;p&gt;이번처럼 닫힌 시장에 통째로 주문이 나간 상황을 사람이 바로 알아챌 수 있게요.&lt;/p&gt;

&lt;p&gt;다만 선점된 슬롯을 자동으로 풀어주는 기능은 &lt;strong&gt;일부러 넣지 않았습니다.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;슬롯을 자동 해제하면 편하긴 하지만, "실행이 꼬였을 땐 혼자 더 건드리지 말고 멈춰서 사람을 부른다"는 안전장치의 기본 원칙과 어긋납니다. 슬롯을 누가·언제 푸느냐는 사람이 판단할 영역으로 남겨뒀습니다.&lt;/p&gt;

&lt;p&gt;다음 지연 개장일(새해 첫 거래일)에 이 고침이 실제로 작동하는지 확인하게 됩니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  곁가지 — 호가 수집의 정본 경로를 다른 수집기로 넘겼다
&lt;/h2&gt;

&lt;p&gt;오늘은 데이터 수집 쪽에서도 하나를 바꿨습니다.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://finaltype.github.io/quant-blog/architecture/02_data_archive/" rel="noopener noreferrer"&gt;데이터 아카이브&lt;/a&gt;(새 창)의 호가 스트림에서, 그동안 보조로만 돌리던 수집기를 정본(기준) 경로로 승격했습니다.&lt;/p&gt;

&lt;p&gt;같은 데이터를 두 경로로 받아보며 품질을 비교해오다가, 승격 쪽이 더 안정적이라는 확인이 끝나서 내일(11-20)부터 그쪽을 기준으로 삼기로 했습니다.&lt;/p&gt;

&lt;p&gt;기존 경로는 비활성화하되, 문제가 생기면 설정 한 줄로 되돌릴 수 있게 롤백 경로를 남겨뒀습니다.&lt;/p&gt;

</description>
      <category>quant</category>
      <category>trading</category>
      <category>devlog</category>
    </item>
    <item>
      <title>The Morning Round Misfired on a Late-Open Day - Gating It on the Real Open Time</title>
      <dc:creator>finaltype</dc:creator>
      <pubDate>Thu, 19 Nov 2026 13:02:59 +0000</pubDate>
      <link>https://dev.to/finaltype/the-morning-round-misfired-on-a-late-open-day-gating-it-on-the-real-open-time-e3</link>
      <guid>https://dev.to/finaltype/the-morning-round-misfired-on-a-late-open-day-gating-it-on-the-real-open-time-e3</guid>
      <description>&lt;p&gt;&lt;em&gt;On a day the market opens an hour late, restarting a stopped schedule timer instantly fired its already-elapsed trigger, so the morning round sent orders into a closed market. Every order was rejected, and because that round had claimed the execution slot, the later rounds were blocked too. This is how I tracked it down and made the system read the actual open time from the calendar so a pre-open round holds itself back.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is the English version of a post originally written in Korean for my &lt;a href="https://finaltype.github.io/quant-blog/en/architecture/01_project_architecture/" rel="noopener noreferrer"&gt;algorithmic trading system devlog&lt;/a&gt;(new tab).&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Some days the market opens an hour late
&lt;/h2&gt;

&lt;p&gt;The Korean market has one day a year — the national college entrance exam day — when the open is pushed back by an hour.&lt;/p&gt;

&lt;p&gt;It normally opens at 9 a.m., but on that day it opens at 10. The first trading day of the new year can be a 10 a.m. open too.&lt;/p&gt;

&lt;p&gt;My &lt;a href="https://finaltype.github.io/quant-blog/en/architecture/05_execution_architecture/" rel="noopener noreferrer"&gt;order-execution and safety layer&lt;/a&gt;(new tab) runs in three rounds — morning, midday, afternoon. But the morning round's schedule had a "9 a.m. open" assumption baked into it.&lt;/p&gt;

&lt;p&gt;Today happened to be one of those hour-late opens.&lt;/p&gt;

&lt;h2&gt;
  
  
  Restarting a stopped timer instantly fired a trigger that had already passed
&lt;/h2&gt;

&lt;p&gt;The incident came from two things overlapping.&lt;/p&gt;

&lt;p&gt;One is a behavior of the schedule timer. I had briefly stopped and then restarted the timer that runs the morning round — and this kind of calendar-based timer, the moment you turn it back on, immediately fires once for a trigger time that has already gone by.&lt;/p&gt;

&lt;p&gt;The other is the open-time assumption I mentioned. The system still thought the open was at 9.&lt;/p&gt;

&lt;p&gt;With both overlapping, just after 9 a.m. the morning round sent orders at a market that &lt;strong&gt;wasn't even open yet&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Every order rejected, and the slot claimed
&lt;/h2&gt;

&lt;p&gt;The result was a clean sweep of rejections.&lt;/p&gt;

&lt;p&gt;The market wasn't open, so the broker sent every order back with a "market not open" reason. Not a single one filled.&lt;/p&gt;

&lt;p&gt;Up to here it was actually safe — a wrongly-sent order can't fill against a closed market.&lt;/p&gt;

&lt;p&gt;The real problem came next. The morning round starts by first claiming a marker that says "I've got this morning's execution" — an execution slot, there to prevent duplicate runs.&lt;/p&gt;

&lt;p&gt;But this round got rejected wholesale while still holding the slot. So when the market actually opened at 10, the morning round that should have run normally nearly refused to start, saying "someone already has this."&lt;/p&gt;

&lt;p&gt;Today I released that claimed slot by hand, then re-ran a fallback round at 10:05 and confirmed it executed normally. A human stepping in to fill the gap.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix — read the actual open time from the calendar
&lt;/h2&gt;

&lt;p&gt;In the evening I went after the root cause.&lt;/p&gt;

&lt;p&gt;The core was to delete the "9 a.m. open" assumption from the code. Instead, the system now &lt;strong&gt;reads that day's actual open time from the calendar&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A late-open day comes only once a year, so it's awkward to detect perfectly on its own. So I stacked three tiers: days I know in advance, like exam day, go into a manual table; otherwise the exchange calendar; and if both fail, a 9 a.m. default.&lt;/p&gt;

&lt;p&gt;Once it knows the real open time, when the morning round tries to fire before the open it holds itself back — "not open yet" — and runs again at a fallback time right after the actual open.&lt;/p&gt;

&lt;p&gt;A normal trading day (9 a.m. open) behaves exactly as before. This hold only kicks in on a late-open day.&lt;/p&gt;

&lt;h2&gt;
  
  
  I added the alert, but not an auto-release
&lt;/h2&gt;

&lt;p&gt;One more thing: when &lt;strong&gt;every&lt;/strong&gt; order in a round is rejected for "market not open," the system now journals that fact and raises an alert.&lt;/p&gt;

&lt;p&gt;So a case like today — a whole round fired into a closed market — is something a human notices right away.&lt;/p&gt;

&lt;p&gt;But I deliberately &lt;strong&gt;did not&lt;/strong&gt; add a feature that auto-releases the claimed slot.&lt;/p&gt;

&lt;p&gt;Auto-releasing the slot would be convenient, but it conflicts with the safety layer's basic principle: when execution goes sideways, don't touch anything more on your own — stop and call a human. Who releases the slot, and when, I left as a human's call.&lt;/p&gt;

&lt;p&gt;The next late-open day — the first trading day of the new year — will be when this fix actually gets tested in the wild.&lt;/p&gt;

&lt;h2&gt;
  
  
  A side note — handing the quote feed's canonical path to a different collector
&lt;/h2&gt;

&lt;p&gt;Today I also changed one thing on the data-collection side.&lt;/p&gt;

&lt;p&gt;In the quote-feed stream of my &lt;a href="https://finaltype.github.io/quant-blog/en/architecture/02_data_archive/" rel="noopener noreferrer"&gt;data archive&lt;/a&gt;(new tab), I promoted a collector that had only been running as a backup to the canonical (reference) path.&lt;/p&gt;

&lt;p&gt;I'd been pulling the same data down two paths to compare quality, and now that the promoted one has proven steadier, from tomorrow (Nov 20) it becomes the reference.&lt;/p&gt;

&lt;p&gt;I disabled the old path but left a rollback route, so one line of config brings it back if anything breaks.&lt;/p&gt;

</description>
      <category>quant</category>
      <category>trading</category>
      <category>devlog</category>
    </item>
    <item>
      <title>[261118] 미체결 주문 자동취소 첫 발동 - 증권사 취소 거절과 주문번호 타입 정규화</title>
      <dc:creator>finaltype</dc:creator>
      <pubDate>Wed, 18 Nov 2026 13:03:13 +0000</pubDate>
      <link>https://dev.to/finaltype/261118-micegyeol-jumun-jadongcwiso-ceos-baldong-jeunggweonsa-cwiso-geojeolgwa-jumunbeonho-taib-jeonggyuhwa-3ja2</link>
      <guid>https://dev.to/finaltype/261118-micegyeol-jumun-jadongcwiso-ceos-baldong-jeunggweonsa-cwiso-geojeolgwa-jumunbeonho-taib-jeonggyuhwa-3ja2</guid>
      <description>&lt;p&gt;&lt;em&gt;미체결 매도 주문을 장중에 자동으로 취소·재계획하는 경로가 실계좌에서 처음 작동했는데, 증권사 취소 API가 주문번호 타입 불일치로 거절했고 거절 사유 로그마저 비어 있었다. 원인을 추적해 주문번호를 정수로 정규화하고 거절 사유를 출력하도록 고친 과정과, 같은 날 아침 큰 하락 상태에서 반등일 매수가 전부 막힌 안전장치를 외부 AI 자문으로 점검한 결과를 정리했다.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  한 번도 안 울리던 안전장치가 처음 울렸다
&lt;/h2&gt;

&lt;p&gt;지난주에 &lt;a href="https://finaltype.github.io/quant-blog/architecture/05_execution_architecture/" rel="noopener noreferrer"&gt;주문 실행·안전장치 계층&lt;/a&gt;(새 창)을 실계좌에 올린 뒤로, 며칠 동안 거래가 너무 깨끗하게 돌아갔습니다.&lt;/p&gt;

&lt;p&gt;거절도 없고, 미체결도 없었습니다. 그래서 "미체결 주문을 다음 라운드에서 취소하고 다시 계획하는 경로"는 코드로만 존재했지, 실제 시장에서 증권사에 취소 요청을 한 번도 보낸 적이 없었습니다.&lt;/p&gt;

&lt;p&gt;며칠 전 일지에도 "좋은 날이 쌓일수록 역설적으로 안전장치는 실전 검증을 못 받는다"고 적었습니다.&lt;/p&gt;

&lt;p&gt;오늘 그 경로가 처음으로 발동했습니다. 그리고 발동하자마자 거절당했습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  매도 지정가가 시장보다 높아서 안 팔렸다
&lt;/h2&gt;

&lt;p&gt;발단은 한 종목의 매도 주문이었습니다.&lt;/p&gt;

&lt;p&gt;아침 라운드에서 낸 매도 지정가가 그 시점 시장가보다 살짝 높게 걸렸습니다. 그래서 체결이 안 되고 미체결로 남았습니다.&lt;/p&gt;

&lt;p&gt;제 시스템은 이렇게 미체결로 남은 주문을 점심 라운드 직전에 한 번 취소하고, 다시 계획을 세웁니다. 호가가 시장을 못 따라가서 걸려 있는 주문을 영원히 방치하지 않으려는 장치입니다.&lt;/p&gt;

&lt;p&gt;오늘이 바로 그 취소 경로가 실계좌에서 처음 작동하는 날이 됐습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  취소 API가 거절했는데, 왜 거절했는지는 안 찍혔다
&lt;/h2&gt;

&lt;p&gt;문제는 두 겹이었습니다.&lt;/p&gt;

&lt;p&gt;첫째, 증권사 취소 API가 요청을 거절했습니다. 원 주문번호를 넘길 때 제가 문자열로 보냈는데, 그쪽 API는 그 필드를 정수로 받길 원했습니다. 타입이 안 맞아서 거절 코드만 돌아왔습니다.&lt;/p&gt;

&lt;p&gt;둘째, 더 뼈아팠던 건 그 &lt;strong&gt;거절 사유가 로그에 안 남았다&lt;/strong&gt;는 점입니다. 첫 발동이라 거절 응답을 제대로 받아 적는 처리가 빠져 있었습니다. 거절 코드는 보이는데 "왜"가 비어 있으니, 처음엔 원인을 바로 짚지 못했습니다.&lt;/p&gt;

&lt;p&gt;안전장치의 교과서적인 함정입니다. 평소에 안 울리는 경로일수록, 정작 울렸을 때 그 상황을 설명해줄 로그가 부실하기 쉽습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  고친 것 — 주문번호 정규화와 거절 사유 출력
&lt;/h2&gt;

&lt;p&gt;원인을 확인한 뒤 두 가지를 고쳤습니다.&lt;/p&gt;

&lt;p&gt;하나는 취소 요청을 보내기 전에 원 주문번호를 항상 정수로 정규화하도록 바꿨습니다. 어디서 문자열로 들어오든 API로 나갈 때는 타입이 맞게요.&lt;/p&gt;

&lt;p&gt;다른 하나는 취소가 거절됐을 때 그 사유를 그대로 로그에 찍도록 했습니다. 다음에 또 거절당하면, 이번처럼 "왜"를 뒤늦게 추적하는 일이 없게 하려는 겁니다.&lt;/p&gt;

&lt;p&gt;미체결로 남아 있던 그 종목은 자동 경로가 거절당한 상태라, 오늘은 손으로 직접 정리하고 장부에 그 사실을 따로 적어뒀습니다. 자동이 실패한 자리를 사람이 메운 셈입니다.&lt;/p&gt;

&lt;p&gt;여기서 안전장치의 설계 의도는 그대로 지켜졌다는 점은 짚어둘 만합니다. 취소가 거절되자 경로는 혼자 더 사고 팔지 않고 그 자리에 멈췄습니다. "실패하면 아무것도 안 하고 사람을 부른다"는 설계대로, 거절이 2차 피해로 번지진 않았습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  같은 날 아침 — 큰 하락 상태라 반등일 매수가 전부 막혔다
&lt;/h2&gt;

&lt;p&gt;오늘의 다른 한 축은 아침에 있었습니다.&lt;/p&gt;

&lt;p&gt;제 시스템에는 고점 대비 일정 수준 이상 빠진 국면에서는 신규 매수를 막는 안전장치가 있습니다. 전체 자산이 크게 꺾인 날 더 사들이지 않으려는 장치입니다.&lt;/p&gt;

&lt;p&gt;그런데 최근 고점에서 꽤 내려온 상태였던 탓에, 아침에 올라온 신규 매수 후보가 &lt;strong&gt;전부&lt;/strong&gt; 이 장치에 걸려 차단됐습니다.&lt;/p&gt;

&lt;p&gt;문제는 그날 아침 자산이 전일 대비 오히려 플러스였다는 점입니다. 즉 반등하는 날인데도 "고점 대비 하락 국면"이라는 이유로 매수가 전부 막힌 겁니다. 반등일 매수를 통째로 놓치는 셈이 됩니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  외부 AI 자문 — 그 장치가 실제로 손실을 막고 있었다
&lt;/h2&gt;

&lt;p&gt;이걸 손봐야 할지 판단하려고, 작업을 맡은 것과는 별개의 외부 AI에게 자문을 맡겼습니다. "이 차단 장치를 완화하거나 예외를 두는 게 맞느냐"를요.&lt;/p&gt;

&lt;p&gt;결론은 "현행 유지"였습니다.&lt;/p&gt;

&lt;p&gt;보완안으로 떠올린 방식들이 미리 정해둔 합격선을 하나도 못 넘었고, 차단 장치를 아예 없앴을 때와 뒀을 때의 차이는 통계적으로 구별되지 않았습니다.&lt;/p&gt;

&lt;p&gt;결정적이었던 건 실제로 이 장치가 발동한 날들을 들여다본 결과였습니다. 차단된 매수 후보들이 그날 종가까지 대체로 더 떨어졌습니다. 막은 게 오히려 손실을 피한 쪽이었던 겁니다.&lt;/p&gt;

&lt;p&gt;그래서 아침의 아쉬움과는 별개로, 이 장치도 미체결 재호가도 지금 형태를 그대로 두기로 했습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  바로잡은 오해 하나
&lt;/h2&gt;

&lt;p&gt;자문 과정에서 제 쪽 보고가 틀렸던 것도 하나 잡혔습니다.&lt;/p&gt;

&lt;p&gt;미체결 주문을 세는 집계가 옛날 경로만 들여다보고 있어서, 지금 실제로 쓰는 증권사 경로의 미체결을 못 보고 있었습니다. 그래서 "미체결 0건"이라고 했던 보고가 사실 틀린 것이었습니다.&lt;/p&gt;

&lt;p&gt;오늘 취소 경로가 거절당한 그 미체결 주문이, 바로 그 집계에선 안 보이던 주문이었습니다. 집계가 반쪽만 보고 있으면 "문제 없음"이 "안 보임"과 구별되지 않는다는 걸 다시 확인했습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  왜 중요한가
&lt;/h2&gt;

&lt;p&gt;오늘 하루는 "한 번도 안 울린 안전장치가 처음 울렸을 때 생기는 일"로 요약됩니다.&lt;/p&gt;

&lt;p&gt;취소 경로는 코드로는 완성돼 있었지만, 정작 처음 발동하자 주문번호 타입에서 걸렸고 거절 사유 로그마저 비어 있었습니다. 안 울리던 경로는 늘 이렇게 작은 데서 삐끗합니다.&lt;/p&gt;

&lt;p&gt;그래도 핵심 설계는 지켜졌습니다. 거절이 2차 매매로 번지지 않고 그 자리에 멈췄고, 사람이 손으로 메울 틈을 줬습니다. 안전장치는 "완벽하게 작동하는 것"보다 "실패해도 안전한 쪽으로 쓰러지는 것"으로 믿는 편이 낫다는 걸, 실제 거절을 한 번 받고서 다시 확인했습니다.&lt;/p&gt;

&lt;p&gt;반등일 매수가 막힌 건도 결은 같습니다. 당장은 기회를 놓친 것처럼 보여도, 그 장치가 발동한 날들을 실제로 재어 보면 막은 쪽이 손실을 피하고 있었습니다. 불편하다는 이유만으로 안전장치를 풀면, 보이지 않는 곳에서 더 큰 걸 잃는다는 겁니다.&lt;/p&gt;

</description>
      <category>quant</category>
      <category>trading</category>
      <category>devlog</category>
    </item>
    <item>
      <title>The First Live Order Cancel - A Broker Rejection and an Order-Number Type Mismatch</title>
      <dc:creator>finaltype</dc:creator>
      <pubDate>Wed, 18 Nov 2026 13:03:12 +0000</pubDate>
      <link>https://dev.to/finaltype/the-first-live-order-cancel-a-broker-rejection-and-an-order-number-type-mismatch-3pbj</link>
      <guid>https://dev.to/finaltype/the-first-live-order-cancel-a-broker-rejection-and-an-order-number-type-mismatch-3pbj</guid>
      <description>&lt;p&gt;&lt;em&gt;The path that cancels an unfilled sell order mid-session and re-plans fired on a real account for the first time, and the broker's cancel API rejected it over an order-number type mismatch — with the rejection reason missing from the log. This is how I tracked that down, normalized the order number to an integer, and made the rejection reason print — plus how an external AI advisory checked the safety brake that blocked every buy on a rebound morning.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is the English version of a post originally written in Korean for my &lt;a href="https://finaltype.github.io/quant-blog/en/architecture/01_project_architecture/" rel="noopener noreferrer"&gt;algorithmic trading system devlog&lt;/a&gt;(new tab).&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  A safety path that had never fired, finally fired
&lt;/h2&gt;

&lt;p&gt;Since I put the &lt;a href="https://finaltype.github.io/quant-blog/en/architecture/05_execution_architecture/" rel="noopener noreferrer"&gt;order-execution and safety layer&lt;/a&gt;(new tab) onto a real account last week, trading ran suspiciously clean for days.&lt;/p&gt;

&lt;p&gt;No rejections, no unfilled orders. So the path that cancels an unfilled order in the next round and re-plans existed only in code — I had never once sent a real cancel request to the broker on a live market.&lt;/p&gt;

&lt;p&gt;A few days ago I even wrote in the log that the more "good days" stack up, the more paradoxically the safety machinery never gets its live test.&lt;/p&gt;

&lt;p&gt;Today that path fired for the first time. And the moment it fired, it got rejected.&lt;/p&gt;

&lt;h2&gt;
  
  
  The sell limit sat above the market, so it didn't fill
&lt;/h2&gt;

&lt;p&gt;It started with one stock's sell order.&lt;/p&gt;

&lt;p&gt;The sell limit I set in the morning round landed just above the market price at that moment. So it didn't fill and sat there unfilled.&lt;/p&gt;

&lt;p&gt;My system cancels an order left like this right before the lunch round and re-plans. It's the brake that keeps a quote stranded above the market from being left dangling forever.&lt;/p&gt;

&lt;p&gt;Today became the day that cancel path ran on a live account for the first time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The cancel API rejected it — and didn't log why
&lt;/h2&gt;

&lt;p&gt;The problem came in two layers.&lt;/p&gt;

&lt;p&gt;First, the broker's cancel API rejected the request. When I passed the original order number, I sent it as a string, but the API wanted that field as an integer. The type didn't match, so all I got back was a rejection code.&lt;/p&gt;

&lt;p&gt;Second, and this one stung more: &lt;strong&gt;the rejection reason wasn't recorded in the log&lt;/strong&gt;. Because it was the first firing, the handling that properly captures the rejection response was missing. I could see the rejection code but the "why" was blank, so at first I couldn't pin the cause down.&lt;/p&gt;

&lt;p&gt;It's a textbook trap for safety code. The less often a path fires, the more likely it is that when it finally does, the log that would explain the situation is thin.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I fixed — number normalization and reason logging
&lt;/h2&gt;

&lt;p&gt;Once I confirmed the cause, I fixed two things.&lt;/p&gt;

&lt;p&gt;One: before sending a cancel request, always normalize the original order number to an integer. However it arrives upstream — string or not — it leaves for the API as the right type.&lt;/p&gt;

&lt;p&gt;Two: when a cancel is rejected, write the reason straight to the log. So that next time it gets rejected, I'm not chasing the "why" after the fact the way I was this time.&lt;/p&gt;

&lt;p&gt;The stock still sitting unfilled — with the automated path rejected — I cleaned up by hand today and noted that fact separately in the book. A human filled the spot where automation failed.&lt;/p&gt;

&lt;p&gt;Worth underlining: the safety design held. When the cancel was rejected, the path didn't go off buying or selling more on its own — it stopped right there. Per the design of "if it fails, do nothing and call a human," the rejection didn't cascade into secondary damage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Same morning — a deep drawdown blocked every rebound-day buy
&lt;/h2&gt;

&lt;p&gt;The other axis of today was in the morning.&lt;/p&gt;

&lt;p&gt;My system has a brake that blocks new buys while the portfolio sits a certain amount below its recent peak. It's the device that keeps me from buying more on a day the whole book has dropped hard.&lt;/p&gt;

&lt;p&gt;But since the book had come down a fair bit from its recent high, every new buy candidate that came up in the morning got &lt;strong&gt;all&lt;/strong&gt; caught by this brake and blocked.&lt;/p&gt;

&lt;p&gt;The catch is that the book was actually up versus the prior day that morning. So on a day that was rebounding, buys were all blocked under the reason "still in a drawdown versus the peak." That means missing the rebound-day buys entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  External AI advisory — the brake was actually preventing losses
&lt;/h2&gt;

&lt;p&gt;To judge whether this needed changing, I handed the question to an external AI, separate from the one doing the work: is it right to loosen this brake or carve out an exception?&lt;/p&gt;

&lt;p&gt;The conclusion was "keep it as is."&lt;/p&gt;

&lt;p&gt;The alternative schemes I sketched didn't clear a single one of the pass bars I'd set in advance, and the difference between removing the brake and keeping it was statistically indistinguishable.&lt;/p&gt;

&lt;p&gt;The decisive part was looking at the days the brake actually fired. The buy candidates it blocked mostly fell further by that day's close. Blocking them had, if anything, dodged losses.&lt;/p&gt;

&lt;p&gt;So setting aside the morning's frustration, I decided to leave both this brake and the unfilled-order re-quote exactly as they are.&lt;/p&gt;

&lt;h2&gt;
  
  
  One misread I corrected
&lt;/h2&gt;

&lt;p&gt;The advisory also caught something my own reporting had gotten wrong.&lt;/p&gt;

&lt;p&gt;The tally that counts unfilled orders was only looking at an old path, so it couldn't see the unfilled orders on the broker path I actually use now. So my earlier report of "zero unfilled" was simply wrong.&lt;/p&gt;

&lt;p&gt;The very order whose cancel got rejected today was an order that tally couldn't see. I was reminded again that when a tally only sees half the picture, "no problem" is indistinguishable from "not looking."&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this matters
&lt;/h2&gt;

&lt;p&gt;Today boils down to "what happens when a safety path that has never fired fires for the first time."&lt;/p&gt;

&lt;p&gt;The cancel path was complete in code, but the moment it first fired it tripped on an order-number type, and the rejection-reason log was blank on top of that. A path that never fires always stumbles in small places like this.&lt;/p&gt;

&lt;p&gt;Still, the core design held. The rejection didn't cascade into secondary trades — it stopped in place and left a gap for a human to fill. Having taken a real rejection once, I was reminded that it's better to trust a safety brake for "falling toward the safe side when it fails" than for "working flawlessly."&lt;/p&gt;

&lt;p&gt;The blocked rebound-day buys are the same grain. It looks like a missed opportunity in the moment, but measure the days the brake actually fired and the blocked side was dodging losses. Release a safety brake just because it's inconvenient, and you lose something bigger where you can't see it.&lt;/p&gt;

</description>
      <category>quant</category>
      <category>trading</category>
      <category>devlog</category>
    </item>
    <item>
      <title>[261117] 가격 기반 매매 규칙 백테스트 전부 미달 - 실거래 대신 주문 없는 전방 기록으로</title>
      <dc:creator>finaltype</dc:creator>
      <pubDate>Tue, 17 Nov 2026 13:04:42 +0000</pubDate>
      <link>https://dev.to/finaltype/261117-gagyeog-giban-maemae-gyucig-baegteseuteu-jeonbu-midal-silgeorae-daesin-jumun-eobsneun-jeonbang-girogeuro-if2</link>
      <guid>https://dev.to/finaltype/261117-gagyeog-giban-maemae-gyucig-baegteseuteu-jeonbu-midal-silgeorae-daesin-jumun-eobsneun-jeonbang-girogeuro-if2</guid>
      <description>&lt;p&gt;&lt;em&gt;리포트에 들어있는 가격 값(진입가·손절가·목표가)으로 수익을 더 낼 수 있을지 하루 종일 과거 데이터로 검증했는데, 판정한 규칙이 전부 기준선을 넘지 못했다. 그래서 실거래에 넣는 대신 주문을 내지 않는 전방 기록기를 세워 몇 달 뒤 판정하기로 한 과정과, 그 와중에 발견한 사전등록 규칙 위반을 정리했다.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  "그 가격 값, 그냥 버리긴 아깝지 않아?"
&lt;/h2&gt;

&lt;p&gt;종목을 추천해주는 리포트에는 가격에 관한 값이 몇 개 들어 있습니다.&lt;/p&gt;

&lt;p&gt;진입가, 손절가, 목표가와 그 목표가가 유효한 기간 같은 것들입니다.&lt;/p&gt;

&lt;p&gt;지금까지 매매 판단은 이 값들을 거의 쓰지 않고 돌아갔습니다. 그래서 "이 가격 정보를 매매 규칙에 끌어다 쓰면 수익이 더 나오지 않을까"가 오늘의 출발점이었습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  하루 종일 과거 데이터로 돌렸다
&lt;/h2&gt;

&lt;p&gt;이 질문에 답하는 방법은 하나였습니다. 넉 달 남짓 쌓인 과거 데이터에 그 규칙들을 얹어서 돌려보고, 미리 정해둔 합격선을 넘는지 보는 것입니다.&lt;/p&gt;

&lt;p&gt;손절가로 파는 규칙, 목표가에 도달하면 파는 규칙, 목표가로 살 자리를 정하는 규칙, 그 둘을 묶은 규칙, 가격 값으로 종목 비중을 조절하는 규칙까지.&lt;/p&gt;

&lt;p&gt;하루 동안 판정 대상으로 돌린 규칙만 스무 개가 넘습니다.&lt;/p&gt;

&lt;p&gt;결과는 한 방향이었습니다. 판정한 규칙이 &lt;strong&gt;전부&lt;/strong&gt; 기준선을 넘지 못했습니다.&lt;/p&gt;

&lt;p&gt;여기서 중요한 건 "넘지 못했다"가 "손해였다"는 뜻은 아니라는 점입니다. 엣지가 있다는 증거도 못 찾았지만, 반대로 해롭다는 증거도 거의 없었습니다. 대부분은 그냥 0과 구별되지 않는 잡음이었습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  네 번 반복해서 나온 같은 신호
&lt;/h2&gt;

&lt;p&gt;재미있게도, 매수 쪽에서 같은 현상이 하루에 네 번 반복됐습니다.&lt;/p&gt;

&lt;p&gt;매수에 가격 상한(이 가격 위로는 안 산다)을 걸면, 그 상한 때문에 못 산 종목들이 며칠 뒤 오히려 시장보다 더 많이 올라 있었습니다.&lt;/p&gt;

&lt;p&gt;즉 "비싸 보여서 거른" 종목이 사실은 더 갔던 겁니다. 매수에 가격 밴드를 씌우는 아이디어는 이 한 가지 이유로 계속 손해를 봤습니다.&lt;/p&gt;

&lt;p&gt;반대로 매도 쪽은 가격 값이 조금 나아 보이는 구간이 있었습니다. 하지만 그 이득은 시장이 크게 흔들린 특정 며칠에 몰려 있었고, 평상시엔 사라졌습니다. 상승장 구간은 데이터가 적어 아예 검증이 안 됐습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  "왜 당장 내릴 수 있는 판정을 미루냐"
&lt;/h2&gt;

&lt;p&gt;오늘 작업의 또 다른 축은 속도에 대한 것이었습니다.&lt;/p&gt;

&lt;p&gt;원래 외부 AI에게 받은 설계 자문은 "과거 넉 달로 후보를 좁히고, 앞으로 쌓일 데이터로 몇 달 뒤 확정하자"는 2단 구조였습니다.&lt;/p&gt;

&lt;p&gt;그런데 이렇게 돌려보니 과거 데이터만으로도 대부분 그 자리에서 "미달"이 나왔습니다. 그래서 "당장 판정할 수 있는 걸 왜 내년 2월까지 미루냐"가 합당한 질문이 됐고, 오늘 돌린 시뮬레이션은 전부 그 자리에서 결론을 내는 쪽으로 갔습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  다른 AI에게 "오늘 시뮬레이션이 제대로 된 거냐"를 따로 물었다
&lt;/h2&gt;

&lt;p&gt;하루에 이렇게 많은 검증을 몰아서 돌리면, 중간에 설계가 자문 의도에서 벗어났을 위험이 큽니다.&lt;/p&gt;

&lt;p&gt;그래서 오늘 돌린 시뮬레이션 전체를, 작업을 맡은 것과는 별개의 다른 AI에게 "원래 자문 의도대로 충실하게 된 게 맞느냐"고 독립 검토를 맡겼습니다. 결론을 미리 알려주지 않은 채였습니다.&lt;/p&gt;

&lt;p&gt;검토 결과 다섯 개 결론은 대체로 유지됐지만(재실행은 불필요), 몇 가지 문제가 드러났습니다.&lt;/p&gt;

&lt;p&gt;가장 중요한 건 사전등록 규칙을 하나 어긴 것이었습니다. 어떤 예측력 지표를 계산할 때, "봉인해둔 검증 기간은 끝나기 전까지 들여다보지 않는다"는 규칙을 지켰어야 했는데, 그 기간 일부가 계산에 섞여 들어가 결과 문서에까지 적혔습니다.&lt;/p&gt;

&lt;p&gt;작업 브리프에 그 봉인 제약을 넣어두지 않은 게 원인이었습니다. 발견 즉시 섞여 들어간 값들을 지우고, 요약에서도 가리고, 같은 실수가 안 나도록 날짜 가드를 코드에 박았습니다.&lt;/p&gt;

&lt;p&gt;나머지 지적은 "가드 문구가 실제 증거보다 과하게 단정적이다"는 쪽이었습니다. 예컨대 "어떤 기준으로 봐도 효과 없음"이라고 쓴 문장이, 실제로는 그렇게까지 강하게 말할 근거가 없었습니다. 과장된 표현들을 사실에 맞게 다듬었습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  그래서 넣지 않기로 했다 — 대신 주문 없이 기록만
&lt;/h2&gt;

&lt;p&gt;이 모든 걸 종합한 결정은 이렇습니다.&lt;/p&gt;

&lt;p&gt;가격 기반 매매 규칙은 지금 실거래에 넣지 않습니다. 넉 달치 과거 데이터로는 미세한 효과를 가려낼 검정력이 부족하다는 게 핵심 이유입니다.&lt;/p&gt;

&lt;p&gt;대신 "주문을 내지 않는 전방 기록기"를 세웠습니다.&lt;/p&gt;

&lt;p&gt;매일 장이 끝나면 리포트의 가격 값들을 정해진 형식으로 추출해 저장하고, 후보 규칙 일곱 개를 과거가 아니라 앞으로의 데이터에 매일 재생해서 별도 원장에 쌓습니다. 실제 주문은 한 건도 나가지 않습니다.&lt;/p&gt;

&lt;p&gt;핵심은 이게 &lt;strong&gt;과거를 다시 들여다보는 백테스트가 아니라, 오늘 이후의 새 데이터로만 쌓이는 전방 기록&lt;/strong&gt;이라는 점입니다. 과거 데이터를 아무리 쥐어짜도 못 가리던 효과를, 미리 규칙을 못 박아 둔 채 앞으로의 실제 시장에서 검증하겠다는 겁니다.&lt;/p&gt;

&lt;p&gt;평일 저녁마다 스스로 켜지는 예약 작업으로 돌리고, 중간에 컴퓨터가 재부팅돼도 살아남게 해뒀습니다. 내년 2월 중순에는 "이제 판정할 때가 됐다"고 알려주는 리마인더도 걸어 뒀습니다. 이런 식으로 조용히 돌아가는 배관은 &lt;a href="https://finaltype.github.io/quant-blog/architecture/09_ops_reliability/" rel="noopener noreferrer"&gt;운영 구조&lt;/a&gt;(새 창) 쪽에 속합니다.&lt;/p&gt;

&lt;p&gt;여기서 작은 손질도 하나 했습니다. 이 기록기는 처음엔 돌 때마다 성공 알림을 보냈는데, 평일마다 "잘 돌았음" 알림이 오는 건 소음이라 성공 알림은 끄고 실패했을 때만 경보가 오도록 바꿨습니다.&lt;/p&gt;

&lt;h2&gt;
  
  
  왜 중요한가
&lt;/h2&gt;

&lt;p&gt;오늘 하루는 "새 규칙을 하나 넣었다"가 아니라 "스무 개 넘는 후보를 넣지 않기로 했다"로 끝났습니다.&lt;/p&gt;

&lt;p&gt;이게 아깝게 느껴질 수도 있지만, 백테스트에서 아슬아슬하게 좋아 보이는 규칙을 그대로 실거래에 넣는 게 가장 흔한 함정입니다. 과거 데이터는 늘 과하게 좋아 보이고, 그 "좋아 보임"의 상당 부분은 우연입니다.&lt;/p&gt;

&lt;p&gt;그래서 오늘의 결론은 두 겹입니다.&lt;/p&gt;

&lt;p&gt;하나는 과거 데이터로 못 가리는 효과는 "없다"가 아니라 "지금은 잴 수 없다"로 적어두는 것. 다른 하나는 그걸 확인할 유일한 방법 — 미리 규칙을 못 박고, 주문은 내지 않은 채, 앞으로의 데이터로만 검증하는 전방 기록 — 을 세워두는 것입니다.&lt;/p&gt;

&lt;p&gt;사전등록 규칙을 하루 어겼다가 다른 AI의 독립 검토로 잡아낸 일도 같은 결입니다. 검증 기간을 미리 봉인해두는 규율은, 지키기 번거롭지만 어기면 "우연히 좋아 보이는 것"을 "진짜"로 착각하게 만듭니다. 그래서 어긴 흔적까지 지우고 가드를 박아 두는 게, 넣지 않기로 한 결정만큼이나 중요했습니다.&lt;/p&gt;

</description>
      <category>quant</category>
      <category>trading</category>
      <category>devlog</category>
    </item>
    <item>
      <title>Price-Based Trading Rules All Failed the Backtest - Switching to an Order-Free Forward Recorder</title>
      <dc:creator>finaltype</dc:creator>
      <pubDate>Tue, 17 Nov 2026 13:03:41 +0000</pubDate>
      <link>https://dev.to/finaltype/price-based-trading-rules-all-failed-the-backtest-switching-to-an-order-free-forward-recorder-8mp</link>
      <guid>https://dev.to/finaltype/price-based-trading-rules-all-failed-the-backtest-switching-to-an-order-free-forward-recorder-8mp</guid>
      <description>&lt;p&gt;&lt;em&gt;I spent a whole day backtesting whether the price fields in my recommendation reports (entry, stop, target) could squeeze out more return, and every rule I judged fell short of the bar. So instead of putting any of them into live trading, I stood up an order-free forward recorder to judge them months from now. This is that process, plus a pre-registration rule I caught myself breaking.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is the English version of a post originally written in Korean for my &lt;a href="https://finaltype.github.io/quant-blog/en/architecture/01_project_architecture/" rel="noopener noreferrer"&gt;algorithmic trading system devlog&lt;/a&gt;(new tab).&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  "Isn't it a waste to just throw those price fields away?"
&lt;/h2&gt;

&lt;p&gt;The reports that recommend stocks carry a few price-related fields.&lt;/p&gt;

&lt;p&gt;Things like an entry price, a stop-loss price, a target price, and the horizon over which that target is supposed to hold.&lt;/p&gt;

&lt;p&gt;Up to now my trading logic barely touched these values. So the starting point today was a simple question: if I pull this price information into the trading rules, would returns improve?&lt;/p&gt;

&lt;h2&gt;
  
  
  A full day of running them against historical data
&lt;/h2&gt;

&lt;p&gt;There was only one way to answer that. Lay the rules over roughly four months of accumulated history, run them, and see whether they clear a bar I set in advance.&lt;/p&gt;

&lt;p&gt;Rules that sell at the stop-loss price, rules that sell when the target is hit, rules that use the target to decide where to buy, rules combining both, rules that tilt position sizing by the price values.&lt;/p&gt;

&lt;p&gt;By the end of the day I had judged more than twenty rules.&lt;/p&gt;

&lt;p&gt;The result pointed one way. Every rule I judged fell short of the bar.&lt;/p&gt;

&lt;p&gt;The important part is that "fell short" does not mean "lost money." I found no evidence of an edge — but no real evidence of harm either. Most of it was just noise indistinguishable from zero.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same signal, repeated four times
&lt;/h2&gt;

&lt;p&gt;Interestingly, one pattern on the buy side repeated four separate times in a single day.&lt;/p&gt;

&lt;p&gt;Whenever I put a price ceiling on buying ("don't buy above this price"), the stocks I was blocked from buying because of that ceiling had, a few days later, risen more than the market.&lt;/p&gt;

&lt;p&gt;In other words, the names I filtered out for "looking expensive" were actually the ones that kept running. Putting a price band on buying lost money for this one reason, every time.&lt;/p&gt;

&lt;p&gt;The sell side looked slightly better in spots. But that gain was concentrated in a few days when the market swung hard, and in normal times it vanished. Rising-market stretches had too little data to test at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  "Why defer a verdict I can reach right now?"
&lt;/h2&gt;

&lt;p&gt;The other axis of the day was about speed.&lt;/p&gt;

&lt;p&gt;The original design advice I'd gotten from an external AI was a two-stage structure: narrow the candidates on four months of history, then confirm months later on data that would accumulate going forward.&lt;/p&gt;

&lt;p&gt;But once I ran things, most of them returned a "fail" right there on the historical data alone. That made "why defer until next February a verdict I can reach today?" a fair question — so every simulation I ran today was pushed to a conclusion on the spot.&lt;/p&gt;

&lt;h2&gt;
  
  
  I asked a separate AI whether today's simulations were done right
&lt;/h2&gt;

&lt;p&gt;When you cram this many tests into one day, there's a real risk that a design drifts away from the advice's intent somewhere along the line.&lt;/p&gt;

&lt;p&gt;So I handed the entire batch of today's simulations to a different AI — separate from the one doing the work — and asked it to independently review whether they were faithful to the original advice. I did not tell it my conclusions beforehand.&lt;/p&gt;

&lt;p&gt;The review kept most of the five conclusions intact (no re-runs needed), but it surfaced a few problems.&lt;/p&gt;

&lt;p&gt;The most important one was that I had broken a pre-registration rule. When computing a certain predictive-power metric, I should have honored the rule "do not look at a sealed validation window until it's over" — but part of that window leaked into the computation and even made it into the result document.&lt;/p&gt;

&lt;p&gt;The cause was that I hadn't written the sealing constraint into the work brief. As soon as it was found, I deleted the leaked values, redacted them from the summary, and baked a date guard into the code so the same mistake can't recur.&lt;/p&gt;

&lt;p&gt;The rest of the review was that some guard wording was more absolute than the evidence warranted. A sentence I'd written as "no effect by any measure," for instance, didn't actually have the grounds to be stated that strongly. I toned those overstatements down to match the facts.&lt;/p&gt;

&lt;h2&gt;
  
  
  So I decided not to ship them — and to record only, with no orders
&lt;/h2&gt;

&lt;p&gt;Pulling all of this together, the decision was this.&lt;/p&gt;

&lt;p&gt;Price-based trading rules do not go into live trading right now. The core reason is that four months of history simply lack the statistical power to resolve such a faint effect.&lt;/p&gt;

&lt;p&gt;Instead I stood up an "order-free forward recorder."&lt;/p&gt;

&lt;p&gt;Every day after the close, it extracts the report's price values into a fixed format and stores them, then replays seven candidate rules — not on the past, but on the data going forward — accumulating results into a separate ledger each day. Not a single real order is placed.&lt;/p&gt;

&lt;p&gt;The key is that this is &lt;strong&gt;not a backtest that keeps re-examining the past, but a forward record that only accumulates on new data from today onward&lt;/strong&gt;. An effect that no amount of squeezing the history could resolve, I'll instead test on the real market going forward, with the rules nailed down in advance.&lt;/p&gt;

&lt;p&gt;It runs on a scheduled job that wakes itself every weekday evening, and I made it survive a reboot in the middle. I also set a reminder for mid-February next year to say "now it's time to judge." Quiet plumbing like this belongs to the &lt;a href="https://finaltype.github.io/quant-blog/en/architecture/09_ops_reliability/" rel="noopener noreferrer"&gt;operations side&lt;/a&gt;(new tab).&lt;/p&gt;

&lt;p&gt;One small tweak went in here too. The recorder initially sent a success notification every time it ran, but a "ran fine" ping every weekday is just noise — so I turned off success notifications and left only the failure alert.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it matters
&lt;/h2&gt;

&lt;p&gt;Today ended not with "I added one new rule" but with "I decided not to add more than twenty candidates."&lt;/p&gt;

&lt;p&gt;That can feel like a waste, but shipping a rule that looks marginally good in a backtest straight into live trading is the most common trap there is. History always looks too good, and much of that "looking good" is luck.&lt;/p&gt;

&lt;p&gt;So today's conclusion has two layers.&lt;/p&gt;

&lt;p&gt;One is to write down an effect the history can't resolve as "can't measure yet," not as "doesn't exist." The other is to stand up the only way to actually settle it — nail the rules down in advance, place no orders, and verify only on data going forward.&lt;/p&gt;

&lt;p&gt;Catching myself breaking a pre-registration rule for a day, only for a different AI's independent review to flag it, is the same thread. The discipline of sealing a validation window in advance is a hassle to keep, but breaking it tricks you into mistaking "looks good by chance" for "real." So scrubbing even the trace of the breach and baking in a guard mattered as much as the decision not to ship.&lt;/p&gt;

</description>
      <category>quant</category>
      <category>trading</category>
      <category>devlog</category>
    </item>
  </channel>
</rss>
