Instructions
1. Understand the Request
- •Identify the target tickers (e.g., AAPL, TSLA, NVDA, META).
- •Identify the date range (e.g., June-July 2025).
- •Clarify if the user wants adjusted (
auto_adjust: true) or unadjusted (auto_adjust: false) prices. Default to unadjusted prices unless specified. - •Identify any specific output format or destination (e.g., Google Sheet, CSV file, Notion page).
2. Retrieve Historical Data
For each identified ticker:
- •Use the
yahoo-finance-get_historical_stock_pricestool. - •Set
intervalto"1d". - •Set
auto_adjustbased on user preference. - •The API automatically excludes non-trading days.
3. Process and Format Data
- •The required output columns are:
Ticker,Date,Open,High,Low,Close,Volume. - •The
Dateshould be formatted asYYYY-MM-DD. - •Combine data from all tickers into a single list, sorted by Date and then by Ticker.
- •Use the provided
scripts/process_stock_data.pyfor reliable, repeatable data transformation.
4. Output to Specified Destination
If the destination is a Google Sheet:
- •Create a new spreadsheet or identify an existing one using
google_sheet-create_spreadsheetorgoogle_sheet-get_spreadsheet. - •Ensure the target worksheet exists and is correctly named. Use
google_sheet-rename_sheetif needed. - •Write the formatted data to the sheet starting from cell A1. Use
google_sheet-write_to_cells. - •Note the final spreadsheet URL.
If the destination is a Notion Page:
- •Locate the target Notion page using
notion-API-post-search. - •Append a new line with the text
Google Sheet : {url}or the relevant data summary usingnotion-API-append-block. - •If requested, add a comment/note at the top of the page using
notion-API-append-blockwith the exact specified text.
5. Error Handling & Validation
- •If a ticker returns no data for the date range, log a warning and continue with other tickers.
- •Verify the final dataset is not empty before writing to the output destination.
- •If writing to Google Sheets, check the operation was successful.
Key Principles
- •Conciseness: Use scripts for deterministic data processing.
- •Reliability: The financial API handles date filtering; do not manually calculate trading days.
- •Clarity: Confirm data parameters (like
auto_adjust) with the user if ambiguous.