### Task Title Trading Activity Summary for a User ### Description (instruction.md) │ 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 the following fields: 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 & 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. │ 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. │ 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.