Skip to content
vp.Ven Petrov
WorkAI demoWritingResourcesResume / CVAboutAt a glance
← Projects & notes
Small-cap edge researchProject story · 4 min read

What would make a small-cap price pattern worth testing?

I built a Python and DuckDB prototype to turn trading ideas into named tests, compare their costs and revisit them in later periods. The candidates deteriorated under further checks, and the source exposed a misleading pass flag.

Ven PetrovArchived prototype

A price pattern is easy to describe loosely. Testing it requires a more exact statement: which shares qualify, when the necessary information is available, when entry happens and what it costs to act on the signal. Without those details, two runs can appear to test the same idea while doing different things.

I asked Claude Code to build a fresh research system for my small-cap data using an existing methodology. I wanted rolling evaluation, checks for weakening patterns and enough documentation for another session to continue the work. Reusing a collection of old scripts was not the brief.

The result was a Python and DuckDB prototype. DuckDB calculates tables in SQL; Python generates named candidates and collects their comparisons. It can test individual conditions and combine selected conditions into pairs or triples.

The archived research contains failed robustness checks and deterioration in later periods. It established an implemented way to investigate candidates, not a proven trading strategy. One candidate shows the decisions more clearly than the module list.

Give the idea a definition that stays with its result

gap_dn_green_fb describes a share opening more than 2% below the previous session, followed by a first one-minute bar that closes above its own opening price. The candidate tests buying in the expectation of a rise.

Its stored condition is:

f.gap_pct < -2 AND f.first_bar_green = 1

The name remains attached to the direction, filters and results. Adding a second condition creates a traceable variation of that test instead of another unexplained result.

Preparation makes one row per symbol and trading session from one-minute bars. It also builds prices at timed exits so different exits can be compared. Session filtering uses America/New_York and 09:30 to 16:00, which accounts for daylight-saving changes rather than assuming one fixed UTC offset.

A daily row can hide an important timing mistake. A feature built from the first five minutes cannot justify an entry before those minutes have happened. The feature-to-entry timing still needs a complete audit before these research calculations can be treated as executable trades.

The same commission changes a cheap share’s result more

The cost model assumes $0.005 per share on entry and again on exit, plus 0.05% slippage on each side. Slippage represents the difference between the modeled price and the price a trade might receive.

cost_pct = (0.005 / entry_price * 2 + 0.0005 * 2) * 100

At a $2 entry, those assumptions cost 0.6% round trip. At $10, they cost 0.2%. A result that survives costs at the higher price might disappear at the lower one. Calculating with the candidate's entry price preserves that distinction.

These are explicit research assumptions, not verified fills or an account's actual fees.

“Not enough data” cannot mean the same thing as “passed”

A good combined total can depend on one strong year or a handful of extreme observations. The validation code compares years, removes a strong year, increases costs and checks sensitivity to extremes. These comparisons help locate what carries a candidate's result.

The reviewed source also contains a reporting defect. If either the bullish or bearish group has fewer than 20 trades, test_regime_stability() records “insufficient data” but returns passed=True. A count of passed tests can therefore include a comparison that never had enough evidence to be made.

Too little evidence can still return a pass

bull_n < 20 or bear_n < 20Insufficient sample

One side of the regime comparison lacks enough trades.

passed = TrueCurrent return value

The detail explains the missing evidence, but the flag reports a pass.

This behavior remains in the inspected prototype. A separate insufficient-data result would avoid presenting the missing comparison as a successful check.

I would give insufficient evidence its own outcome before using that count to rank candidates. This is a proposed correction, not a repair already made. Selection also revisited historical years, so those years cannot later be presented as untouched tests.

Preserve the failed ideas as well as the candidate definitions

A recorded 22 March 2026 development run reported 67 passing unit tests. That is historical test output, separate from the research result. Passing tests did not stop candidates from failing robustness checks or deteriorating on later data.

The original project folder and dataset are unavailable on this Mac. Selected source was reconstructed from successful writes and edits in the local Claude Code history; the full research was not rerun. The archive supports the implemented profiler, hypothesis generation, cost comparisons, validation, exits and monitoring. It does not establish live audited returns or working brokerage execution.

I also asked for the methodology and pitfalls to be documented so a fresh session could continue with less occupied context. Keeping named conditions, failed ideas and open checks makes that possible without reducing the work to its most promising headline number.

Project sources & checks
Archived implementation

Local Claude Code history contains successful source writes and edits for the profiler, hypothesis miner, validation checks, cost model, exit comparison and monitoring modules.

Historical test evidence

A recorded 22 March 2026 unit-suite run reports 67 passing tests. This is historical output, not a fresh run of the complete project.

Source availability

Selected source snapshots were reconstructed from successful operations in the local history. The original project folder and dataset are unavailable on this Mac.

Research boundary

The history records failed robustness checks and later-period deterioration. No live audited returns or qualified brokerage execution are established.

