From d7478ce6621946196ab42366c145666d549e04df Mon Sep 17 00:00:00 2001 From: Eric Bell Date: Tue, 20 Oct 2026 13:21:42 -0400 Subject: [PATCH] updated instructions, README and task.toml --- sources/instruction.md | 58 ++++++++----------- .../tasks/trading-activity-summary/README.md | 9 ++- .../tasks/trading-activity-summary/task.toml | 14 ++--- 3 files changed, 39 insertions(+), 42 deletions(-) diff --git a/sources/instruction.md b/sources/instruction.md index 60713cec..493ea381 100644 --- a/sources/instruction.md +++ b/sources/instruction.md @@ -2,43 +2,33 @@ Trading Activity Summary for a User - ### Description (instruction.md) +You are given access to a PostgreSQL database containing trading activity data. Your goal is to generate a JSON report that summarizes trading activity for a specific user over a specified date range. - │ You are given access to a PostgreSQL database that stores trading activity for multiple users and accounts. Using only the tools provided inside the - │ container, your goal is to generate a JSON report that summarizes the trading activity for a specific user (provided via a command‑line argument or - │ environment variable) over a date range (also provided). +The report must be written to /app/report.json and must contain exactly these seven fields: - │ The report must be written to /app/report.json and must contain the following fields: +1. user_id – identifier of the user whose activity is being summarized +2. date_range_start – start date (inclusive) in YYYY-MM-DD format +3. date_range_end – end date (inclusive) in YYYY-MM-DD format +4. total_fills – count of rows in the trades table where event_type = 'fill' and exec_timestamp falls within the date range (inclusive) +5. total_pnl – sum of the net_pnl column for all rows counted in total_fills, including only rows where completed_trade_id is not null (completed trades) +6. symbol_quantities – object mapping each symbol to the net quantity from filled trades in the date range (positive for buys, negative for sells), summed per symbol +7. position_mismatches – array of symbol names where the net trade quantity differs from the net quantity in the positions table for the same user and date range by more than 1 (allowing for rounding) - 1. user_id – the identifier of the user whose activity is being summarized. - 2. date_range_start – the start date (inclusive) of the analysis, in YYYY‑MM‑DD format. - 3. date_range_end – the end date (inclusive) of the analysis, in YYYY‑MM‑DD format. - 4. total_fills – the count of rows in trades where event_type = 'fill' and the exec_timestamp falls within the date range. - 5. total_pnl – the sum of the net_pnl column (numeric) for all rows counted in total_fills. Include only rows where completed_trade_id is not null - (i.e., completed trades). - 6. symbol_quantities – a map (object) where each key is a symbol (e.g., "AAPL") and the value is the net quantity (positive for buys, negative for - sells) that resulted from the filled trades in the date range. Quantities should be summed per symbol. - 7. position_mismatches – an array of symbol names where the net quantity from the trades does not match the net quantity reflected in the positions - table for the same user and date range. A mismatch exists if the absolute difference between the summed trade quantity and the net quantity in - positions is greater than 1 (allowing for rounding). Each entry should be the symbol name. +### Constraints - │ Constraints & Requirements - │ - The report must be valid JSON (use jsonlint‑compatible syntax). - │ - The file must be written exactly to /app/report.json; no other files are permitted for the final artifact. - │ - You may read any tables in the schema, but you may not modify the underlying data (no INSERT/UPDATE/DELETE). - │ - The solution must run offline (the container has no network access). - │ - The task is considered solved when the oracle (solution/solve.sh) exits with status 0, causing the verifier to award a reward of 1. +- The report must be valid JSON parseable by jsonlint +- The file must be written exactly to /app/report.json; no other output files are permitted +- You may read any tables in the schema but may not modify underlying data (no INSERT/UPDATE/DELETE) +- The task runs offline (no network access) +- The task is solved when solution/solve.sh exits with status 0, causing the verifier to award reward of 1 - │ Hints - │ - Use the exec_timestamp column (type timestamp with time zone) to filter by date range. Cast it to date for simple filtering. - │ - The positions table contains net_qty (the net quantity for the position) and account_id; you can join on user_id → account_id to verify totals. - │ - The trades table stores the raw trade data; the completed_trades table can be used to confirm that a trade is “completed”, but the net_pnl is - │ already present in trades. - │ - To compute net quantity per symbol, sum the qty values (positive for BUY, negative for SELL) for all rows that satisfy the event type and date - │ filter. - │ - For the mismatch check, join trades (aggregated per symbol) with positions (filtering on user_id, account_id, and the same date range). Compute the - │ absolute difference and include symbols where it exceeds 1. +### Key definitions - │ Success Criteria - │ The verifier will load report.json, parse it, and compare the computed values against a ground‑truth generated by the oracle. If all fields match, the - │ verifier writes a reward of 1 to /logs/verifier/reward.txt and {"reward": 1} to /logs/verifier/reward.json. \ No newline at end of file +- **Date range filter**: exec_timestamp values are filtered by casting to date and comparing inclusive boundaries +- **Completed trade**: a trade row with completed_trade_id not null +- **Net quantity**: sum of qty values (BUY = positive, SELL = negative) per symbol +- **Position mismatch**: |summed trade qty per symbol − positions.net_qty per symbol| > 1 + +### Success criteria + +The verifier will load /app/report.json, parse it, and compare all fields against a ground-truth generated by the oracle. If all fields match, the verifier writes reward of 1 to /logs/verifier/reward.txt and {"reward": 1} to /logs/verifier/reward.json. \ No newline at end of file diff --git a/triton-sota-toolkit-bb5effd/tasks/trading-activity-summary/README.md b/triton-sota-toolkit-bb5effd/tasks/trading-activity-summary/README.md index e5f0c40f..3c15de01 100644 --- a/triton-sota-toolkit-bb5effd/tasks/trading-activity-summary/README.md +++ b/triton-sota-toolkit-bb5effd/tasks/trading-activity-summary/README.md @@ -3,7 +3,8 @@ ## Task Metadata - **Author:** Author (anonymous@example.invalid) -- **Expert time:** 0 minutes +- **Category:** `Operations` +- **Expert time:** 2 hours - **Agent timeout:** 8 hours - **CPUs:** 2 - **Memory:** 4 GB @@ -12,8 +13,14 @@ See [instruction.md](instruction.md) for the full task instruction. Additional i ## Difficulty explanation +Task requires knowledge of PostgreSQL querying, aggregate functions, and joining multiple tables (trades + positions) with date-range filtering. Agents must correctly compute net quantities, PNL sums, and mismatch detection against position data. The key challenge is avoiding bivalent phrasing in the instruction and implementing correct aggregation logic offline. + ## Solution explanation +Oracle solution exports trades and positions CSVs via psql copy, runs aggregator.py to compute total_fills, total_pnl, symbol_quantities, and position_mismatches (|trade_qty - pos_qty| > 1), then writes /app/report.json. + ## Verification explanation +Verifier (tests/test_outputs.py) loads /app/report.json, parses all 7 fields, and compares against ground-truth generated by oracle solve.sh. Reward 1 only when all fields match exactly. + ## Relevant experience diff --git a/triton-sota-toolkit-bb5effd/tasks/trading-activity-summary/task.toml b/triton-sota-toolkit-bb5effd/tasks/trading-activity-summary/task.toml index 369b7ee8..3f2056c8 100644 --- a/triton-sota-toolkit-bb5effd/tasks/trading-activity-summary/task.toml +++ b/triton-sota-toolkit-bb5effd/tasks/trading-activity-summary/task.toml @@ -1,7 +1,7 @@ # Task metadata and resource configuration. # Full guidance: profiles/terminal-bench-sota/docs/task-anatomy.md -> task.toml section. -artifacts = ["/app/done.txt"] # paths the verifier reads from the agent; must be above the first [section] +artifacts = ["/app/report.json"] # paths the verifier reads from the agent; must be above the first [section] [task] name = "terminal-use-agents/trading-activity-summary" @@ -10,13 +10,13 @@ name = "terminal-use-agents/trading-activity-summary" author_name = "Author" # anonymous default; do not use your legal name author_email = "anonymous@example.invalid" # anonymous default; do not use a personal/work email author_organization = "" # optional; leave blank unless an admin tells you otherwise -difficulty_explanation = "" # why this task is hard for agents and humans -solution_explanation = "" # high-level approach and key insights -verification_explanation = "" # how the tests verify correctness -category = "" # task-domain: Science, Software, ML, Operations, Security, Hardware, or Media -subcategory = "" # finer subdomain within the category +difficulty_explanation = "Task requires knowledge of PostgreSQL querying, aggregate functions, and joining multiple tables (trades + positions) with date-range filtering. Agents must correctly compute net quantities, PNL sums, and mismatch detection against position data. The key challenge is avoiding bivalent phrasing in the instruction and implementing correct aggregation logic offline." +solution_explanation = "Oracle solution exports trades and positions CSVs via psql copy, runs aggregator.py to compute total_fills, total_pnl, symbol_quantities, and position_mismatches (|trade_qty - pos_qty| > 1), then writes /app/report.json." +verification_explanation = "Verifier (tests/test_outputs.py) loads /app/report.json, parses all 7 fields, and compares against ground-truth generated by oracle solve.sh. Reward 1 only when all fields match exactly." +category = "Operations" # task-domain: Science, Software, ML, Operations, Security, Hardware, or Media +subcategory = "debugging" # finer subdomain within the category tags = [] # e.g., ["debugging", "python"] -expert_time_estimate_hours = 0 # best-case hours for a focused domain expert +expert_time_estimate_hours = 2.0 # best-case hours for a focused domain expert relevant_experience = "" # non-identifying experience relevant to building this task [verifier]