falcon-stats: A Trading Discipline System Built on PAI

falcon-stats: A Trading Discipline System Built on PAI

I have been day trading for about 13 months. In that time I have taken 1,254 round-trips across 187 different stocks. And until two weeks ago, I had no idea what my actual numbers looked like.

Now I do. I built a system to tell me, and the answer was uncomfortable: I am running a negative expectancy of -0.79R per trade on average, despite winning 51% of my trading days.

Here is the thing — that is not a stock-picking problem. I win more days than I lose. The problem is behavioral: my average red day is 2.5 times the size of my average green day. I size up when I should size down. I grind 24 round-trips on AMD when I should take one clean setup and walk away.

I am a winning trader with a losing habit. And now I have the data to prove it.

What falcon-stats Does

falcon-stats is a Python package that turns your DAS Trader exports and broker statements into honest, unflinching self-assessment. It is built on Daniel Miessler‘s PAI (Personal AI Infrastructure) framework, and it uses TELOS — the life operating system from PAI — to connect your trading performance to your personal goals, challenges, and strategies.

Here is what it does:

Ingests your trades. It reads DAS Trader CSV exports and Cobra Trading broker Excel statements, groups individual executions into round-trips (handling scaling in, partial fills, and multiple positions per symbol per day), and computes R-multiples from your planned stops.

Calculates your real numbers. Win rate, expectancy, profit factor, max drawdown, R-multiple distribution, and streak tracking. Not from a sample of your best days — from every trade you have ever taken.

Scores your discipline. Each trading day gets a discipline score from 1 to 10 based on trade count, R-asymmetry (are your winners bigger than your losers?), and process adherence. Green means you traded well (7 or higher). Red means you did not. The color has nothing to do with whether you made money.

Identifies your patterns. Which tickers are you trading the most? Which ones are costing you money despite high win rates? My data showed that AMD — a stock I win 69% of the time — has a deeply negative R-expectancy because the 31% I lose are five times bigger than the 69% I win. AMD is now banned from my live account until I prove edge in simulation.

Runs statistical covariance. Before I trade any stock, I pull 90 days of daily price data from Polygon and calculate the z-score — how far the current price is from its 20-day mean in standard deviations. Stocks in normal range get my Fashionably Late long setups. Stocks at statistical extremes get Offsides short setups. The math tells me which direction to trade instead of my gut.

Estimates costs. A trade cost calculator uses my actual Cobra broker fee data from 847 executions to estimate commissions, ECN fees, SEC fees, and breakeven move for any planned trade. Spoiler: fees are negligible relative to the R-multiple on most trades. The problem is not costs. It is behavior.

The Architecture

DynamoDB is the source of truth for all trading data. Not Notion. Not a spreadsheet. DynamoDB.

I learned this the hard way when I accidentally deleted my Notion databases. If your source of truth is a SaaS product you do not control, you do not have a source of truth. Now Notion is a rebuildable view — if it disappears, I recreate it from DynamoDB in minutes.

DAS CSV --> falcon-stats --> DynamoDB (source of truth)
                                |
                                +-> Notion (rebuildable view)
                                +-> Slack (discipline posts)
                                +-> Substrate (historical CSV)

The system is designed with extension points. If you use Interactive Brokers instead of Cobra, you write one parser class. If you prefer PostgreSQL over DynamoDB, you implement one database interface. Notion, Obsidian, plain markdown — swap the publisher. The core engine does not care where the data comes from or where it goes.

How PAI and TELOS Make This Work

falcon-stats is not just a statistics engine. It is integrated into a complete Personal AI Infrastructure that includes:

Morning Game Plans. Every trading day at 4:30 AM, an automated agent scans pre-market gappers, calculates z-scores, filters for my account size, and publishes a watchlist to Notion and Slack with specific Fashionably Late and Offsides Reversal entry scenarios. I wake up to a game plan I did not have to build manually.

Daily Reviews. After each session, I ingest my trades and get a discipline-graded report card. Did I follow the game plan? Did I honor stops? Did I trade outside my restriction list? The system knows my active behavioral challenges (revenge trading, inverse sizing) and checks for them.

Weekly Readiness Reviews. Every Sunday evening, the system pulls previous week earnings results, coming week catalysts, YouTube intel from my trusted channels, Substrate macro data, and my personal trading statistics. It publishes a strategic prep document with chart walkthrough narratives that I can record as video content.

TELOS Integration. My trading goals, challenges, strategies, and lessons learned are all tracked in TELOSPAI’s life operating system. When I discover that my top 5 losing tickers account for 79% of my total losses, that lesson gets captured in TELOS and referenced in every future game plan. The system learns because I learn.

The Philosophy: P&L Over Price Action

I was trading 24 round-trips on AMD in a single session with a 64% win rate and still losing money. My AI partner said something that changed my thinking: “You are watching the price action instead of managing your P&L. Focus on the R-multiple you are capturing, not the number of trades you are taking.”

One trade at 2R is worth more than twenty trades at 0.1R. The math is simple:

  • One trade per day targeting 2R with a 50% win rate = +0.5R expected value per trade
  • That flips the expectancy from -0.79R to +0.5R per trade
  • Over 20 trading days per month, the R-curve goes from declining to compounding

The entire system — the covariance analysis, the discipline scoring, the restriction list, the one-trade commitment — exists to enforce this insight. Order flow first, then price action, but always manage to the P&L. Fewer trades, better R-multiples.

Who This Is For

This is specifically built for DAS Trader and Cobra Trading customers who are willing to store their data in DynamoDB. That is a narrow audience. But the architecture is modular — with a little work, you can adapt it to Interactive Brokers, TWS Gateway, or any broker that exports trade data. You can swap DynamoDB for Google BigTable, PostgreSQL, or SQLite.

More broadly, this is for anyone in Daniel’s PAI community who wants to see how TELOS and PAI can be applied to a performance discipline. The pattern works for trading, but it works for anything that requires deliberate practice and honest self-assessment.

If you want to share your progress with a mentor, a coach, or a prospective employer, this system produces the documentation automatically. The discipline scores, the statistical analysis, the data-backed strategy evolution — it is all there, updated daily, backed by real data.

Getting Started

The repository is at github.com/davdunc/falcon-stats. The README has setup instructions for DAS Trader + Cobra + AWS.

If you are using PAI, the Trading skill templates are designed to drop into your ~/.claude/skills/ directory. Customize the playbook setups, add your own YouTube channels, set your account size constraints, and the system adapts to your trading.

Acknowledgments

This system would not exist without Daniel Miessler‘s PAI framework. The Algorithm, the skill system, TELOS, the memory architecture — Daniel designed all of it and open-sourced it generously. I forked it and rebuilt it for my own mission, and now I am sharing what I built on top of it.

Thanks also to James Diamont for the coaching that helped me see the patterns in my trading before the data confirmed them. And to the SMB Capital team, whose PlayBook methodology and Fashionably Late / Offsides scalp frameworks gave me the specific setups to build a systematic approach around.

The numbers are not where I want them yet. But for the first time, I can see exactly what needs to change, I have the tools to measure whether it is working, and I have an AI partner that remembers everything and never lets me pretend the data says something it does not.


David Duncan is a momentum trader, Fedora Cloud SIG contributor, and builder of AI-assisted trading infrastructure at davidduncan.org. The falcon-stats source code is available at github.com/davdunc/falcon-stats.

links

social