{"openapi":"3.1.0","info":{"title":"prosteOKI Monte Carlo API","version":"1.0.0","description":"return = oczekiwany efektywny zwrot roczny. Miesięczny log-zwrot: (ln(1+return)−volatility²/2)/12 + volatility/√12 × Z; Z~N(0,1). Wpłaty na koniec miesiąca. Cel nominalny na końcu okresu. Realne wartości dzielone przez (1+inflation)^years. Percentyle: interpolacja liniowa po (n−1)p."},"servers":[{"url":"https://prosteoki-monte-carlo.marcin-649.workers.dev"}],"paths":{"/api/calculate":{"get":{"operationId":"calculate","summary":"Nowe losowe obliczenie w Workerze; limit 12000 kroków","parameters":[{"name":"initial","in":"query","description":"Kapitał początkowy; PLN","required":false,"schema":{"type":"number","default":100000,"minimum":0,"maximum":100000000},"example":100000},{"name":"monthly","in":"query","description":"Miesięczna wpłata; PLN","required":false,"schema":{"type":"number","default":2000,"minimum":0,"maximum":1000000},"example":2000},{"name":"years","in":"query","description":"Okres inwestycji; lat","required":false,"schema":{"type":"integer","default":5,"minimum":5,"maximum":40},"example":5},{"name":"return","in":"query","description":"Oczekiwany roczny zwrot; ułamek roczny","required":false,"schema":{"type":"number","default":0.07,"minimum":-0.5,"maximum":0.5},"example":0.07},{"name":"volatility","in":"query","description":"Roczna zmienność; ułamek roczny","required":false,"schema":{"type":"number","default":0.18,"minimum":0,"maximum":1},"example":0.18},{"name":"inflation","in":"query","description":"Inflacja roczna; ułamek roczny","required":false,"schema":{"type":"number","default":0.03,"minimum":-0.1,"maximum":0.3},"example":0.03},{"name":"simulations","in":"query","description":"Liczba symulacji; scenariuszy","required":false,"schema":{"type":"integer","default":200,"minimum":20,"maximum":200},"example":200},{"name":"goal","in":"query","description":"Cel na koniec okresu; PLN nominalnie","required":false,"schema":{"type":"number","default":1000000,"minimum":0,"maximum":10000000000},"example":1000000}],"responses":{"200":{"description":"Przykład lokalny, podpis testowy — nie produkcyjny","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["version","calculationId","timestamp","computationMs","simulationsExecuted","parameters","results","resultSignature","resultToken"],"properties":{"version":{"type":"string"},"calculationId":{"type":"string","format":"uuid"},"timestamp":{"type":"string","format":"date-time"},"computationMs":{"type":"number","minimum":0},"simulationsExecuted":{"type":"integer","minimum":20},"parameters":{"type":"object","additionalProperties":false,"required":["initial","monthly","years","return","volatility","inflation","simulations","goal"],"properties":{"initial":{"type":"number","default":100000,"minimum":0,"maximum":100000000,"description":"Kapitał początkowy (PLN)"},"monthly":{"type":"number","default":2000,"minimum":0,"maximum":1000000,"description":"Miesięczna wpłata (PLN)"},"years":{"type":"integer","default":5,"minimum":5,"maximum":40,"description":"Okres inwestycji (lat)"},"return":{"type":"number","default":0.07,"minimum":-0.5,"maximum":0.5,"description":"Oczekiwany roczny zwrot (ułamek roczny)"},"volatility":{"type":"number","default":0.18,"minimum":0,"maximum":1,"description":"Roczna zmienność (ułamek roczny)"},"inflation":{"type":"number","default":0.03,"minimum":-0.1,"maximum":0.3,"description":"Inflacja roczna (ułamek roczny)"},"simulations":{"type":"integer","default":200,"minimum":20,"maximum":200,"description":"Liczba symulacji (scenariuszy)"},"goal":{"type":"number","default":1000000,"minimum":0,"maximum":10000000000,"description":"Cel na koniec okresu (PLN nominalnie)"}}},"results":{"type":"object","additionalProperties":false,"required":["totalContributions","nominal","real","probabilityBelowContributions","probabilityGoal","annual","histogram"],"properties":{"totalContributions":{"type":"number"},"nominal":{"type":"object","additionalProperties":false,"required":["p5","p25","p50","p75","p95"],"properties":{"p5":{"type":"number","minimum":0},"p25":{"type":"number","minimum":0},"p50":{"type":"number","minimum":0},"p75":{"type":"number","minimum":0},"p95":{"type":"number","minimum":0}}},"real":{"type":"object","additionalProperties":false,"required":["p5","p25","p50","p75","p95"],"properties":{"p5":{"type":"number","minimum":0},"p25":{"type":"number","minimum":0},"p50":{"type":"number","minimum":0},"p75":{"type":"number","minimum":0},"p95":{"type":"number","minimum":0}}},"probabilityBelowContributions":{"type":"number","minimum":0,"maximum":1},"probabilityGoal":{"type":"number","minimum":0,"maximum":1},"annual":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["year","nominal","real"],"properties":{"year":{"type":"integer"},"nominal":{"type":"object","additionalProperties":false,"required":["p5","p25","p50","p75","p95"],"properties":{"p5":{"type":"number","minimum":0},"p25":{"type":"number","minimum":0},"p50":{"type":"number","minimum":0},"p75":{"type":"number","minimum":0},"p95":{"type":"number","minimum":0}}},"real":{"type":"object","additionalProperties":false,"required":["p5","p25","p50","p75","p95"],"properties":{"p5":{"type":"number","minimum":0},"p25":{"type":"number","minimum":0},"p50":{"type":"number","minimum":0},"p75":{"type":"number","minimum":0},"p95":{"type":"number","minimum":0}}}}}},"histogram":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["lower","upper","count"],"properties":{"lower":{"type":"number"},"upper":{"type":"number"},"count":{"type":"integer","minimum":0}}}}}},"resultSignature":{"type":"string"},"resultToken":{"type":"string"}}},"example":{"version":"1.0.0","calculationId":"cbb204d5-7dad-4bd5-a1b6-d6aebbc0bf76","timestamp":"2026-11-13T17:15:45.351Z","computationMs":2.698999999999998,"simulationsExecuted":100,"parameters":{"initial":100000,"monthly":2000,"years":5,"return":0.07,"volatility":0.18,"inflation":0.03,"simulations":100,"goal":1000000},"results":{"totalContributions":220000,"nominal":{"p5":152500.52386484595,"p25":205064.74418559158,"p50":259597.30402024876,"p75":319478.29420398327,"p95":485366.06158588664},"real":{"p5":131548.29150900294,"p25":176890.6497019827,"p50":223930.914850313,"p75":275584.7830004243,"p95":418681.0283659309},"probabilityBelowContributions":0.35,"probabilityGoal":0,"annual":[{"year":1,"nominal":{"p5":100082.93406758476,"p25":113376.79564450955,"p50":127560.37318608983,"p75":144751.05356271623,"p95":171127.98952398612},"real":{"p5":97167.89715299492,"p25":110074.55887816461,"p50":123845.02251076682,"p75":140535.0034589478,"p95":166143.67914950108}},{"year":2,"nominal":{"p5":112372.14341885335,"p25":136650.84365123854,"p50":160878.52752922673,"p75":186430.46015269443,"p95":229518.00513076017},"real":{"p5":105921.52268720271,"p25":128806.52620533372,"p50":151643.44191651122,"p75":175728.5890778532,"p95":216342.7327087946}},{"year":3,"nominal":{"p5":128443.77406834453,"p25":164875.9306372456,"p50":192405.16969003045,"p75":225240.8723945386,"p95":294603.38610658905},"real":{"p5":117544.24853448714,"p25":150884.83275076537,"p50":176077.9862582607,"p75":206127.30571729134,"p95":269603.83161264344}},{"year":4,"nominal":{"p5":141755.52507678582,"p25":181999.57424437118,"p50":224532.53488019964,"p75":283202.67768256017,"p95":350807.19387457444},"real":{"p5":125947.94800121183,"p25":161704.26444229358,"p50":199494.249076735,"p75":251621.9110559962,"p95":311687.64807320735}},{"year":5,"nominal":{"p5":152500.52386484595,"p25":205064.74418559158,"p50":259597.30402024876,"p75":319478.29420398327,"p95":485366.06158588664},"real":{"p5":131548.29150900294,"p25":176890.6497019827,"p50":223930.914850313,"p75":275584.7830004243,"p95":418681.0283659309}}],"histogram":[{"lower":131135.75523412426,"upper":152853.7000446234,"count":6},{"lower":152853.7000446234,"upper":174571.64485512255,"count":4},{"lower":174571.64485512255,"upper":196289.58966562172,"count":7},{"lower":196289.58966562172,"upper":218007.53447612087,"count":18},{"lower":218007.53447612087,"upper":239725.47928662002,"count":9},{"lower":239725.47928662002,"upper":261443.4240971192,"count":7},{"lower":261443.4240971192,"upper":283161.36890761834,"count":8},{"lower":283161.36890761834,"upper":304879.3137181175,"count":10},{"lower":304879.3137181175,"upper":326597.2585286166,"count":10},{"lower":326597.2585286166,"upper":348315.2033391158,"count":4},{"lower":348315.2033391158,"upper":370033.1481496149,"count":2},{"lower":370033.1481496149,"upper":391751.0929601141,"count":2},{"lower":391751.0929601141,"upper":413469.0377706133,"count":4},{"lower":413469.0377706133,"upper":435186.9825811124,"count":3},{"lower":435186.9825811124,"upper":456904.92739161156,"count":0},{"lower":456904.92739161156,"upper":478622.8722021107,"count":0},{"lower":478622.8722021107,"upper":500340.81701260986,"count":2},{"lower":500340.81701260986,"upper":522058.761823109,"count":2},{"lower":522058.761823109,"upper":543776.7066336081,"count":1},{"lower":543776.7066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XdbPcsE-tVU2qGnS9w97iZoxfM5W2JuHvVPAjnPzBgsKrLNo5wC24FCEEAA5VSei6K0oCkqWmjeFQ9tyGd5CsORkge1WwQpcXAkKCScUgDYixrVTAvsMTw9YCVubiDMlQXE5ElUpoQDUG1eC0ymK1JIzMY66doYiQy_ssGLg5GKN1PasCVkbbbk0BhOEmavYPDhp9T4oQoQhhLuBB0giYSKK_W_V71b99ulu-Lp-Oe6_4KodbRduvXoeqRBsCUAMR2FlVHc6HMZXxigkRcNWeKa2W_60Ow4P3hTuALdRPb9NBKEYkIYlcfPpM4BOAWbCOgLaXGozB3gbut_s5IwQU4SZsDMCE-Yu2kTj_iCGlVwQqEwg5uI6hNRgSxqV0Up8AFxJ1CnCTFhHgMM384Ox4CKhOl_FTFTPHzc-SZsNsCuTTvxQw0zYGQHDCxNNmJzA8sMWrirkCcJMWAdgb0sAo0K7HXfWfwDchnUABTtL2BQR7HDbrplZmInq-RgwEdx7BdcklKqXfJ7m30b1_ErjJ0BleCjBGufzb6PO-Qob9oqvyIjAYovM8p-J6vn4Ti4Os4c2hPvv2kKZ5t9G9XzDRaWpcoCjQ5prB6YNmAvrCIGLhtvNBhuDi8Y8wG3UOd_apwtuRtg2bp9ci89KOBfWEYBpJbXZZKE838LboJ6Nq6p99mV3EXzTXDtI0_TbqJ7v1u4VfH3gxkFhMsn_9Pb2L_EBssMzDQAA.PzQ0ulmXnxEhk57l_5CyTrEXAn_ptLmdMfp1Y5h710A"}}}},"400":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"404":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"405":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"429":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"500":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"503":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}}}}},"/api/verify":{"get":{"operationId":"verify","summary":"Sprawdź pochodzenie tokenu; nie potwierdza prawdziwości założeń","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","maxLength":12000}}],"responses":{"200":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["authentic","calculationId","parameters","payload"],"properties":{"authentic":{"const":true},"calculationId":{"type":"string"},"parameters":{"type":"object","additionalProperties":false,"required":["initial","monthly","years","return","volatility","inflation","simulations","goal"],"properties":{"initial":{"type":"number","default":100000,"minimum":0,"maximum":100000000,"description":"Kapitał początkowy (PLN)"},"monthly":{"type":"number","default":2000,"minimum":0,"maximum":1000000,"description":"Miesięczna wpłata (PLN)"},"years":{"type":"integer","default":5,"minimum":5,"maximum":40,"description":"Okres inwestycji (lat)"},"return":{"type":"number","default":0.07,"minimum":-0.5,"maximum":0.5,"description":"Oczekiwany roczny zwrot (ułamek roczny)"},"volatility":{"type":"number","default":0.18,"minimum":0,"maximum":1,"description":"Roczna zmienność (ułamek roczny)"},"inflation":{"type":"number","default":0.03,"minimum":-0.1,"maximum":0.3,"description":"Inflacja roczna (ułamek roczny)"},"simulations":{"type":"integer","default":200,"minimum":20,"maximum":200,"description":"Liczba symulacji (scenariuszy)"},"goal":{"type":"number","default":1000000,"minimum":0,"maximum":10000000000,"description":"Cel na koniec okresu (PLN nominalnie)"}}},"payload":{"type":"object"}}}}}},"400":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"404":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"405":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"429":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"500":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"503":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}}}}},"/api/manifest":{"get":{"operationId":"manifest","responses":{"200":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"404":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"405":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"429":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"500":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"503":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}}}}},"/health":{"get":{"operationId":"health","responses":{"200":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["status","version","timestamp"],"properties":{"status":{"const":"ok"},"version":{"type":"string"},"timestamp":{"type":"string"}}}}}},"400":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"404":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"405":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"429":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"500":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"503":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}}}}},"/openapi.json":{"get":{"operationId":"openapi","responses":{"200":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"404":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"405":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"429":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"500":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}},"503":{"description":"Odpowiedź JSON","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"string"}}}}}}}}}},"x-example-query":"https://prosteoki-monte-carlo.marcin-649.workers.dev/api/calculate?initial=100000&monthly=2000&years=5&return=0.07&volatility=0.18&inflation=0.03&simulations=200&goal=1000000"}