On this page
Give the idea a definition that stays with its resultThe same commission changes a cheap share’s result more“Not enough data” cannot mean the same thing as “passed”Preserve the failed ideas as well as the candidate definitionsSources & checks
PythonDuckDBResearch systemsTestingExperiment tracking

Connected to this

All writing
MNQ time-series research · Experiment

A time-series model that failed on later data

Crude-oil narrative tracker · Project story

Following crude-oil news without losing the market numbers

Ven PetrovSoftware engineer · Barcelona
GitHub ↗LinkedIn ↗Email ↗

Find a project or a note

18 results

Transfutur ERP · ExperienceERP for transport and logisticsAs the sole engineer, I built an ERP from zero for transport and logistics. It supported roughly €5–6 million in annual invoicing across two offices, and I kept it running for about a year.Finance evidence desk · Project storyCan an AI reviewer improve a financial explanation?A finance review needs the right explanation as well as the right numbers. I tested one AI analyst, an added reviewer and self-review on the same public report. The added review produced fewer supported answers.Financial review lab · Project storyWhat contributed to an $86 million rise in operating income?I built a financial-report explorer around a question I could check: how did seven income-statement movements add up to an $86 million increase? The same source now supports comparisons of sales, cash flow and reported versus core results.MNQ time-series research · ExperimentA time-series model that failed on later dataA model gained about $2,351 in the research simulation, then lost about $1,728 in three later windows. I followed the experiment from data acquisition and time intervals to costs, evaluation and the decision to reject it for trading.Crude-oil narrative tracker · Project storyFollowing crude-oil news without losing the market numbersI used a short personal experiment to follow global events alongside crude-oil prices and position values. The prototype calculates the numbers before asking Claude Code for an assessment and keeps a limited recent history.NQ/MNQ backtest engine · Technical noteYesterday’s short was blocking today’s trades in the simulatorWhen input stopped before the scheduled close, the strategy forgot a position but a shared counter kept counting it. Closing the old position before resetting the day restored the trade record and released the block.Small-cap edge research · Project storyWhat would make a small-cap price pattern worth testing?I built a Python and DuckDB prototype to turn trading ideas into named tests, compare their costs and revisit them in later periods. The candidates deteriorated under further checks, and the source exposed a misleading pass flag.Gadgeon Europe applications · ExperienceConnected-device dashboards and mobile apps at Gadgeon EuropeThe dashboards let people monitor energy use and control connected devices through data from several APIs. My work covered customized Ionic and Angular apps, integrations, store releases and maintenance.ctxforge · Project storyctxforge: turn “add search” into a task an agent can build“Add search” leaves decisions about data, matching and behavior unanswered. I built an editable toolkit that asks an LLM to uncover those requirements and show its assumptions before a coding agent starts.Sociedades Inactivas enquiries · Technical noteAn enquiry should survive a failed emailA failed notification should not make someone submit the same enquiry twice. The implemented form keeps the saved request and its reference while email delivery is retried; live activation is still pending.Astro local-services website · Project storyKeeping local service pages and their FAQs consistentA city page should only offer services enabled for that location. I used shared Astro templates with explicit availability rules, and one FAQ selection for both the visible page and its structured data.3D Spaces website migration · Project storyMoving 3D Spaces without moving its mailboxThe website could move to Next.js and Vercel, while email still depended on the old host. I carried over the pages, enquiry flow and analytics, then checked what the cutover had actually preserved.Capture CRM · Project storySave the listing now, connect the person when the details arriveA classified listing may arrive before its phone number or contact name. Capture CRM keeps those records separate, then lets a later capture complete the existing listing and bring contact status back to the browsing page.Product-description comparison bench · ExperimentWhere did the product description get that detail wrong?A product description can go wrong when the image is read or when the copy is written. This local bench exposes both steps, lets me switch models and records request measurements. A matched quality comparison is still unfinished.Between Us · Project storyBetween Us: keeping control of a generated filmA more emotional dialogue take still needed convincing acting and framing. I kept the alternatives, widened shots to reveal gestures and changed the workflow when its studio limited the films I wanted to make.Restaurant-service voice agent · ExperimentDesigning a restaurant-service call around the real offerThe first correction was the offer: a paid service had become a free visit in one draft. I then compared how the Spanish voice-agent prompts handled new speakers, technical limits and booking results.Vapi and Telnyx voice integration · Technical noteThe Vapi agent could speak, but it could not hear me clearlyI could hear the assistant, but it could not understand my distorted audio. Three codec tests changed the connection behavior and brought the greeting back; the caller-audio problem remains unresolved.Warloop: Echoes of Solmara · Project storyWarloop: turning generated character art into a playable prototypeGood-looking character images became tiny figures, a backwards walk and misplaced bosses in the game. I worked through the gap between generated art and playable behavior.
esc to close · Tab to move through results