{"openapi":"3.0.0","info":{"version":"1.0.0","title":"Gold Volatility Bunseki API","description":"Goldボラティリティ分析ツールのバックエンドAPI"},"components":{"schemas":{"SyncStatus":{"type":"object","properties":{"lastCandleAt":{"type":"string","example":"2026-03-27T16:00:00Z"},"lastSessionAt":{"type":"string","example":"2026-03-27T00:00:00Z"},"lastEventAt":{"type":"string","example":"2026-03-27T16:00:00Z"},"totalCandles":{"type":"number","example":1250},"syncHealth":{"type":"string","example":"Healthy"}},"required":["lastCandleAt","lastSessionAt","lastEventAt","totalCandles","syncHealth"]},"PriceRecord":{"type":"object","nullable":true,"properties":{"timestamp":{"type":"string","format":"date-time","example":"2026-03-27T16:00:00Z","description":"JST換算済みの価格発生日時"},"open":{"type":"number","example":2280.5,"description":"始値"},"high":{"type":"number","example":2295,"description":"高値"},"low":{"type":"number","example":2275.2,"description":"安値"},"close":{"type":"number","example":2290.1,"description":"終値"}},"required":["timestamp","open","high","low","close"]},"ZigZagPoint":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time","example":"2026-03-27T16:05:00Z","description":"転換点が発生した日時"},"price":{"type":"number","example":2310.5,"description":"転換点の価格"},"type":{"type":"string","enum":["high","low"],"example":"high","description":"頂点の種類 (\"high\": 高値 / \"low\": 安値)"}},"required":["timestamp","price","type"]},"SessionVolatility":{"type":"object","properties":{"id":{"type":"number","example":1,"description":"ID"},"date":{"type":"string","format":"date-time","example":"2026-03-27T00:00:00Z","description":"セッションが発生した日付"},"sessionName":{"type":"string","example":"NY_Open","description":"セッション名 (Tokyo, London, NY_Open, NY_Mid)"},"startTimeJst":{"type":"string","example":"21:30","description":"セッション開始時間"},"endTimeJst":{"type":"string","example":"23:30","description":"セッション終了時間"},"volatilityPoints":{"type":"number","example":125.5,"description":"ボラティリティ($)"},"hasEvent":{"type":"boolean","example":true,"description":"経済指標があったかどうか"},"hasHighImpactEvent":{"type":"boolean","example":true,"description":"重要指標(High)があったかどうか"},"eventsLinked":{"type":"string","example":"CPI,Core CPI","description":"紐づいた指標名"},"exactEventTimeJst":{"type":"string","example":"2026-03-27T21:30:00","description":"実際の指標発表時間"},"condition":{"type":"string","enum":["Small","Mid","Large"],"example":"Large","description":"地合い判定 (Small:小, Mid:中, Large:大)"}},"required":["id","date","sessionName","startTimeJst","endTimeJst","volatilityPoints","hasEvent","hasHighImpactEvent","eventsLinked","condition"]},"ReplayDataResponse":{"type":"object","properties":{"previousEvent":{"allOf":[{"$ref":"#/components/schemas/SessionVolatility"},{"nullable":true}]},"candles":{"type":"array","items":{"$ref":"#/components/schemas/Candle"}},"historicalStats":{"type":"array","items":{"$ref":"#/components/schemas/HistoricalAverage"}}},"required":["previousEvent","candles","historicalStats"]},"Candle":{"type":"object","properties":{"datetimeJst":{"type":"string","format":"date-time","example":"2026-03-27T16:00:00Z"},"open":{"type":"number","example":2300},"high":{"type":"number","example":2305.5},"low":{"type":"number","example":2298.2},"close":{"type":"number","example":2302.1}},"required":["datetimeJst","open","high","low","close"]},"HistoricalAverage":{"type":"object","properties":{"eventName":{"type":"string","example":"CPI"},"condition":{"type":"string","enum":["Large","Mid","Small"],"example":"Large"},"averageVola":{"type":"number","example":127.4,"description":"過去の平均ボラティリティ($)"},"count":{"type":"number","example":12,"description":"集計対象となった回数"}},"required":["eventName","condition","averageVola","count"]},"CommunityThread":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","description":"スレッドID"},"title":{"type":"string","minLength":1,"maxLength":200,"example":"CPI発表前後のXAUUSDの値幅について","description":"スレッドタイトル"},"body":{"type":"string","minLength":1,"maxLength":5000,"example":"前回CPIでは発表直後の初動より…","description":"スレッド本文"},"category":{"type":"string","example":"Market Discussion","description":"カテゴリ"},"replyCount":{"type":"integer","minimum":0,"example":12,"description":"返信数"},"createdAt":{"type":"string","format":"date-time","example":"2026-04-01T12:00:00.000Z","description":"作成日時（ISO 8601）"}},"required":["id","title","body","category","replyCount","createdAt"]},"CreateCommunityThreadInput":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200,"example":"CPI発表前後のXAUUSDの値幅について","description":"スレッドタイトル"},"body":{"type":"string","minLength":1,"maxLength":5000,"example":"前回CPIでは発表直後の初動より…","description":"スレッド本文"},"category":{"type":"string","maxLength":50,"default":"General","example":"Market Discussion","description":"カテゴリ"}},"required":["title","body"]},"CommunityThreadDetail":{"type":"object","properties":{"thread":{"$ref":"#/components/schemas/CommunityThread"},"replies":{"type":"array","items":{"$ref":"#/components/schemas/CommunityReply"}}},"required":["thread","replies"]},"CommunityReply":{"type":"object","properties":{"id":{"type":"string","format":"uuid","example":"b1b2c3d4-e5f6-7890-abcd-ef1234567890","description":"返信ID"},"threadId":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","description":"スレッドID"},"body":{"type":"string","minLength":1,"maxLength":5000,"example":"発表直後よりNY後半の戻りを重視しています。","description":"返信本文"},"createdAt":{"type":"string","format":"date-time","example":"2026-04-01T12:30:00.000Z","description":"作成日時（ISO 8601）"}},"required":["id","threadId","body","createdAt"]},"CreateCommunityReplyInput":{"type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":5000,"example":"発表直後よりNY後半の戻りを重視しています。","description":"返信本文"}},"required":["body"]}},"parameters":{}},"paths":{"/health":{"get":{"responses":{"200":{"description":"APIの動作状況を返します","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","example":"ok"}},"required":["status"]}}}}}}},"/api/v1/sync/status":{"get":{"responses":{"200":{"description":"現在のデータ同期状況を取得します","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncStatus"}}}}}}},"/api/v1/sync/data":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"nullable":true}},"sessions":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"sessionName":{"type":"string"},"startTimeJst":{"type":"string"},"endTimeJst":{"type":"string"},"highPrice":{"type":"number"},"lowPrice":{"type":"number"},"volatilityPoints":{"type":"number"},"hasEvent":{"type":"boolean"},"hasHighImpactEvent":{"type":"boolean"},"eventsLinked":{"type":"string"}},"required":["date","sessionName","startTimeJst","endTimeJst","volatilityPoints","hasEvent","hasHighImpactEvent","eventsLinked"]}},"candles":{"type":"array","items":{"nullable":true}},"prices":{"type":"array","items":{"type":"object","properties":{"timestamp":{"type":"string"},"open":{"type":"number"},"high":{"type":"number"},"low":{"type":"number"},"close":{"type":"number"}},"required":["timestamp","open","high","low","close"]}},"thresholds":{"type":"array","items":{"type":"object","properties":{"sessionName":{"type":"string"},"smallThreshold":{"type":"number"},"largeThreshold":{"type":"number"}},"required":["sessionName","smallThreshold","largeThreshold"]}},"zigzagPoints":{"type":"array","items":{"type":"object","properties":{"timestamp":{"type":"string"},"price":{"type":"number"},"type":{"type":"string"}},"required":["timestamp","price","type"]}}}}}}},"responses":{"200":{"description":"差分同期成功","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"500":{"description":"同期失敗"}}}},"/api/v1/sync/seed":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"nullable":true}},"sessions":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"sessionName":{"type":"string"},"startTimeJst":{"type":"string"},"endTimeJst":{"type":"string"},"highPrice":{"type":"number"},"lowPrice":{"type":"number"},"volatilityPoints":{"type":"number"},"hasEvent":{"type":"boolean"},"hasHighImpactEvent":{"type":"boolean"},"eventsLinked":{"type":"string"}},"required":["date","sessionName","startTimeJst","endTimeJst","volatilityPoints","hasEvent","hasHighImpactEvent","eventsLinked"]}},"candles":{"type":"array","items":{"nullable":true}},"prices":{"type":"array","items":{"type":"object","properties":{"timestamp":{"type":"string"},"open":{"type":"number"},"high":{"type":"number"},"low":{"type":"number"},"close":{"type":"number"}},"required":["timestamp","open","high","low","close"]}},"thresholds":{"type":"array","items":{"type":"object","properties":{"sessionName":{"type":"string"},"smallThreshold":{"type":"number"},"largeThreshold":{"type":"number"}},"required":["sessionName","smallThreshold","largeThreshold"]}},"zigzagPoints":{"type":"array","items":{"type":"object","properties":{"timestamp":{"type":"string"},"price":{"type":"number"},"type":{"type":"string"}},"required":["timestamp","price","type"]}}}}}}},"responses":{"200":{"description":"シードデータ保存成功","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success","message"]}}}},"500":{"description":"シード失敗"}}}},"/api/v1/prices/latest":{"get":{"responses":{"200":{"description":"最新の価格情報を取得します","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriceRecord"}}}}}}},"/api/v1/zigzag/calculate":{"get":{"responses":{"200":{"description":"ZigZag計算を実行し、転換点を返します","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"points":{"type":"array","items":{"$ref":"#/components/schemas/ZigZagPoint"}}},"required":["message","points"]}}}},"500":{"description":"サーバー内部エラー"}}}},"/api/v1/market/indicators":{"get":{"responses":{"200":{"description":"直近の経済指標名の一覧を取得します","content":{"application/json":{"schema":{"type":"object","properties":{"indicators":{"type":"array","items":{"type":"string","example":"[USD] CPI"}}},"required":["indicators"]}}}},"500":{"description":"サーバー内部エラー"}}}},"/api/v1/market/sessions":{"get":{"parameters":[{"schema":{"type":"string","default":"10","example":"10","description":"取得する件数"},"required":false,"description":"取得する件数","name":"limit","in":"query"}],"responses":{"200":{"description":"直近のセッション別ボラティリティ情報を取得します","content":{"application/json":{"schema":{"type":"object","properties":{"sessions":{"type":"array","items":{"$ref":"#/components/schemas/SessionVolatility"}},"currentCondition":{"type":"string","example":"Large"}},"required":["sessions","currentCondition"]}}}},"500":{"description":"サーバー内部エラー"}}}},"/api/v1/market/replay":{"get":{"parameters":[{"schema":{"type":"string","example":"ISM製造業PMI"},"required":true,"name":"event","in":"query"}],"responses":{"200":{"description":"指定した指標の前回チャートと統計データを取得します","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplayDataResponse"}}}},"400":{"description":"引数不正"},"500":{"description":"サーバー内部エラー"}}}},"/api/v1/community/threads":{"get":{"responses":{"200":{"description":"掲示板スレッド一覧を新しい順で取得します","content":{"application/json":{"schema":{"type":"object","properties":{"threads":{"type":"array","items":{"$ref":"#/components/schemas/CommunityThread"}}},"required":["threads"]}}}},"500":{"description":"サーバー内部エラー"}}},"post":{"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCommunityThreadInput"}}}},"responses":{"201":{"description":"掲示板スレッドを作成して返します","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunityThread"}}}},"400":{"description":"バリデーションエラー"},"500":{"description":"サーバー内部エラー"}}}},"/api/v1/community/threads/{threadId}":{"get":{"parameters":[{"schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","description":"スレッドID"},"required":true,"description":"スレッドID","name":"threadId","in":"path"}],"responses":{"200":{"description":"掲示板スレッド詳細と返信一覧を取得します","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunityThreadDetail"}}}},"404":{"description":"スレッドが見つかりません"},"500":{"description":"サーバー内部エラー"}}}},"/api/v1/community/threads/{threadId}/replies":{"post":{"parameters":[{"schema":{"type":"string","format":"uuid","example":"a1b2c3d4-e5f6-7890-abcd-ef1234567890","description":"スレッドID"},"required":true,"description":"スレッドID","name":"threadId","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCommunityReplyInput"}}}},"responses":{"201":{"description":"掲示板返信を作成して返します","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommunityReply"}}}},"400":{"description":"バリデーションエラー"},"404":{"description":"スレッドが見つかりません"},"500":{"description":"サーバー内部エラー"}}}}}}