// DalalAI — Excel Power Query (M) connector // ========================================= // Pulls a DalalAI Developer API endpoint into an Excel table, with the // X-API-Key sent as an HTTP header (which =WEBSERVICE() cannot do). // // SETUP (one time): // 1. Excel ▸ Data ▸ Get Data ▸ From Other Sources ▸ Blank Query. // 2. Home ▸ Advanced Editor — paste this whole query, click Done. // 3. First run: Excel asks how to connect → choose "Anonymous" // (the key travels in the header below, not in the URL). // 4. Edit the two parameters at the top: ApiKey and Endpoint. // 5. Close & Load → the data lands as a refreshable table. // Right-click the table ▸ Refresh to pull the latest numbers. // // Endpoints: any /api/v1/{endpoint} listed at https://dalalai.com/api-docs // (e.g. convergence, convergence-scores, predictions, smart-money, regime). let // ── Edit these two ─────────────────────────────────────────────── ApiKey = "PASTE_YOUR_DALALAI_API_KEY_HERE", Endpoint = "convergence", // Optional filters (leave "" to ignore): Symbol = "", Fields = "", // ───────────────────────────────────────────────────────────────── BaseUrl = "https://dalalai.com/api/v1/" & Endpoint, QueryRecord = Record.RemoveFields( [ format = "csv", symbol = Symbol, fields = Fields ], {}, MissingField.Ignore ), // Drop empty optional params CleanQuery = Record.SelectFields( QueryRecord, List.Select(Record.FieldNames(QueryRecord), each Record.Field(QueryRecord, _) <> "") ), Response = Web.Contents(BaseUrl, [ Query = CleanQuery, Headers = [ #"X-API-Key" = ApiKey, #"Accept" = "text/csv" ] ]), Csv = Csv.Document(Response, [ Delimiter = ",", Encoding = 65001, QuoteStyle = QuoteStyle.Csv ]), Promoted = Table.PromoteHeaders(Csv, [ PromoteAllScalars = true ]) in Promoted