diff --git a/src/routes/etf/[tickerID]/insider/+page.svelte b/src/routes/etf/[tickerID]/insider/+page.svelte index a21d9681..e7208c5e 100644 --- a/src/routes/etf/[tickerID]/insider/+page.svelte +++ b/src/routes/etf/[tickerID]/insider/+page.svelte @@ -4,6 +4,7 @@ import { getPartyForPoliticians } from "$lib/utils"; import TableHeader from "$lib/components/Table/TableHeader.svelte"; import SEO from "$lib/components/SEO.svelte"; + import Infobox from "$lib/components/Infobox.svelte"; export let data; @@ -420,12 +421,7 @@ {/if} {:else} -

- No trading history available for {$displayCompanyName}. Likely - no corrupt politican has interest in this stock. -

+ {/if} {:else}
diff --git a/src/routes/options-calculator/+page.svelte b/src/routes/options-calculator/+page.svelte index c5d9031a..77367aee 100644 --- a/src/routes/options-calculator/+page.svelte +++ b/src/routes/options-calculator/+page.svelte @@ -14,6 +14,7 @@ export let data; let isLoaded = true; + let shouldUpdate = false; let config = null; let selectedStrategy = "Long Call"; @@ -45,8 +46,7 @@ let inputValue = selectedTicker; let touchedInput = false; - - let strategies = [ + let prebuiltStrategy = [ { name: "Long Call", sentiment: "Bullish", @@ -89,9 +89,12 @@ { name: "Short Straddle", sentiment: "Neutral" }, */ ]; - let description = strategies?.at(0)?.description; - function changeStrategy(strategy) { + let userStrategy = []; + + let description = prebuiltStrategy?.at(0)?.description; + + async function changeStrategy(strategy) { selectedStrategy = strategy?.name; description = strategy?.description; @@ -122,7 +125,7 @@ selectedAction = null; } - config = plotData(); + await loadData("default"); } const payoffFunctions = { @@ -431,6 +434,7 @@ } config = plotData(); + shouldUpdate = true; } function handleOptionPriceInput(event) { @@ -445,6 +449,7 @@ // Set a new debounce timeout (1 second) debounceTimeout = setTimeout(() => { config = plotData(); + shouldUpdate = true; }, 500); } @@ -461,6 +466,7 @@ // Set a new debounce timeout (1 second) debounceTimeout = setTimeout(() => { config = plotData(); + shouldUpdate = true; }, 500); } @@ -515,7 +521,7 @@ selectedOptionPrice = output?.history?.at(-1)?.mark; config = plotData(); - + shouldUpdate = true; isLoaded = true; } @@ -561,6 +567,25 @@ if (debounceTimeout) clearTimeout(debounceTimeout); }); + $: { + if (shouldUpdate) { + shouldUpdate = false; + userStrategy = [ + { + ticker: selectedTicker, + action: selectedAction, + quantity: selectedQuantity, + date: selectedDate, + strike: selectedStrike, + optionType: selectedOptionType, + optionPrice: selectedOptionPrice, + }, + ]; + + console.log(userStrategy); + } + } + $: { if ($mode) { config = plotData(); @@ -601,7 +626,7 @@
- {#each strategies as strategy} + {#each prebuiltStrategy as strategy}
changeStrategy(strategy)} class="{selectedStrategy === strategy?.name @@ -694,227 +719,195 @@ - - - - -
- + + +
+ +
+ {#if inputValue?.length !== 0 && inputValue !== item?.ticker} + + {#each searchBarData as searchItem} + changeTicker(searchItem)} + > +
+ {searchItem?.symbol} + {searchItem?.name} +
+
+ {:else} + + No results found + + {/each} +
+ {/if} +
+ + + + + + + + + + + + + + + + {#each dateList as item} + { + selectedDate = item; + loadData("default"); + }} + class="sm:hover:bg-gray-200 dark:sm:hover:bg-primary cursor-pointer " + > + {formatDate(item)} + + {/each} + + + + + + + + + + + + + + {#each strikeList as item} + { + selectedStrike = item; + loadData("default"); + }} + class="sm:hover:bg-gray-200 dark:sm:hover:bg-primary cursor-pointer " + > + {item} + + {/each} + + + + + + + + + + + + + -
- {#if inputValue?.length !== 0 && inputValue !== selectedTicker} - - {#each searchBarData as item} - changeTicker(item)} - > -
- {item?.symbol} - {item?.name} -
-
- {:else} - - No results found - - {/each} -
- {/if} -
- - - - - - - - - - - - - - - - {#each dateList as item} - { - selectedDate = item; - loadData("default"); - }} - class="sm:hover:bg-gray-200 dark:sm:hover:bg-primary cursor-pointer " - > - {formatDate(item)} - - {/each} - - - - - - - - - - - - - - {#each strikeList as item} - { - selectedStrike = item; - loadData("default"); - }} - class="sm:hover:bg-gray-200 dark:sm:hover:bg-primary cursor-pointer " - > - {item} - - {/each} - - - - - - - - - - - - - - - - - - - + + + + {/each}