{"openapi":"3.1.0","info":{"title":"Weather Fi agent API","version":"1.0.0","description":"Trade weather prediction markets and weather futures with virtual sUSDT, as a program. An agent has its own key and its own account, funded and limited by the member who owns it.\n\nSimulation only: every balance, price and payout is virtual sUSDT. Nothing here is real money and nothing can be withdrawn.\n\nMarket prices, contract terms and the model figures in these responses are Weather Fi's own. Weather readings and forecasts are not served here: they come from the Weather Market oracle (https://weathermarket.io), which has its own API and MCP server for agents.\n\nOperating an activity that requires a licence under Korean gambling law without holding one is prohibited by the terms."},"servers":[{"url":"https://weatherfi.io/api/agent/v1"}],"security":[{"agentKey":[]}],"components":{"securitySchemes":{"agentKey":{"type":"http","scheme":"bearer","description":"An agent key (wfa_...) made at https://weatherfi.io/agents."}},"schemas":{"Error":{"type":"object","required":["ok","error"],"properties":{"ok":{"const":false},"error":{"type":"object","required":["code","message","retryable"],"properties":{"code":{"type":"string","enum":["INVALID_REQUEST","UNAUTHENTICATED","KEY_REVOKED","KEY_EXPIRED","READ_ONLY_KEY","PRODUCT_NOT_ALLOWED","NOT_FOUND","MARKET_CLOSED","INSUFFICIENT_BALANCE","NOT_ENOUGH_SHARES","LIMIT_PRICE","ORDER_LIMIT","DAILY_LIMIT","DUPLICATE_IN_PROGRESS","IDEMPOTENCY_MISMATCH","TIMED_OUT","ORDER_REJECTED","RATE_LIMITED","TEMPORARILY_UNAVAILABLE","NOT_ENABLED","INTERNAL"]},"message":{"type":"string"},"retryable":{"type":"boolean"}},"additionalProperties":true}}}}},"paths":{"/":{"get":{"operationId":"discover","summary":"Discovery document","security":[],"responses":{"200":{"description":"The API described as JSON."}}}},"/account":{"get":{"operationId":"getAccount","summary":"Agent account","description":"The agent's balance in virtual sUSDT, its permissions, its per-order limit, and what is left of today's spending limit.","responses":{"200":{"description":"The agent, its balance and its limits.","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"const":true}},"additionalProperties":true}}}},"default":{"description":"Failure: a code, a message and whether a retry can help.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/markets":{"get":{"operationId":"listMarkets","summary":"List prediction markets","description":"Yes/no weather markets. By default the ones open for trading, soonest to close first. Each row has the condition, the YES and NO prices (each share pays 1 sUSDT if right), the closing time and how it settles.","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["open","closed","resolved","all"],"default":"open"}},{"name":"type","in":"query","required":false,"description":"hour: a consensus reading at one UTC hour. station-day: a station's daily high or low. station-period: a week or month extreme. index: an oracle index value. forecast-duel: which forecast model is closer.","schema":{"type":"string","enum":["hour","index","station-day","station-period","forecast-duel"]}},{"name":"city","in":"query","required":false,"description":"City slug, for example new-york.","schema":{"type":"string"}},{"name":"station","in":"query","required":false,"description":"ICAO station code, for example KJFK.","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"Text to find in the question.","schema":{"type":"string"}},{"name":"closesWithinHours","in":"query","required":false,"description":"Only markets closing within this many hours.","schema":{"type":"number"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string","enum":["closing","volume","newest"],"default":"closing"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"offset","in":"query","required":false,"description":"Pass nextOffset from the previous page.","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"{ markets, total, limit, offset, nextOffset }","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"const":true}},"additionalProperties":true}}}},"default":{"description":"Failure: a code, a message and whether a retry can help.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/markets/{id}":{"get":{"operationId":"getMarket","summary":"One market","description":"One market with the market maker's state (LMSR: qYes, qNo, b - enough to price any order locally) and the agent's own position in it.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ market, positions }","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"const":true}},"additionalProperties":true}}}},"default":{"description":"Failure: a code, a message and whether a retry can help.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/futures":{"get":{"operationId":"listFutures","summary":"List futures contracts","description":"Weather index futures (heating, cooling and growing degree days at one station over a week or a month) and the simulated real-asset futures that follow them. A LONG share pays (final value - lo) / (hi - lo) sUSDT, held to 0..1; a SHORT share pays the rest of 1. Each row has the band, the LONG and SHORT prices, the value the price implies and Weather Fi's model figure.","parameters":[{"name":"product","in":"query","required":false,"description":"index: settles on the weather. asset: a commodity price this demo simulates from the weather index; not a market price.","schema":{"type":"string","enum":["index","asset"]}},{"name":"index","in":"query","required":false,"description":"HDD, CDD or GDD, or an asset code such as NGAS.","schema":{"type":"string"}},{"name":"station","in":"query","required":false,"schema":{"type":"string"}},{"name":"city","in":"query","required":false,"schema":{"type":"string"}},{"name":"kind","in":"query","required":false,"schema":{"type":"string","enum":["week","month"]}},{"name":"tradable","in":"query","required":false,"description":"false also lists contracts whose trading has closed.","schema":{"type":"boolean","default":true}}],"responses":{"200":{"description":"{ contracts, total }","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"const":true}},"additionalProperties":true}}}},"default":{"description":"Failure: a code, a message and whether a retry can help.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/futures/{symbol}":{"get":{"operationId":"getContract","summary":"One futures contract","description":"One contract by symbol or id, with the market maker's state, open interest and the agent's own position.","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ contract, openInterest, positions }","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"const":true}},"additionalProperties":true}}}},"default":{"description":"Failure: a code, a message and whether a retry can help.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quote":{"post":{"operationId":"quoteOrder","summary":"Quote an order","description":"What an order would cost or return right now: shares, average price, and the price after it. Nothing is placed. The price moves with every trade, so a quote is not a promise - use limitPrice on the order.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["product","id","side"],"additionalProperties":false,"properties":{"product":{"type":"string","enum":["market","futures"],"description":"market: a yes/no prediction market. futures: a weather index or simulated real-asset futures contract."},"id":{"type":"string","description":"Market id, or a futures contract symbol (for example HDD-KJFK-26W47) or id."},"side":{"type":"string","enum":["YES","NO","LONG","SHORT"],"description":"YES or NO for a market; LONG or SHORT for futures."},"action":{"type":"string","enum":["BUY","SELL"],"default":"BUY","description":"BUY spends sUSDT for shares. SELL returns shares the agent holds to the market maker."},"spend":{"type":"number","minimum":1,"description":"BUY only: sUSDT to spend. The fill buys as many shares as that pays for."},"shares":{"type":"number","exclusiveMinimum":0,"description":"SELL only: how many shares to sell."}}}}}},"responses":{"200":{"description":"{ quote, tradable, quotedAt }","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"const":true}},"additionalProperties":true}}}},"default":{"description":"Failure: a code, a message and whether a retry can help.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/orders":{"get":{"operationId":"listOrders","summary":"Order log","description":"The agent's orders, newest first, filled or refused, each with its fill or the reason it was refused. source says who placed it: key (this API) or autopilot (a strategy the owner switched on for the agent, which trades the same account).","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},{"name":"before","in":"query","required":false,"description":"An order id: list the orders before it.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["filled","rejected","pending"]}}],"responses":{"200":{"description":"{ orders, nextBefore }","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"const":true}},"additionalProperties":true}}}},"default":{"description":"Failure: a code, a message and whether a retry can help.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"placeOrder","summary":"Place an order","description":"Buy or sell against the market maker. Fills at once, in full, or not at all. Send limitPrice to bound the price and clientOrderId to make a retry safe. dryRun checks and quotes without trading.","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Used as clientOrderId when the body has none.","schema":{"type":"string","maxLength":64}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["product","id","side"],"additionalProperties":false,"properties":{"product":{"type":"string","enum":["market","futures"],"description":"market: a yes/no prediction market. futures: a weather index or simulated real-asset futures contract."},"id":{"type":"string","description":"Market id, or a futures contract symbol (for example HDD-KJFK-26W47) or id."},"side":{"type":"string","enum":["YES","NO","LONG","SHORT"],"description":"YES or NO for a market; LONG or SHORT for futures."},"action":{"type":"string","enum":["BUY","SELL"],"default":"BUY","description":"BUY spends sUSDT for shares. SELL returns shares the agent holds to the market maker."},"spend":{"type":"number","minimum":1,"description":"BUY only: sUSDT to spend. The fill buys as many shares as that pays for."},"shares":{"type":"number","exclusiveMinimum":0,"description":"SELL only: how many shares to sell."},"limitPrice":{"type":"number","exclusiveMinimum":0,"exclusiveMaximum":1,"description":"Worst average price per share accepted: a BUY that would average above it, or a SELL below it, is not made. Checked atomically with the fill."},"clientOrderId":{"type":"string","maxLength":64,"pattern":"^[A-Za-z0-9_.:-]{1,64}$","description":"Your own id for this order. The same id is executed at most once; sending it again returns the first result. Use it on every order you might retry."},"dryRun":{"type":"boolean","default":false,"description":"true: run every check and return the quote, but do not trade."}}}}}},"responses":{"200":{"description":"{ order, replayed } - or, with dryRun, { dryRun, wouldFill, checks, quote }","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"const":true}},"additionalProperties":true}}}},"default":{"description":"Failure: a code, a message and whether a retry can help.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/positions":{"get":{"operationId":"listPositions","summary":"Positions","description":"Everything the agent holds in markets and futures, with what each position is worth at the current price, plus balance and equity.","parameters":[{"name":"settled","in":"query","required":false,"description":"true also lists positions that have settled.","schema":{"type":"boolean","default":false}}],"responses":{"200":{"description":"{ balance, positionsValue, equity, positions }","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"const":true}},"additionalProperties":true}}}},"default":{"description":"Failure: a code, a message and whether a retry can help.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}