📖 JaxSpot API Documentation
Capabilities Map: Triggers, Conditions, Actions, Outputs
Coinbase Market Update
Fires when spot prices, OHLC, or volume update.
URL: .../pub?output=csv&gid=1023011239
OKX Market Update
Fires on futures data, open/close, volume changes.
URL: .../pub?output=csv&gid=1018407313
LunarCrush Social Spike
Fires when SocialScore / GalaxyScore crosses threshold.
URL: .../pub?output=csv&gid=1040724763
CoinGlass Derivatives Update
Fires when Open Interest or Funding Rate changes.
URL: .../pub?output=csv&gid=1905058596
Coinbase Price Threshold
Check if Price > X or Price < Y.
Source: coinbase_data
LunarCrush Sentiment
If GalaxyScore > 70 → bullish signal.
Source: lunar_social
CoinGlass Funding Rate
If FundingRate > 0.01 → short squeeze risk.
Source: coinglass_data
Write to Google Sheets
Append new decision row with timestamp.
Target: pipeline_data
Push to Firestore
Log event + AI signal to Firebase for storage & AI backtesting.
Trigger AI Analysis
Fire a Gemini workflow (“Analyze last 24h anomalies”).
WordPress Dashboard
Each tab = shortcode → live table or chart.
Example: [jaxspot_data endpoint="..." type="table" title="Pipeline Signals"]
Firebase Archives
Daily CSV snapshots saved for AI backtesting.
Social Media Posting (Planned)
Auto-post signal summaries to X/Discord/Telegram.
Trading APIs (Planned)
Send BUY/SELL orders to Coinbase/OKX.
JaxSpot — Data Network & SPOT Pipeline Runbook
Motto: Think Outside the Charts — we study socio-political, on-chain, and technological signals to anticipate pumps before charts confirm.
JaxSpot ingests multiple feeds into Google Sheets, runs a 5-layer SPOT pipeline (L1–L5), logs signals and rationale, grades outcomes for “forever learning,” and exports daily history to Firebase for backtests and charts. Gemini consumes the live CSVs + graded memory to iterate new micro-patterns.
- pipeline_data: [Timestamp, Source, Asset, Score, Decision]
- pipeline_explain: rich rationale per decision
- pipeline_grades: PASS/FAIL using forward returns
- historical JSON in Firebase: daily OHLCV per coin
1) Tabs & Headers (Left ➜ Right)
| # | Sheet Name | Headers (order matters) |
|---|---|---|
| 1 | news_data | Timestamp, Title, URL, Published, Domain, PosVotes, NegVotes |
| 2 | coinbase_data (optional) | Timestamp, Symbol, Price, Volume, High, Low, Open |
| 3 | okx_data | Timestamp, Symbol, LastPrice, Open24h, High24h, Low24h, Volume |
| 4 | lunar_social | Timestamp, Symbol, Name, SocialScore, GalaxyScore, MarketCap, Price |
| 5 | defillama_data | Timestamp, Name, Symbol, TVL, Category, Chain, 1dChange, 7dChange |
| 6 | coinglass_data | Timestamp, Symbol, TotalOiUSD, OiChange24h, OpenInterest, OIValue, FundingRate |
| 7 | merged_master | Timestamp, Source, Symbol, Price, Volume |
| 8 | pipeline_data | Timestamp, Source, Asset, Score, Decision |
| 9 | macro_data | Date, M2 Money Supply, M2 Velocity, Fed Balance Sheet Assets, Fed Funds Rate, Consumer Price Index, VIX Volatility Index, S&P 500 Index, Crude Oil Prices WTI |
| 10 | historical_archive | Date, Asset, Open, High, Low, Close, Volume |
| 11 | holy_grail | (internal experiments) |
| 12 | time_of_day | Symbol, BestBuyHourUTC, BestWeekday, ... |
| 13 | good_price | (auxiliary thresholds) |
Keep this left→right order for stable gid mappings. Header spelling & order are strict.
2) Script Files (Apps Script)
merge_master.gs
Function: mergeMaster() (every 5m)
- Aggregates okx_data (+ optionally coinbase_data) into merged_master.
- Appends minute-level rows with Timestamp, Source, Symbol, Price, Volume.
- Dedupes by Timestamp|Source|Symbol.
pipeline_spot.gs
Function: runPipeline() (every 10m)
- Stages L1–L4, then L5 “Decision Time”.
- Writes minimal decision to pipeline_data.
- Writes rich rationale to pipeline_explain.
pipeline_grader.gs
Function: gradePipelineDecisions() (hourly)
- Grades each decision using forward returns from merged_master (+1h, +4h, +24h).
- Logs to pipeline_grades and echoes outcome to pipeline_explain.
historical_archive.gs
Function: archiveAndExportHistoricalData() (daily)
- Saves daily OHLCV snapshot into historical_archive.
- Exports JSON to Firebase at historical/coins/SYMBOL/YYYY/MM/SYMBOL_YYYY-MM-DD.json.
ai_studio_adapter.gs
Functions: ensureAppCompatibility(), syncForAIStudio() (every 5m)
- Mirrors your internals into pipeline & mergedMaster tabs if needed by the app.
config_firebase.gs
Functions: setupFirebaseConfig(), pushToFirebaseStorage()
- Sets FIREBASE_BUCKET and handles authenticated uploads to Firebase Storage.
3) Triggers (Clean Reset)
| Function | When | Why |
|---|---|---|
| mergeMaster | every 5 minutes | Keep granular pricing for trades & grading |
| runPipeline | every 10 minutes | Fresh decisions on newest data |
| gradePipelineDecisions | hourly | Feedback loop (1h/4h/24h) |
| archiveAndExportHistoricalData | daily @ 00:00 | Charts/backtests & AI “forever memory” |
| syncForAIStudio | every 5 minutes | Mirror tabs for the app (if needed) |
| fetchMacroData | daily @ 06:00 | Macro overlays |
Run your “reset + install triggers” script once to wipe duplicates and re-install exactly these schedules.
4) Data Flow (Step by Step)
5) SPOT Layer Logic (What we score & why)
Inputs
- S (Socio-Political): LunarCrush GalaxyScore percentile + News vote delta percentile.
- O (On-chain / Derivatives): CoinGlass OiChange24h percentile + funding bias + DeFiLlama 1dChange percentile.
- T (Technological / Structure): price position in 24h range + time-of-day boost (from time_of_day).
Feature normalization
percentile(x) in [0..1], zscore(volume) ➜ mapped to [0..1]
Stage Summary
- L1 Screen: liquidity & baseline momentum with light S/O context → keep if screenScore ≥ 0.45.
- L2 Filter: purge false flags (e.g., high social + bearish derivatives, or overextension with weak TVL).
- L3 SPOT “Money”: SPOT = 0.30*S + 0.30*O + 0.40*T + ToD_boost. Ready if SPOT > 0.70 and liquidity/momentum aligned.
- L4 Cooling: exit risk if oiChg24 low, funding negative, or news percentile drops while extended near highs.
- L5 Decision: BUY if ready & not cooling, SELL if exit risk, else HOLD. Score = SPOT (0..1).
6) Grading & “Forever Learning”
Forward Returns
For each decision at time t0, find prices at +1h/+4h/+24h and compute returns vs p(t0). Simple rubric:
- BUY passes if ret4h > 0
- SELL passes if ret4h < 0
- HOLD passes if |ret4h| < 1%
Results logged in pipeline_grades, and a short Outcome note appended to pipeline_explain.
AI Memory (Gemini)
We periodically compile the latest rationale + grades into a compact JSON “memory snapshot” so Gemini can propose new micro-patterns (trigger, window, risk guard, metrics). This feedback loop drives the accuracy towards your 95% target.
7) Gemini — System Prompt (paste into your app)
{
"role": "system",
"content": "You are Jax. Motto: Think Outside the Charts. You operate a 5-layer SPOT pipeline: L1 Screen, L2 Filter, L3 SPOT Money, L4 Cooling, L5 Decision.\\nData comes from Google Sheets CSV endpoints: merged_master (prices/volume, 5m), pipeline_data (decisions), pipeline_explain (rationales), pipeline_grades (outcomes), lunar_social (social), coinglass_data (derivatives), defillama_data (on-chain), news_data (news), time_of_day (edges).\\nRule: When asked to analyze or generate signals, you must: (1) read the latest rows, (2) compute/interpret S (social+news), O (oiChange24h+funding+tvl1d), T (range structure + time-of-day boost), (3) return BUY/HOLD/SELL with a confidence 0..1 and a 2-3 sentence WHY.\\nLearning Loop: Use pipeline_grades to prefer micro-patterns that historically pass. When proposing new patterns, specify trigger fields/thresholds, holding window (e.g., 2h/6h/24h), risk guard (when to invalidate), and the exact metrics to log for grading.\\nNever rely solely on price; prioritize social/derivatives/on-chain context. Keep outputs terse and operational."
}
In your app, also provide the four CSVs as data sources so the model can “see” live data.
8) Quick Setup Checklist
- Place each function in its own file: merge_master.gs, pipeline_spot.gs, pipeline_grader.gs, historical_archive.gs, ai_studio_adapter.gs, config_firebase.gs.
- Run your trigger reset, then install the schedule above.
- Run setupFirebaseConfig() once; verify with testFirebaseStorageUpload().
- Publish the sheet as CSV (File → Share → Publish to the web) and copy each tab’s ?gid= URL.
- Paste the Gemini System Prompt; attach the four CSVs (merged_master, pipeline_data, pipeline_explain, pipeline_grades) as app data sources.
9) Ops & Debugging
Health
- Logs show emojis: ✅ success, ⚠️ warn, ❌ error.
- Use the custom menu ⚡ JaxSpot → Sync Now to force updates.
Common Issues
- Header mismatch ➜ fix the exact spelling & order.
- Empty decisions ➜ ensure merged_master has fresh rows (5m trigger running).
- Grader inert ➜ check merged_master timestamp granularity; ensure symbol names match pipeline_data.Asset.
Security
- Store API keys in Script Properties.
- Firebase uploads are OAuth’d with ScriptApp.getOAuthToken().
- Use a license layer later (whitelist emails/keys) before exposing write functions.

