fix(options-lab): spot UNADJUSTED pour stock/etf (strikes as-traded) + message quand les filtres vident la chaîne
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2 changed files +9 −0
modified
web/js/options-app.js
+5 −0
@@ -168,6 +168,11 @@ | |||||
| 168 | return dOk && distOk; | 168 | return dOk && distOk; | ||
| 169 | }); | 169 | }); | ||
| 170 | $('#chain-count').textContent = `${visible.length} strikes · ${state.rows.length} contrats`; | 170 | $('#chain-count').textContent = `${visible.length} strikes · ${state.rows.length} contrats`; | ||
| 171 | + if (state.rows.length && !visible.length) { | ||||
| 172 | + showEmpty('Aucun strike ne passe les filtres — élargissez « ± spot » ou « |Δ| max ».'); | ||||
| 173 | + } else if (state.rows.length) { | ||||
| 174 | + $('#chain-empty').hidden = true; | ||||
| 175 | + } | ||||
| 171 | 176 | ||||
| 172 | const posKeys = new Set(state.legs.map(l => `${l.kind}|${l.strike}|${l.expiry}`)); | 177 | const posKeys = new Set(state.legs.map(l => `${l.kind}|${l.strike}|${l.expiry}`)); | ||
| 173 | const cols = [ | 178 | const cols = [ | ||
modified
web/js/options-data.js
+4 −0
@@ -108,6 +108,10 @@ | |||||
| 108 | const params = new URLSearchParams({ | 108 | const params = new URLSearchParams({ | ||
| 109 | timeframe: '1day', order: 'asc', limit: '4000', start, end, | 109 | timeframe: '1day', order: 'asc', limit: '4000', start, end, | ||
| 110 | }); | 110 | }); | ||
| 111 | + // les strikes/primes d'options sont as-traded : il faut le spot NON | ||||
| 112 | + // ajusté des splits/dividendes (sinon AAPL 2015 vaut 23 $ face à des | ||||
| 113 | + // strikes 105/110) | ||||
| 114 | + if (asset === 'stock' || asset === 'etf') params.set('adjustment', 'UNADJUSTED'); | ||||
| 111 | const j = await getJSON(`${API}/v1/bars/${asset}/${encodeURIComponent(ticker)}?${params}`); | 115 | const j = await getJSON(`${API}/v1/bars/${asset}/${encodeURIComponent(ticker)}?${params}`); | ||
| 112 | if (j.data && j.data.length) { | 116 | if (j.data && j.data.length) { | ||
| 113 | assetOf.set(ticker, asset); | 117 | assetOf.set(ticker, asset); | ||
| 114 | 118 | ||||