Skip to content
vp.Ven Petrov
WorkWritingAboutAt a glance
← Projects & notes
Crude-oil narrative trackerProject story · 3 min read

Crude-oil research from global news and market data

I wanted help following global events that could matter for crude oil. The prototype combines news research with calculated market and position values, while keeping recent assessments separate from the longer numeric history.

Ven PetrovLocal prototype

I wanted help following global events and thinking through what they might mean for crude oil. The research question was whether new developments changed the outlook enough to revisit my view, alongside what the market was actually doing.

I used the tracker for a few days while following the Iran conflict and made a small gain. It was a short personal experiment, not a test that established predictive accuracy.

I brought global news research, market data and position values into one assessment, with a separate job for each part. The code fetches prices, and Python calculates P/L, the modeled profit or loss of a position, plus distances and risk/reward. Claude Code receives those numbers and researches the surrounding news and possible implications. Its prompt tells it to use the supplied values when writing the assessment.

What reaches the assessment

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

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

That keeps the arithmetic available to check alongside the news explanation.

A triage script decides whether another assessment is due. It examines elapsed time, price movement, critical flags, new important items and a configured contract-change window. Its configurable rules are intended to produce one of two outcomes: proceed or skip.

Keeping recent context small

Sending every previous assessment back to the model would keep growing its input. The compressor sorts the assessments and retains the last six in state.json.

Keeping a fixed count means those six cover less time when assessments happen more frequently. Older selected numeric fields go into history.csv, with timestamps deduplicated before appending. A daily summary preserves score changes, deduplicated developments and alerts.

The CSV keeps the longer numeric trail: selected prices, spread, scores, regime and alert count. The recent assessments and daily summary carry the written context.

There is also compatibility handling for older score shapes. score_val() accepts a number directly or reads the score field from a dictionary. Missing or unsupported values become zero. That keeps both shapes usable, but zero can also hide malformed data, so it needs to be interpreted with care.

The reviewed execution controls need work

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 skip can consequently look like a failed attempt to the wrapper. It needs explicit conditional handling before the integrated path can be said to skip correctly.

The wrapper's file lock has a separate ownership problem. Cleanup is registered before the existing-lock check, so a second process can exit and remove the first process's lock. JSON writes also go directly to their destination rather than using a temporary file followed by replacement.

The next corrections are specific: distinguish a skip from a failure, remove only the lock owned by the current process and replace JSON files safely. Those execution controls were unfinished in the reviewed version.

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
What reaches the assessmentKeeping recent context smallThe reviewed execution controls need workSources & checks
PythonShellClaude CodeContextMarket research

Connected to this

All writing
MNQ time-series research · Experiment

Time-series prediction experiments

ctxforge · Project story

ctxforge: discovering what to build before coding

Ven PetrovSoftware engineer · Barcelona
GitHub ↗LinkedIn ↗Email ↗

Find a project or a note

17 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.Financial review lab · Project storyExploring a financial report with Python and FastAPII started with one income change, then opened up the same 54-page report: products, regions, cash flow, core adjustments and a dataset whose figures lead back to the source.Crude-oil narrative tracker · Project storyCrude-oil research from global news and market dataI wanted help following global events that could matter for crude oil. The prototype combines news research with calculated market and position values, while keeping recent assessments separate from the longer numeric history.MNQ time-series research · ExperimentTime-series prediction experimentsAn exploration of high-resolution market data: choosing what to acquire, checking its limits, comparing time intervals and testing whether a prediction survived later data and the cost of acting on it.NQ/MNQ backtest engine · Technical noteA missing closing bar left the simulator’s short position openThe strategy reset for a new day while a shared counter still counted yesterday’s short. A small replay shows why closing the position has to happen before clearing its state.Small-cap edge research · Project storyTurning small-cap trading ideas into repeatable researchI asked Claude Code for a fresh research system that could test named price patterns, compare later periods and carry its methodology into new sessions. One candidate shows how features, entry timing and costs fit together.Gadgeon Europe applications · ExperienceConnected-device dashboards and mobile apps at Gadgeon EuropeI worked on Ionic and Angular applications that brought several APIs into dashboards for energy monitoring and connected-device control, with releases and maintenance across multiple client versions.ctxforge · Project storyctxforge: discovering what to build before codingA context discovery framework that asks an LLM to act like a senior engineering interviewer: understand the idea, uncover requirements and agree the scope before an agent starts building.Sociedades Inactivas enquiries · Technical noteSaving an enquiry before trying to send its emailOn the Sociedades Inactivas catalogue, a visitor can ask about a company or send a general enquiry. The form separates saving that request from delivering its notification, including when the visitor retries.Astro local-services website · Project storyA local-services site assembled from city, service and FAQ recordsThe Astro site describes flooring and other local services across different cities. Shared templates check availability, read the matching content and select one FAQ set for both visitors and structured data.3D Spaces website migration · Project storyMoving 3D Spaces to Next.js while its email stayed on the old serverI rebuilt the virtual-tour website with AI coding collaborators, preserving its content and URLs. The cutover also had to protect the mailbox, enquiry flow and existing analytics history.Capture CRM · Project storyConnecting classified listings to contacts in a small CRMA Chrome extension and Next.js dashboard bring classified listings, platform profiles and contact history together. Saving a listing again can add the person who was missing from an earlier import.Product-description comparison bench · ExperimentComparing one model call with separate vision and writing stepsA small product-description tool lets me inspect the visual analysis before the copy is written, change the model used for each step and compare request measurements.Between Us · Project storyBetween Us: why I kept the first take and widened the shotI compared dialogue takes, asked for wider shots and more physical acting, then changed the workflow when its studio limited the scenes I wanted to make.Restaurant-service voice agent · ExperimentDesigning a restaurant-service call around the real offerI worked through a Spanish outbound agent prompt, corrected a free visit to the actual paid service and compared how two drafts handled transfers and bookings.Vapi and Telnyx voice integration · Technical noteThe Vapi agent could speak, but it could not hear me clearlyMy Telnyx number connected to the assistant, but the caller audio was distorted. Three codec tests recovered the connection without fixing that original problem.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