Download index.html from PabloRod11/quantlab-probability-research: direct link, hf CLI and curl.
- Browser
- Download file 40.1 kB
-
https://huggingface.co/spaces/PabloRod11/quantlab-probability-research/resolve/main/index.html
- Command line
-
hf download hf://spaces/PabloRod11/quantlab-probability-research/index.html
-
curl -L -o index.html https://huggingface.co/spaces/PabloRod11/quantlab-probability-research/resolve/main/index.html
40.1 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"> | |
| <meta name="theme-color" content="#f5f5f7"><meta name="description" content="Explore price possibilities with simple examples and clear checks. Runs in your browser."> | |
| <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self'; worker-src 'self'; connect-src 'self'; img-src 'self' data:; object-src 'none'; base-uri 'none'; form-action 'none'"> | |
| <title>QuantLab · probability research</title><link rel="stylesheet" href="style.css?v=20261029forecast1"> | |
| <script src="labs.js?v=20261027audit2" defer></script><script src="cache.js?v=20261027audit2" defer></script><script src="scenarios.js" defer></script><script src="provenance.js?v=20261026provenance1" defer></script><script src="forward.js?v=20261029forecast1" defer></script><script src="execution.js?v=20261027audit2" defer></script><script src="market.js?v=20261029forecast1" defer></script><script src="app.js?v=20261029forecast1" defer></script> | |
| <link rel="stylesheet" href="investment.css?v=20261029investment1"> | |
| <script src="investment.js?v=20261029investment1" defer></script><script src="investment-ui.js?v=20261029investment1" defer></script> | |
| </head> | |
| <body> | |
| <a class="skip" href="#results">Skip to results</a> | |
| <header class="masthead"><div class="masthead-inner"><a class="wordmark" href="index.html" aria-label="QuantLab home">QuantLab</a><nav aria-label="Research views"><button class="tab active" data-view="workbench" aria-pressed="true">Price explorer</button><button class="tab" data-view="investment" aria-pressed="false">Investment explorer</button><button class="tab" data-view="mathematics" aria-pressed="false">Number games</button><button class="tab" data-view="distributions" aria-pressed="false">What if?</button><button class="tab" data-view="methods" aria-pressed="false">Help</button></nav></div></header> | |
| <main> | |
| <div class="introduction"><h1>Make sense of chance.</h1><p>Explore three possibilities for the next price.</p></div> | |
| <section id="workbench" class="view"> | |
| <aside class="experiment-tools" aria-label="Price choices"><form id="experiment"> | |
| <div class="experiment-row"><div class="price-picker"><label for="data-source">Choose your prices</label><select id="data-source"><option value="synthetic">Made-up prices</option><option value="market">Stock or ETF snapshot</option><option value="csv">My price file</option></select></div><button id="run" class="primary" type="submit">Show my guess</button></div> | |
| <div id="market-controls" hidden><label for="market-ticker">Stock or ETF ticker</label><select id="market-ticker" name="ticker" autocomplete="off" disabled><option value="AAPL">AAPL · Apple Inc.</option><option value="MSFT">MSFT · Microsoft Corporation</option><option value="NVDA">NVDA · NVIDIA Corporation</option><option value="AMZN">AMZN · Amazon.com, Inc.</option><option value="GOOGL">GOOGL · Alphabet Inc.</option><option value="TSLA">TSLA · Tesla, Inc.</option><option value="SPY">SPY · State Street SPDR S&P 500 ETF Trust</option><option value="QQQ">QQQ · Invesco QQQ Trust</option></select><p class="hint">Dated, adjusted USD prices. The forecast concerns the next recorded close after the snapshot’s final date. This is not a live market forecast. <a href="MARKET-DATA.md">Sources & adjustment details</a></p></div> | |
| <div id="csv-controls" hidden><label for="csv-file">Choose a CSV file · date,close</label><input id="csv-file" type="file" accept=".csv,text/csv"><p class="hint">Use a CSV text file with date and close columns, oldest date first (for example 2026-01-01). It needs 1,064–2,500 prices with the usual checking method, or at least 714 with repeated checks. Maximum file size: 2 MiB. Use prices adjusted for splits and dividends. Missing prices and dates are not filled in.</p></div> | |
| <details class="setup-options" id="setup-options"><summary>Change the example or checking method</summary><div class="settings-grid"><details id="demo-settings"><summary>Change the example</summary> | |
| <label for="observations">Number of made-up prices</label><input id="observations" type="number" min="850" max="2500" step="1" value="1200" required> | |
| <label for="seed">Example number</label><input id="seed" type="number" min="0" max="100000" step="1" value="42" required><p class="hint">The same example number makes the same pretend prices. Change it to try a different story.</p> | |
| </details><details><summary>How we check the guesses</summary><label for="validation-protocol">Checking method</label><select id="validation-protocol" aria-describedby="protocol-help"><option value="strict">Separate practice and check</option><option value="classic">Repeated checks over time</option></select><p class="hint" id="protocol-help">The first method saves the last 200 answers for checking. It needs at least 1,064 prices. The other method checks several periods in order.</p></details><details class="model-list"><summary>Meet the guessing methods</summary><h2>Ways to make a guess</h2><p>Count earlier outcomes, with or without calibration<br>Look for price patterns<br>Watch changing wiggles<br>Learn three outcome chances</p><span class="hint">Each method learns from earlier prices. The checking method decides which later answers are saved to check it.</span></details></div></details> | |
| <p id="setup-note" class="hint" role="status" hidden>Settings changed. Press Show my guess to use them.</p> | |
| </form><details class="session-options"><summary>Saved examples & privacy</summary><details class="benchmark-control"><summary>Try a saved research example</summary><p class="small">See a saved example made with extra Python tools. Opening it does not run those tools.</p><button id="benchmark" class="secondary">Open saved example</button><p class="hint">Made-up prices · 900 price steps.<br>This opens saved results, not a new calculation.</p></details><div class="data-controls"><p id="cache-note" class="hint">This tab remembers up to 3 calculations for 10 minutes so repeats are quicker. Reload to forget them.</p><button id="clear-data" class="secondary" type="button">Clear my results</button></div></details></aside> | |
| <div id="results" tabindex="-1"> | |
| <div class="results-heading"><h2>Three ways it could go.</h2><p>Chances for the next recorded price. Each outcome is uncertain.</p></div><p id="forecast-source" class="forecast-source"></p><div class="stats" id="stats"><div><span>Big fall</span><strong>—</strong></div><div><span>Small fall or no change</span><strong>—</strong></div><div><span>Rise</span><strong>—</strong></div></div><p id="support-warning" class="support-warning" role="status" hidden></p><div id="status" role="status" aria-live="polite">Getting the made-up price example ready…</div> | |
| <p id="plain-explanation" class="small"></p><section id="evaluation-support" class="evaluation-support" aria-labelledby="evaluation-title" hidden><h2 id="evaluation-title">What the check data actually showed.</h2><p id="evaluation-scope" class="small"></p><div class="table-scroll"><table><caption class="sr-only">Evaluation outcome counts, average predicted probabilities and observed rates on identical rows</caption><thead><tr><th scope="col">Outcome</th><th scope="col">Events / checked</th><th scope="col">Average chance</th><th scope="col">Observed rate</th></tr></thead><tbody id="evaluation-outcomes"></tbody></table></div><p id="evaluation-warning" class="support-warning" role="status" hidden></p><p class="hint">Similar averages do not prove calibration or forecast accuracy. These are historical checks, not confidence bounds for the next price.</p></section><section class="validation-panel" aria-labelledby="validation-title"> | |
| <div class="evidence-heading"><h2 id="validation-title">Did the guesses help?</h2><a id="validation-link" href="#check-details" hidden>See the checks</a></div> | |
| <p id="validation-verdict" class="evidence-verdict">Make a guess to see how we checked it.</p> | |
| <details id="check-details" hidden><summary>See how we checked</summary><div id="validation-content" hidden> | |
| <p id="validation-scope" class="small"></p> | |
| <p id="validation-policy" class="small"></p><p id="validation-support-note" class="hint" hidden></p> | |
| <div class="table-scroll"><table id="validation-baseline-table"><caption class="sr-only">Paired comparison against empirical frequency on identical test rows</caption><thead><tr><th scope="col">Baseline</th><th scope="col">Log loss</th><th scope="col">Loss difference</th><th scope="col">95% interval¹</th></tr></thead><tbody id="validation-baselines"></tbody></table></div> | |
| <p id="validation-interval-note" class="hint"></p><p class="hint">Negative differences favor the selected procedure. Intervals spanning zero leave advantage unresolved; they do not establish equality.</p> | |
| <details id="validation-details"><summary>Fold results & event support</summary><p class="small">Counts are observations. Downside counts show temperature / model selection / test. Classic mode shares its calibration block for temperature and selection.</p><div class="table-scroll"><table><caption class="sr-only">Training and evaluation populations by fold</caption><thead><tr><th scope="col">Fold · model</th><th scope="col">Train</th><th scope="col">Temperature</th><th scope="col">Selection</th><th scope="col">Test</th><th scope="col">Test loss</th><th scope="col">Untuned loss</th><th scope="col">Downside counts</th></tr></thead><tbody id="validation-folds"></tbody></table></div><ul id="validation-support" class="evidence-warnings"></ul></details> | |
| <details><summary>Rolling performance & shifts</summary><p id="rolling-description" class="small">Rolling windows · blue selected procedure / gray untuned empirical.</p><div id="rolling-chart" class="chart"></div><div class="table-scroll"><table id="validation-movement-table"><caption class="sr-only">Disjoint early and recent evaluation windows</caption><thead><tr><th scope="col">Window</th><th scope="col">Log loss</th><th scope="col">Untuned loss</th><th scope="col">Brier</th><th scope="col">Untuned Brier</th><th scope="col">Downside events</th><th scope="col">Entropy</th></tr></thead><tbody id="validation-movement"></tbody></table></div><p id="movement-note" class="hint"></p></details> | |
| <details><summary>Interval sensitivity & assumptions</summary><p class="small">¹ Paired moving-block percentile intervals use 400 deterministic resamples. These condition on the existing predictions, omit refitting uncertainty, assume sufficient stationarity, and do not adjust for repeated research or multiple comparisons. Block lengths are sensitivity checks, not independent confirmations.</p><div class="table-scroll"><table><caption class="sr-only">Block-length sensitivity for paired loss differences</caption><thead><tr><th scope="col">Baseline</th><th scope="col">Block length</th><th scope="col">95% interval</th></tr></thead><tbody id="validation-intervals"></tbody></table></div><p id="validation-interpretation" class="small"></p></details> | |
| <details><summary>Validation audit · JSON</summary><pre id="validation-audit"></pre></details> | |
| </div></details></section> | |
| <details><summary>What counts as a big fall?</summary><p class="hint">A big fall is a drop greater than about 1.98%. The exact cutoff is a log return below −0.02. The middle group includes both cutoff boundaries, and a rise means any positive return.</p></details><details class="quality-panel"><summary>Check my prices</summary><p id="quality-summary" class="small">A data-quality summary appears after a run.</p><ul id="quality-warnings"></ul><pre id="quality-audit"></pre></details><details><summary>More about this guess</summary><p class="small" id="volatility-note"></p><p id="forecast-context" class="small"></p></details> | |
| <details class="probability-detail"><summary>See the chances as a chart</summary><div class="charts"><section class="plot"><h2>What could happen next?</h2><p>Each bar shows a chance out of 100. Together they cover every outcome. Rounding may put the total just above or below 100%.</p><div id="probability-chart" class="chart"></div><p id="outcome-summary" class="outcome-summary"></p></section></div></details><details><summary>Explore more charts</summary><div class="charts"><section class="plot"><h2>How the chance of a drop changed</h2><p>Earlier guesses about a drop, checked against later answers.</p><div id="timeline-chart" class="chart"></div></section><section class="plot"><h2>Did the chances match what happened?</h2><p>Closer to the dashed line is better. A few answers cannot tell us much.</p><div id="calibration-chart" class="chart"></div></section><section class="plot"><h2>Which guessing method did better?</h2><p>Guessing errors on check data. Lower is better.</p><div id="score-chart" class="chart"></div></section></div> | |
| </details><details><summary>For curious explorers · technical details</summary><details class="scores"><summary>Compare the exact scores</summary><p id="score-note" class="small">Comparative test scores appear after a run.</p><div class="table-scroll"><table><caption class="sr-only">Candidate test scores</caption><thead><tr><th scope="col">Model</th><th scope="col">Scored rows</th><th scope="col">Log loss</th><th scope="col">Brier</th><th scope="col">Up Brier</th><th scope="col">Downside Brier</th></tr></thead><tbody id="scores-body"></tbody></table></div></details> | |
| <div class="audit-grid"><details><summary>What happened in this run?</summary><pre id="audit">No completed run.</pre></details><details><summary>Extra number checks</summary><pre id="diagnostics">No completed run.</pre></details><details><summary>Saved Python example details</summary><pre id="explanations">Load the precomputed Python benchmark to inspect its tree explanation.</pre></details></div></details> | |
| <button id="download" class="secondary" disabled>Save my results · JSON file</button> | |
| <details class="forward-panel"><summary>Check a saved guess</summary> | |
| <p>Save your results before the next price arrives. Later, open that file here and enter the very next recorded price from the same series.</p> | |
| <p class="hint">New browser results include a frozen guess. The saved Python example does not. Made-up prices are practice only.</p> | |
| <form id="forward-form"> | |
| <label for="forward-file">Your saved results<input id="forward-file" name="file" autocomplete="off" type="file" accept=".json,application/json" required></label> | |
| <div class="input-grid"><label for="forward-date">Next recorded date<input id="forward-date" name="date" autocomplete="off" type="date" required></label><label for="forward-close">Next closing price<input id="forward-close" name="close" autocomplete="off" type="number" min="0" step="any" required></label></div> | |
| <label class="forward-confirm"><input id="forward-next" name="next" autocomplete="off" type="checkbox" required><span>I used the same price series and the very next recorded price.</span></label> | |
| <button id="forward-run" class="secondary">Check this guess</button> | |
| </form> | |
| <p id="forward-status" role="status" aria-live="polite"></p><div id="forward-result" class="calculation-result" aria-live="polite"></div> | |
| <details><summary>Exact check details</summary><p class="hint">Lower log loss is better. The difference is the saved method’s loss minus the simple training-frequency comparison’s loss. A negative difference favors the saved method for this one outcome.</p><pre id="forward-audit"></pre></details> | |
| <button id="forward-download" class="secondary" disabled>Save this check · JSON</button> | |
| <p class="hint">An editable local file cannot prove when it was saved or whether you entered the very next price. One check cannot establish accuracy or an ability to make money. Nothing is uploaded or retrained.</p> | |
| </details> | |
| <p class="hint">These are uncertain guesses for learning, not instructions to buy or sell. We have not shown that they can make money.</p> | |
| </div> | |
| </section> | |
| <section id="investment" class="view" hidden aria-labelledby="investment-title"> | |
| <div class="inv-heading"><div><p class="inv-eyebrow">Investment explorer</p><h2 id="investment-title">Put a number to “what if?”</h2><p>Pick a stock, an amount, and a time. Explore its past or model a possible future.</p></div><span class="inv-badge">Historical snapshots · browser-local calculations</span></div> | |
| <div class="inv-layout"> | |
| <form id="inv-form" class="inv-controls" aria-label="Investment settings"> | |
| <label for="inv-search">Find a stock or ETF</label><input id="inv-search" name="inv-search" autocomplete="off" type="search" placeholder="e.g. AAPL or Apple…" spellcheck="false"> | |
| <label for="inv-ticker">Ticker</label><select id="inv-ticker" name="inv-ticker" autocomplete="off"><option value="__loading__">Loading historical prices…</option></select> | |
| <div id="inv-csv-controls" hidden><label for="inv-csv-ticker">Your ticker label</label><input id="inv-csv-ticker" name="inv-csv-ticker" autocomplete="off" type="text" value="MY CSV" maxlength="30"><label for="inv-csv">Adjusted daily prices · CSV</label><input id="inv-csv" name="inv-csv" autocomplete="off" type="file" accept=".csv,text/csv"><p class="hint">Columns: date and adj_close (or close). USD, oldest first; up to 2,500 rows and 2 MiB. Use prices consistently adjusted for splits and dividends. Future estimation needs at least 61 daily prices. Your file stays in this browser.</p></div> | |
| <label for="inv-amount">Initial investment · USD</label><input id="inv-amount" name="inv-amount" autocomplete="off" type="number" inputmode="decimal" min="0.01" max="1000000000" step="any" value="10000" required> | |
| <label for="inv-mode">Explore</label><select id="inv-mode" name="inv-mode" autocomplete="off"><option value="past">A past investment</option><option value="future">A future scenario</option></select> | |
| <fieldset id="inv-past-controls"><legend>Holding period</legend><label for="inv-start">Start date</label><input id="inv-start" name="inv-start" autocomplete="off" type="date" required><label for="inv-end">End date</label><input id="inv-end" name="inv-end" autocomplete="off" type="date" required><div class="inv-preset" role="group" aria-label="Historical range presets"><button type="button" data-investment-range="1">1 year</button><button type="button" data-investment-range="3">3 years</button><button type="button" data-investment-range="0">All data</button></div><p class="hint">Non-trading dates move inward to the next available start and previous available end. Effective dates appear with the result.</p></fieldset> | |
| <fieldset id="inv-future-controls" hidden><legend>Scenario assumptions</legend><label for="inv-months">How long would you hold?</label><input id="inv-months" name="inv-months" autocomplete="off" type="range" min="1" max="120" step="1" value="12" aria-describedby="inv-duration"><output id="inv-duration" for="inv-months">12 months · 1 year</output><label for="inv-window">Estimate from the last</label><select id="inv-window" name="inv-window" autocomplete="off"><option value="1">1 year of daily prices</option><option value="3" selected>3 years of daily prices</option><option value="5">5 years of daily prices</option></select><label class="inv-check" for="inv-override"><input id="inv-override" name="inv-override" autocomplete="off" type="checkbox">Use my own assumptions</label><div id="inv-overrides" hidden><label for="inv-return">Annual mean return · %</label><input id="inv-return" name="inv-return" autocomplete="off" type="number" min="-95" max="200" step="any" value="8" disabled><label for="inv-vol">Annual volatility · %</label><input id="inv-vol" name="inv-vol" autocomplete="off" type="number" min="0" max="200" step="any" value="20" disabled></div><p class="hint">The past is an estimation input. A constant-return model cannot capture every market outcome.</p></fieldset> | |
| <button class="primary" type="submit">Calculate investment</button><button id="inv-reset" class="inv-reset" type="button">Reset investment settings</button> | |
| </form> | |
| <div class="inv-contents"> | |
| <div class="inv-source-panel"><p id="inv-source">Loading dated historical snapshots…</p><a id="inv-source-link" href="MARKET-DATA.md" target="_blank" rel="noopener noreferrer" hidden>Inspect provider data (opens a new tab)</a><p class="inv-data-warning">Historical data, not live quotes. <a href="MARKET-DATA.md">Data sources & adjustment details</a></p></div> | |
| <p id="inv-status" role="status" aria-live="polite">Preparing the investment explorer…</p> | |
| <div id="inv-results" hidden> | |
| <h3 id="inv-result-title">Investment result</h3><p id="inv-result-note"></p> | |
| <div id="inv-stats" class="inv-stats" aria-label="Investment results"></div> | |
| <div class="inv-chart-heading"><h3 id="inv-chart-title">Investment value</h3><p id="inv-chart-caption"></p></div> | |
| <div id="inv-layers" class="inv-layers" role="group" aria-label="Projection chart layers" hidden><label class="inv-mean-label"><input id="inv-show-mean" name="inv-show-mean" autocomplete="off" type="checkbox" checked>Mean · solid blue</label><label class="inv-median-label"><input id="inv-show-median" name="inv-show-median" autocomplete="off" type="checkbox" checked>Median · dashed purple</label><label><input id="inv-show-band" name="inv-show-band" autocomplete="off" type="checkbox" checked>10th–90th band</label></div> | |
| <div id="inv-main-chart" class="inv-chart" role="img" aria-labelledby="inv-chart-title" aria-describedby="inv-chart-caption inv-readout"></div> | |
| <div class="inv-inspect"><label for="inv-point">Explore chart points · drag, tap, or use arrow keys</label><input id="inv-point" name="inv-point" autocomplete="off" type="range" min="0" max="1" step="1" value="1"><output id="inv-readout" for="inv-point" aria-live="polite"></output></div> | |
| <section id="inv-drawdown-panel" aria-labelledby="inv-drawdown-title"><h3 id="inv-drawdown-title">The falls along the way</h3><p>Percentage below the highest investment value reached so far. The point slider also explores this chart.</p><div id="inv-drawdown-chart" class="inv-chart" role="img" aria-labelledby="inv-drawdown-title" aria-describedby="inv-readout"></div></section> | |
| <details class="inv-details" open><summary>Assumptions behind this result</summary><p id="inv-assumptions"></p></details> | |
| <details><summary>View chart values as a table</summary><div class="table-scroll inv-table-wrap" tabindex="0" role="region" aria-label="Scrollable investment chart values"><table><caption class="sr-only">Exact values represented in the investment charts</caption><thead id="inv-table-head"></thead><tbody id="inv-table-body"></tbody></table></div></details> | |
| <button id="inv-export" class="secondary" type="button" disabled>Save investment result · JSON</button> | |
| </div> | |
| <p class="inv-fine-print">For exploration and learning. Future projections depend on assumptions and do not establish an ability to predict profitable investments. All values use USD and fractional shares.</p> | |
| </div> | |
| </div> | |
| </section> | |
| <section id="mathematics" class="view" hidden><h2>Play with numbers.</h2><p>Try a game or explore a pretend deal. These examples are separate from the price guesses and do not show how to make money.</p><div class="lab-grid"><section class="plot"><h3>What happens when two people choose?</h3><label for="game">Choose a game</label><select id="game"><option value="prisoner">Teamwork trap · prisoner’s dilemma</option><option value="matching">Coin guessing · matching pennies</option></select><div id="game-output" class="calculation-result" aria-live="polite"></div></section><section class="plot"><h3>A price deal and a two-outcome bet</h3><p>A pretend option gives you a right to buy or sell later at an agreed price. The bet example has only two answers: win or lose. It is a math example, not a suggestion to bet.</p><form id="risk-form"><div class="input-grid"><label>Price today<input name="spot" type="number" min="1" step="1" value="100" required></label><label>Agreed deal price<input name="strike" type="number" min="1" step="1" value="100" required></label><label>Time left · years<input name="years" type="number" min="0.01" max="10" step="0.01" value="1" required></label><label>Yearly wiggle size · 0.20 means 20%<input name="vol" type="number" min="0.01" max="3" step="0.01" value="0.2" required></label><label>Chance of winning · 0.55 means 55%<input name="probability" type="number" min="0" max="1" step="0.01" value="0.55" required></label><label>Profit per 1 unit bet · if you win<input name="odds" type="number" min="0.1" max="10" step="0.1" value="1" required></label></div><button class="secondary">Calculate</button></form><div id="risk-output" class="calculation-result" aria-live="polite"></div><details><summary>Rules behind these examples</summary><p class="hint">Black–Scholes assumes a European option, no dividends, constant volatility and a 3% interest rate. The separate Kelly example uses capped quarter-Kelly for a bet with fixed win and loss payoffs. It is not a stock allocation.</p></details></section></div><section class="plot iv-lab"><h3>What wiggle size fits this deal price?</h3><p>An option is a right to buy or sell later at an agreed price. This calculator finds the yearly wiggle size that fits its price, using the Black–Scholes formula. It is separate from the price explorer.</p><form id="iv-form"><div class="input-grid"><label>Price today<input name="spot" type="number" min="0.01" value="100" step="0.01" required></label><label>Agreed deal price<input name="strike" type="number" min="0.01" value="100" step="0.01" required></label><label>Time left · years<input name="years" type="number" min="0.001" max="10" value="1" step="0.001" required></label><label>Yearly interest rate · 0.03 means 3%<input name="rate" type="number" min="-1" max="1" value="0.03" step="0.01" required></label><label>Option price · same units as price today<input name="premium" type="number" min="0" value="9.4134" step="0.0001" required></label><label>Kind of deal<select name="type"><option value="call">Right to buy · call</option><option value="put">Right to sell · put</option></select></label></div><button class="secondary">Find the wiggle size</button></form><div id="iv-output" class="calculation-result" aria-live="polite"></div><details><summary>How the answer was found</summary><pre id="iv-details"></pre></details></section> | |
| <section class="plot cost-lab" aria-labelledby="cost-title"><h3 id="cost-title">Would trading costs change the result?</h3> | |
| <p>Imagine buying, then selling. A price rise can leave you with less than you expected once costs are paid. Try it with pretend money.</p> | |
| <p class="hint">This is a separate math story. It does not use your forecasts or price file. You choose how many trades finish; the app does not predict fills. Results show gains or losses, not your account balance.</p> | |
| <form id="cost-form"><div class="input-grid"><label for="cost-notional">Amount for each pretend trade<input id="cost-notional" name="notional" autocomplete="off" type="number" value="1000" min="0.01" max="1000000000.0" step="any" required></label><label for="cost-attempts">Trades you planned<input id="cost-attempts" name="attempts" autocomplete="off" type="number" value="10" min="1" max="10000" step="1" required></label><label for="cost-completed">Trades that finished both steps<input id="cost-completed" name="completed" autocomplete="off" type="number" value="8" min="0" max="10000" step="1" required></label><label for="cost-movePercent">Price change assumed for every trade · %<input id="cost-movePercent" name="movePercent" autocomplete="off" type="number" value="1" min="-100" max="100" step="any" required></label></div><details><summary>Change the costs</summary><p class="hint">All amounts use the same pretend units. The price gap is charged once per finished trade. Fees and extra price costs are charged twice: once to buy and once to sell. Waiting only makes the price worse in this story. Keep its cost separate from the extra price cost so you do not count the same effect twice. For every percentage here, 0.10 means 0.10%.</p><div class="input-grid"><label for="cost-spreadPercent">Buy–sell price gap · % per full trade<input id="cost-spreadPercent" name="spreadPercent" autocomplete="off" type="number" value="0.1" min="0" max="100" step="any" required></label><label for="cost-feePercent">Fee · % each time you buy or sell<input id="cost-feePercent" name="feePercent" autocomplete="off" type="number" value="0.05" min="0" max="100" step="any" required></label><label for="cost-slippagePercent">Extra price cost · % each time you buy or sell<input id="cost-slippagePercent" name="slippagePercent" autocomplete="off" type="number" value="0.02" min="0" max="100" step="any" required></label><label for="cost-delayPercent">Price lost while waiting · % per full trade<input id="cost-delayPercent" name="delayPercent" autocomplete="off" type="number" value="0.03" min="0" max="100" step="any" required></label></div></details><button class="secondary">See what is left</button></form> | |
| <p id="cost-threshold" class="cost-threshold" aria-live="polite"></p><div id="cost-output" class="calculation-result" role="status" aria-live="polite"></div> | |
| <details><summary>How this story works</summary><p class="hint">Each trade uses the same starting amount. Every finished trade buys and sells once, with the same price change and costs. Unfinished trades are assumed never to fill, so they cost nothing here. All percentages are applied to the starting amount; money is not reinvested. Skipping a losing trade can help. Real orders can fill only partly, and their timing and price can differ.</p><p class="hint">This is arithmetic, not a historical trading test, order-book replay or estimate of future profit. HftBacktest, NautilusTrader and KalshiMarketMaker are not running here.</p><pre id="cost-audit"></pre></details></section></section> | |
| <section id="distributions" class="view" hidden><h2>What if prices took surprise jumps?</h2><p class="scenario-note">Make a pretend world: prices wiggle and sometimes jump. You choose all the settings. This does not learn from your price file or predict real markets.</p><div class="scenario-layout"><form id="jump-form"><h3>Build a pretend year</h3><label>Yearly growth setting · 0.06 is about 6%<input name="mu" type="number" min="-1" max="1" step="0.01" value="0.06" required></label><label>Yearly wiggle size · 0.20 means 20%<input name="sigma" type="number" min="0.01" max="2" step="0.01" value="0.2" required></label><label>Average surprise jumps per year<input name="intensity" type="number" min="0" max="50" step="0.5" value="2" required></label><label>Average jump · log units<input name="jumpMean" type="number" min="-1" max="1" step="0.01" value="-0.08" required></label><label>How much jumps vary · log units<input name="jumpStd" type="number" min="0" max="1" step="0.01" value="0.1" required></label><label>How many price steps ahead?<input name="horizon" type="number" min="1" max="252" step="1" value="21" required></label><label>Drop cutoff · log units<input name="threshold" type="number" min="-2" max="2" step="0.01" value="-0.02" required></label><button class="primary">Show this pretend world</button><p class="hint">This pretend year has 252 equal price steps. For the log inputs, −0.02 is about a 1.98% drop and −0.08 is about a 7.69% drop. The growth setting includes the jumps. Over one year the average price change is exp(growth setting) − 1; 0.06 gives about 6.18%.</p></form><div><div id="jump-status" role="status" aria-live="polite"></div><div class="stats" id="jump-stats"></div><div class="charts"><section class="plot"><h3>Where might the price change land?</h3><p>Taller parts show where changes cluster. The area under a part of the curve gives its chance. Technical name: probability density (PDF).</p><div id="jump-pdf" class="chart"></div></section><section class="plot"><h3>What is the chance of this change or less?</h3><p>Read the blue curve for the world with jumps. Gray is a smooth bell-shaped comparison with the same mean and variance. Technical name: cumulative probability (CDF).</p><div id="jump-cdf" class="chart"></div></section></div><details><summary>Rules and calculation checks</summary><pre id="jump-audit"></pre></details></div></div></section> | |
| <section id="methods" class="view prose" hidden><h2>A quick guide.</h2><p>QuantLab is a learning tool. It makes uncertain guesses about the next price, then checks earlier guesses against answers.</p><h3>Try it in three steps</h3><ol><li>Open <b>Price explorer</b>. Keep <b>Made-up prices</b> selected.</li><li>Press <b>Show my guess</b>. The three numbers show the chances of all three outcomes.</li><li>Read <b>Did the guesses help?</b> A clever method is only useful if it beats a simple comparison.</li></ol><h3>What do the words mean?</h3><p><b>Chance:</b> how often something might happen in many similar situations. A 20% chance means about 20 out of 100, not a promise about one outcome.</p><p><b>Guessing method:</b> a set of rules that learns from earlier prices. Researchers call it a model.</p><p><b>Practice and check:</b> learn from earlier answers, then check on later answers that were kept apart. Looking at the check answers again and again can still make the test unfair.</p><p><b>Made-up prices:</b> a repeatable example, not real market data. Doing well on it does not show that a method works in real markets.</p><h3>Find your way around</h3><p><b>Price explorer</b> makes the three guesses. <b>Number games</b> has separate calculators, including a pretend trading-cost story. <b>What if?</b> lets you invent a world with surprise price jumps. The arrows beside extra details open them when you want to learn more.</p><h3>Your file stays in this browser</h3><p>Your CSV is read here and is not sent to a modeling server. A few recent calculations are kept temporarily in this tab. Use <b>Clear my results</b> or reload to remove the app’s saved data. The browser controls when memory is actually reclaimed.</p><p>These guesses can be wrong. They are not instructions to buy, sell or place a bet. This app has not shown that its guesses can make money.</p><details><summary>More detail · methods, privacy and limits</summary><h3>Data cleaning & privacy</h3><p>CSV parsing is bounded to 2 MiB, 2,500 price rows, 64 columns and 16,384 characters per field. We normalize header case, trim surrounding date/price whitespace and accept an initial byte-order mark. Every change is counted in the report. Duplicate dates, missing values and invalid prices are rejected with row numbers. Large moves, unchanged prices and calendar gaps are flagged and retained. We cannot verify whether prices are adjusted from two columns alone.</p><h3>Temporary caching</h3><p>Identical validated dates, prices, validation approach and model revision can reuse one of up to three fitted runs in this tab for ten minutes from computation. Cache hits are labeled. No uploaded prices or reports are written to localStorage, IndexedDB or a service-worker cache. Reloading or Clear my results removes application-held data; browser and operating-system memory reclamation is outside the app’s control. Public app assets may be cached by your browser or Hugging Face. The saved Python benchmark is fetched with revalidation.</p><h3>Validation contract</h3><p>At close t, returns, momentum, realized volatility and drawdown use only observations through t. Strict mode fits at least 500 training rows, temperatures on 150 later rows, and model choice on another 150 rows. A one-row embargo separates each boundary, followed by a reserved final 200-outcome evaluation. The coefficients, temperatures and model choice remain frozen for the latest forecast; features and EWMA state advance causally. Classic mode uses expanding training, a shared 150-row calibration/selection block and test blocks of up to 200. Repeatedly inspecting a reserved evaluation can still overfit it. This is not a permanently sealed holdout. Never tune using the test charts. Strict mode also lets unadjusted past-outcome counts compete during selection, with no temperature fitted for that candidate.</p><p>The target is the next observed close’s log return. Downside is below −0.02 log return, approximately −1.98% simple return; the middle event includes both boundaries, and the final event is a positive return. Probabilities sum to one.</p><h3>EWMA challenger</h3><p>The ridge mean stays frozen within each fold. Residual variance updates online with a fixed 20-observation half-life, using only outcomes already known before each forecast. Its own target never updates its own variance. The audit records volatility and timing; annualization assumes 252 equal-length observations and is only illustrative for gapped CSVs.</p><h3>Two distinct execution modes</h3><p><b>Browser experiment:</b> empirical frequencies (untuned and temperature-adjusted in strict mode), ridge with Gaussian residual probabilities, EWMA residual-volatility probabilities, and multinomial logistic regression are fitted to the selected data. Synthetic JavaScript draws differ from Python even with the same seed.</p><p><b>Precomputed Python benchmark:</b> a saved 900-observation synthetic run actually fitted scikit-learn, XGBoost and LightGBM, completed three training-only Optuna trials, computed SHAP and recorded MLflow metrics. Loading it does not execute those libraries. Download the full Python/Gradio project to run them locally.</p><h3>When the learning examples may not be enough</h3><p>A note appears when an outcome has fewer than 10 training examples, or when recent price patterns are unusual compared with training. These are simple checks, not a guarantee of reliability. The absence of a note does not prove a guess is safe or accurate.</p><p><a href="FORECAST-STUDY.md">Heavy-tail challenger study and decision</a> · <a href="MODEL-STUDY.md">Earlier model tests and rejected changes</a> · <a href="LEAK-AUDIT.md">Data leakage and overfitting checks</a></p><h3>Implementation limits</h3><p>Classic calibration reuses data for temperatures and model choice. Strict mode separates these stages but cannot prevent repeated human inspection. Financial tails and nonstationarity can invalidate normal residual assumptions. Tiny test samples and sparse reliability bins are especially unreliable. The validation panel shows matched untuned and calibrated empirical baselines, fold populations, support warnings and descriptive paired uncertainty. It shows rolling loss, Brier score, entropy and event counts; it does not implement feature-drift testing or an automatic fallback strategy. The saved Python benchmark predates this panel and does not have row-matched baseline probabilities, so its new comparisons remain unavailable. SHAP explains uncalibrated raw class margins, not causal effects. Close-based information does not imply executable same-close fills. The separate trading-cost story uses chosen assumptions; it is not an economic backtest. No live trading is included.</p><p>TFT, DeepSurv, PPO, calibrated rough-volatility models, SPDE solvers and quantum algorithms remain unimplemented. Qiskit has no defined task here; TensorFlow would duplicate the optional PyTorch backend. The downloadable project records all requested books and access limits; full books were not read.</p><p>The implied-volatility solver and jump-mixture PDF/CDF explorer are independently implemented standard methods inspired by <a href="https://github.com/quantmind/quantflow">Quantflow</a>. No upstream source is copied and the Python package is not installed in this static host.</p><p><a href="METHODS.md">Detailed method & provenance notes</a> · <a href="CACHING.md">Caching design</a> · <a href="SECURITY-REVIEW.md">Data & cache security review</a> · <a href="python-project.zip" download>Full Python source and tests</a></p></details></section> | |
| </main> | |
| <footer><span>QuantLab · explore, ask, check.</span><span>Runs in your browser · free to use</span></footer> | |
| </body></html> | |