Skip to content
vp.Ven Petrov
WorkAI demoWritingResourcesResume / CVAboutAt a glance
← Projects & notes
Crude-oil narrative trackerProject story · 4 min read

Following crude-oil news without losing the market numbers

I 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.

Ven PetrovLocal prototype

When following a fast-moving conflict, I wanted help deciding which new developments might change my view of crude oil. A news summary on its own would not answer that. I also needed to see what the market was doing and what the current price meant for a position.

I tried this tracker for a few days while following the Iran conflict and recall a small positive outcome. I have no verified P/L record here, and a short personal trial cannot establish predictive accuracy or a profitable strategy.

The prototype puts news research and market numbers in one assessment. Prices are fetched first. Python calculates position P/L, meaning modeled profit or loss, along with distances and risk/reward. Claude Code receives those values and researches surrounding news and possible implications. Its prompt asks it to use the supplied numbers when writing the assessment.

That division gives me arithmetic to inspect alongside the explanation. It does not prove that the market feed is always accurate or that the model always follows the instructions.

Let the assessment start from calculated values

assess.sh gathers prices, optional open/high/low/close data and RSS news intelligence before invoking Claude Code:

Input or output Responsibility
Market prices Fetched before the model call
Position arithmetic Computed in Python
News research and qualitative interpretation Requested from Claude Code
Assessment history Stored and compressed by the surrounding scripts

The surrounding scripts also decide whether to request another assessment. A triage step checks elapsed time, price movement, critical flags, new important items and a configured contract-change window. Its rules are intended to produce either “proceed” or “skip”. The thresholds are configurable starting values, not experimentally optimized settings.

For example, the code can recognize that too little has changed to justify another assessment. Whether the integrated script actually handles that skip correctly is a separate question, and review found a problem there.

Keep recent assessments and a longer numeric trail

Sending every earlier assessment back to the model would keep expanding the input. The compressor sorts them and retains the last six in state.json. Six is a count, not a fixed time window: more frequent assessments cover less elapsed time.

Older selected numeric fields go to history.csv, with timestamps deduplicated before appending. That archive includes selected prices, spread, scores, regime and alert count. A daily summary keeps score changes, deduplicated developments and alerts; recent assessments retain the written context.

This arrangement keeps selected numbers available without sending the complete history on every assessment. It does not preserve every original source field.

The compressor also accepts older score formats. score_val() uses a number directly or reads the score field from a dictionary. Missing or unsupported values become zero. That lets both shapes pass through, but it can also turn malformed input into an apparently ordinary score. A later analysis would need to distinguish those cases.

A planned skip was reaching the wrapper as a failure

The intended skip return code is 42. In assess.sh, Bash's set -e exits on that nonzero result before the next line can inspect it:

# Shortened example of the current control-flow problem.
set -e
python3 triage.py  # Intended skip returns 42.
status=$?         # Not reached for that return code.

A safe isolated Bash reproduction confirmed this behavior. A skip can consequently look like a failed assessment to the wrapper, rather than the deliberate decision to do no more work. The handler needs explicit conditional control before I could claim that the integrated skip path works as intended.

The wrapper has another issue with its file lock. Cleanup is registered before the existing-lock check. A second process can detect another process's lock, exit, then remove that first process's lock during cleanup. It has no ownership check. JSON files are also written directly to their destination instead of using a temporary file followed by replacement.

These are findings in the reviewed source, not fixes already applied. No original script run, broker order or market-data accuracy test was part of that review. Before relying on the tracker for repeated unattended assessments, I would distinguish skips from failures, remove only the current process's lock and replace state files safely.

Project sources & checks
Private repository

mcl-narrative-tracker, main commit 2708969. Inspected README and full scripts/run-assessment.sh, scripts/assess.sh, scripts/triage.py and scripts/compress-day.py. Private repository URLs and position records are omitted.

Implemented scope

Source supports collection, assessment prompts, triage and memory compression. No original script execution, broker order, market-data accuracy test or profitable outcome was verified. Prompt adherence and optimal triage thresholds were not measured.

Defects in the reviewed source

A safe isolated Bash reproduction confirms that set -e exits on triage code 42 before the intended handler. The wrapper registers its lock cleanup before checking an existing lock. Neither original source defect was changed.

Author’s trial recollection

The author recalls using it experimentally for a few days while following the Iran conflict, with a small positive outcome. No amount or verified P/L record is supplied, and this is not evidence of strategy performance.

On this page
Let the assessment start from calculated valuesKeep recent assessments and a longer numeric trailA planned skip was reaching the wrapper as a failureSources & checks
PythonShellClaude CodeContextMarket research

Connected to this

All writing
MNQ time-series research · Experiment

A time-series model that failed on later data

ctxforge · Project story

ctxforge: turn “add search” into a task an agent can build

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