{"openapi":"3.1.0","info":{"title":"AlphaChest","version":"1.0.0","description":"Historical odds behind trading and investing ideas. Ask in plain English and get a real backtest: odds, sample size, the normal odds to compare against, an exact definition and recent cases. Assets: S&P 500 (SPY), Nasdaq (QQQ), Russell 2000 (IWM), gold (XAU-USD), silver (XAG-USD), Brent oil (OIL-USD), Bitcoin (BTC-USD), Ethereum (ETH-USD), XRP (XRP-USD). Historical results only, not forecasts or advice.","contact":{"name":"AlphaChest","url":"https://www.alphachest.com","email":"hello@alphachest.com"}},"servers":[{"url":"https://api.alphachest.com"}],"paths":{"/api/ask":{"post":{"operationId":"askTheOdds","summary":"Backtest a trading question asked in plain English","description":"Send one question (e.g. \"After the S&P 500 drops 3% in a day, how often is it higher a week later?\"). The answer has: supported, understood (how it was read), answer (the main numbers), link (the same question on alphachest.com: share it), query, result (odds, n = sample size, normal odds, definition, recent cases). If supported is false, reason and suggestions explain what can be asked instead.","parameters":[{"name":"compact","in":"query","required":true,"description":"Always \"1\": shorter answers for chat.","schema":{"type":"string","enum":["1"],"default":"1"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["question"],"properties":{"question":{"type":"string","maxLength":300,"description":"The question in plain English. Name the asset; default is the S&P 500."}}}}}},"responses":{"200":{"description":"The backtest, or why it could not be answered","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"429":{"description":"Too many questions; try later"}}}},"/api/top-setups":{"get":{"operationId":"getTopSetups","summary":"The strongest setups right now","description":"Setups whose odds beat the normal odds by 9+ points over 50+ cases and in both halves of their history, strongest first, with whether each is current (true at the latest close) or in play (waiting on its result).","parameters":[{"name":"symbol","in":"query","required":false,"description":"Only this asset, e.g. SPY or BTC-USD.","schema":{"type":"string"}},{"name":"limit","in":"query","required":true,"description":"How many to return (1-25).","schema":{"type":"integer","minimum":1,"maximum":25,"default":10}}],"responses":{"200":{"description":"The setups","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/assets":{"get":{"operationId":"listAssets","summary":"The assets with full history","responses":{"200":{"description":"Assets","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/fear-greed":{"get":{"operationId":"getFearGreed","summary":"AlphaChest Fear & Greed reading (0-100) for an asset","parameters":[{"name":"symbol","in":"query","required":true,"schema":{"type":"string","default":"SPY"}},{"name":"period","in":"query","required":false,"schema":{"type":"string","enum":["day","week","month","year"],"default":"day"}}],"responses":{"200":{"description":"The reading and its parts","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/trend":{"get":{"operationId":"getTrend","summary":"AlphaChest Trend (uptrend / downtrend, 0-100) for an asset","parameters":[{"name":"symbol","in":"query","required":true,"schema":{"type":"string","default":"SPY"}},{"name":"period","in":"query","required":false,"schema":{"type":"string","enum":["day","week","month","year"],"default":"day"}}],"responses":{"200":{"description":"The trend and its reading","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/api/simulate":{"get":{"operationId":"simulateTrades","summary":"Trade every past day a setup happened with entry, exit, stop, target and risk rules","description":"Take query from an askTheOdds answer. Returns rules (plain words + data), summary (trades, win rate, total return, max drawdown, profit factor, average R, time in the market, buy-and-hold for context), trades (the log) and script (Python).","parameters":[{"name":"query","in":"query","required":true,"schema":{"type":"string","example":"/api/stats/rsi?symbol=SPY&side=below&threshold=30&len=14&horizon=1m"}},{"name":"side","in":"query","schema":{"type":"string","enum":["long","short"],"default":"long"}},{"name":"entry","in":"query","schema":{"type":"string","enum":["close","next_open"],"default":"close"}},{"name":"exit","in":"query","description":"\"setup\" (the setup's own window) or trading days to hold","schema":{"type":"string","default":"setup"}},{"name":"stop_pct","in":"query","schema":{"type":"number"}},{"name":"stop_atr","in":"query","schema":{"type":"number"}},{"name":"target_pct","in":"query","schema":{"type":"number"}},{"name":"target_r","in":"query","schema":{"type":"number"}},{"name":"risk","in":"query","description":"% of equity risked per trade (with a stop)","schema":{"type":"number","default":1}},{"name":"size","in":"query","description":"% of equity per trade without a stop, or auto (the size at which the setup's usual overlap fits)","schema":{"type":"string","default":"auto"}},{"name":"fee","in":"query","schema":{"type":"number","default":0}},{"name":"slip","in":"query","schema":{"type":"number","default":0}},{"name":"equity","in":"query","schema":{"type":"number","default":10000}},{"name":"from","in":"query","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","schema":{"type":"string","format":"date"}},{"name":"overlap","in":"query","schema":{"type":"string","enum":["skip","all"],"default":"skip"}}],"responses":{"200":{"description":"Rules, summary, trade log and script","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}}}}