general: fixes

This commit is contained in:
k
2024-10-21 14:36:02 +02:00
parent 5b9d599e83
commit 7114c3bdf9
14 changed files with 344 additions and 456 deletions
+3
View File
@@ -48,3 +48,6 @@ snapshots*/
# Docker
docker/kibo
# Types
website/scripts/types/paths.d.ts
+1 -1
View File
@@ -43,7 +43,7 @@
- Added handling of SIGINT and SIGTERM terminal signals which menas you can now safely CTRL+C or kill the parser while it's exporting
- Added config print at the start of the program
- Compressed `empty_address_data` struct to save space (should shave of between up to 50% of the `address_index_to_empty_address_data` database)
- Doubled the number of `txid_to_tx_data` databases from 4096 to 8192
- ~Doubled the number of `txid_to_tx_data` databases from 4096 to 8192~ If you ran with this you need to delete that database
- Added `--recompute_computed true` argument, to allow recomputation of computed datasets in case of a bug
- Fixed not saved arguments, not being processed properly
- Fixed bug in `generic_map.multi_insert_simple_average`
+1 -1
View File
@@ -114,7 +114,7 @@ impl TxidToTxData {
}
fn db_index(txid: &Txid) -> u16 {
((txid[0] as u16) << 5) + ((txid[1] as u16) >> 3)
((txid[0] as u16) << 4) + ((txid[1] as u16) >> 4)
}
}
+1 -1
View File
@@ -144,7 +144,7 @@ pub fn update_reponse_headers(
let headers = response.headers_mut();
let max_age = cache_time;
let stale_while_revalidate = 2 * max_age;
let stale_while_revalidate = max_age;
headers.insert_cors();
headers.insert_cache_control_revalidate(max_age, stale_while_revalidate);
+1 -1
View File
@@ -102,7 +102,7 @@ fn path_to_response(headers: HeaderMap, path: &Path) -> Response {
{
headers.insert_cache_control_immutable();
} else {
headers.insert_cache_control_revalidate(10, 50);
headers.insert_cache_control_revalidate(1, 1);
}
}
+147 -305
View File
@@ -489,7 +489,7 @@
header {
flex-shrink: 0;
display: flex;
padding-top: 0.25rem /* 4px */;
white-space: nowrap;
overflow-x: auto;
padding-bottom: 1.5rem;
@@ -499,6 +499,10 @@
padding-right: 1.5rem;
margin-right: -1.5rem;
@media (min-width: 768px) {
padding-top: 0.25rem /* 4px */;
}
& > * {
flex: 1;
}
@@ -579,6 +583,13 @@
}
}
> a {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
> span.emoji {
filter: grayscale(100%) brightness(66%) opacity(66%);
}
@@ -630,10 +641,6 @@
> *:not(input) + * {
margin-top: -0.5rem /* -8px */;
}
.list & {
color: var(--color);
}
}
&:has(input:checked) {
@@ -849,6 +856,12 @@
}
}
@media (min-width: 768px) {
.md\:hidden {
display: none !important;
}
}
/*
* ---
*/
@@ -891,7 +904,7 @@
> details > summary {
&,
* {
color: var(--color) !important;
color: var(--color);
}
}
@@ -906,55 +919,18 @@
}
}
&:hover {
&::before,
> details > summary > span.marker {
border-color: var(--orange) !important;
z-index: 20;
}
> details:not([open]) > summary > span.marker {
background-color: var(--orange) !important;
}
}
&:has(*[data-highlight]) {
> details > summary::after {
color: var(--color) !important;
border-color: var(--color) !important;
}
}
&:has(*:hover) {
> details > summary {
&,
* {
color: var(--orange) !important;
}
&:not(:hover)::after {
border-color: var(--orange) !important;
}
}
}
&:has(~ *[data-highlight]) {
border-color: var(--color) !important;
}
&:has(~ *:hover) {
border-color: var(--orange) !important;
}
&:has(~ *[data-highlight]),
&:has(~ *:hover) {
&::before {
z-index: -10 !important;
}
}
&:has(*:hover)::before {
z-index: 10 !important;
&:has(~ *[data-highlight])::before {
z-index: -10 !important;
}
> details > summary {
@@ -1209,187 +1185,6 @@
display: none;
}
}
@media (min-width: 768px) {
.md\:hidden {
display: none !important;
}
}
</style>
<!-- Flex Masonry -->
<style>
.flexmasonry {
display: flex;
flex-flow: column wrap;
align-content: space-between;
}
.flexmasonry-item {
width: 100%;
.flexmasonry-cols-2 & {
width: 50%;
&:nth-child(2n + 1) {
order: 1;
}
&:nth-child(2n) {
order: 2;
}
}
.flexmasonry-cols-3 & {
width: 33.333%;
&:nth-child(3n + 1) {
order: 1;
}
&:nth-child(3n + 2) {
order: 2;
}
&:nth-child(3n) {
order: 3;
}
}
.flexmasonry-cols-4 & {
width: 25%;
&:nth-child(4n + 1) {
order: 1;
}
&:nth-child(4n + 2) {
order: 2;
}
&:nth-child(4n + 3) {
order: 3;
}
&:nth-child(4n) {
order: 4;
}
}
.flexmasonry-cols-5 & {
width: 20%;
&:nth-child(5n + 1) {
order: 1;
}
&:nth-child(5n + 2) {
order: 2;
}
&:nth-child(5n + 3) {
order: 3;
}
&:nth-child(5n + 4) {
order: 4;
}
&:nth-child(5n) {
order: 5;
}
}
.flexmasonry-cols-6 & {
width: 16.666%;
&:nth-child(6n + 1) {
order: 1;
}
&:nth-child(6n + 2) {
order: 2;
}
&:nth-child(6n + 3) {
order: 3;
}
&:nth-child(6n + 4) {
order: 4;
}
&:nth-child(6n + 5) {
order: 5;
}
&:nth-child(6n) {
order: 6;
}
}
.flexmasonry-cols-7 & {
width: 14.285%;
&:nth-child(7n + 1) {
order: 1;
}
&:nth-child(7n + 2) {
order: 2;
}
&:nth-child(7n + 3) {
order: 3;
}
&:nth-child(7n + 4) {
order: 4;
}
&:nth-child(7n + 5) {
order: 5;
}
&:nth-child(7n + 6) {
order: 6;
}
&:nth-child(7n) {
order: 7;
}
}
.flexmasonry-cols-8 & {
width: 12.5%;
&:nth-child(8n + 1) {
order: 1;
}
&:nth-child(8n + 2) {
order: 2;
}
&:nth-child(8n + 3) {
order: 3;
}
&:nth-child(8n + 4) {
order: 4;
}
&:nth-child(8n + 5) {
order: 5;
}
&:nth-child(8n + 6) {
order: 6;
}
&:nth-child(8n + 7) {
order: 7;
}
&:nth-child(8n) {
order: 8;
}
}
}
.flexmasonry-break {
content: "";
flex-basis: 100%;
width: 0 !important;
margin: 0;
}
.flexmasonry-break-1 {
order: 1;
}
.flexmasonry-break-2 {
order: 2;
}
.flexmasonry-break-3 {
order: 3;
}
.flexmasonry-break-4 {
order: 4;
}
.flexmasonry-break-5 {
order: 5;
}
.flexmasonry-break-6 {
order: 6;
}
.flexmasonry-break-7 {
order: 7;
}
</style>
<!-- ------- -->
@@ -2188,90 +1983,137 @@
<div class="shadow-top"></div>
<div class="shadow-bottom"></div>
</div>
<hr />
<div id="timescale">
<button id="button-backward">
<svg viewBox="0 0 20 20">
<path
d="M7.712 4.818A1.5 1.5 0 0 1 10 6.095v2.972c.104-.13.234-.248.389-.343l6.323-3.906A1.5 1.5 0 0 1 19 6.095v7.81a1.5 1.5 0 0 1-2.288 1.276l-6.323-3.905a1.505 1.505 0 0 1-.389-.344v2.973a1.5 1.5 0 0 1-2.288 1.276l-6.323-3.905a1.5 1.5 0 0 1 0-2.552l6.323-3.906Z"
id="button-backward-icon"
/>
<path
hidden
d="M5.75 3a.75.75 0 0 0-.75.75v12.5c0 .414.336.75.75.75h1.5a.75.75 0 0 0 .75-.75V3.75A.75.75 0 0 0 7.25 3h-1.5ZM12.75 3a.75.75 0 0 0-.75.75v12.5c0 .414.336.75.75.75h1.5a.75.75 0 0 0 .75-.75V3.75a.75.75 0 0 0-.75-.75h-1.5Z"
id="button-backward-pause-icon"
/>
</svg>
</button>
<div>
<!-- <div>
<div class="shadow-left"></div>
<div class="shadow-right"></div>
<div id="timescale-date-buttons" hidden>
<button data-all-time>All time</button>
<button data-days="7">1 Week</button>
<button data-days="30">1 Month</button>
<button data-days="90">3 Months</button>
<button data-days="180">6 Months</button>
<button data-year-to-date>Year To Date</button>
<button data-days="365">1 Year</button>
<button data-days="730">2 Years</button>
<button data-days="1095">3 Years</button>
<button data-days="1460">4 Years</button>
<button data-days="2190">6 Years</button>
<button data-days="2920">8 Years</button>
<button data-year="2024">2024</button>
<button data-year="2023">2023</button>
<button data-year="2022">2022</button>
<button data-year="2021">2021</button>
<button data-year="2020">2020</button>
<button data-year="2019">2019</button>
<button data-year="2018">2018</button>
<button data-year="2017">2017</button>
<button data-year="2016">2016</button>
<button data-year="2015">2015</button>
<button data-year="2014">2014</button>
<button data-year="2013">2013</button>
<button data-year="2012">2012</button>
<button data-year="2011">2011</button>
<button data-year="2010">2010</button>
<button data-year="2009">2009</button>
</div>
<div id="timescale-height-buttons" hidden>
<button data-to="900k">≤900k</button>
<button data-to="850k">≤850k</button>
<button data-to="800k">≤800k</button>
<button data-to="750k">≤750k</button>
<button data-to="700k">≤700k</button>
<button data-to="650k">≤650k</button>
<button data-to="600k">≤600k</button>
<button data-to="550k">≤550k</button>
<button data-to="500k">≤500k</button>
<button data-to="450k">≤450k</button>
<button data-to="400k">≤400k</button>
<button data-to="350k">≤350k</button>
<button data-to="300k">≤300k</button>
<button data-to="250k">≤250k</button>
<button data-to="200k">≤200k</button>
<button data-to="150k">≤150k</button>
<button data-to="100k">≤100k</button>
<button data-to="50k">≤50k</button>
</div>
<div class="shadow-right"></div> -->
<div id="timescale-date-buttons" hidden>
<button data-all-time>All time</button>
<button data-days="7">1 Week</button>
<button data-days="30">1 Month</button>
<button data-days="90">3 Months</button>
<button data-days="180">6 Months</button>
<button data-year-to-date>Year To Date</button>
<button data-days="365">1 Year</button>
<button data-days="730">2 Years</button>
<button data-days="1095">3 Years</button>
<button data-days="1460">4 Years</button>
<button data-days="2190">6 Years</button>
<button data-days="2920">8 Years</button>
<button data-year="2024">2024</button>
<button data-year="2023">2023</button>
<button data-year="2022">2022</button>
<button data-year="2021">2021</button>
<button data-year="2020">2020</button>
<button data-year="2019">2019</button>
<button data-year="2018">2018</button>
<button data-year="2017">2017</button>
<button data-year="2016">2016</button>
<button data-year="2015">2015</button>
<button data-year="2014">2014</button>
<button data-year="2013">2013</button>
<button data-year="2012">2012</button>
<button data-year="2011">2011</button>
<button data-year="2010">2010</button>
<button data-year="2009">2009</button>
</div>
<button id="button-forward">
<svg viewBox="0 0 20 20">
<path
d="M3.288 4.818A1.5 1.5 0 0 0 1 6.095v7.81a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905c.155-.096.285-.213.389-.344v2.973a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905a1.5 1.5 0 0 0 0-2.552l-6.323-3.906A1.5 1.5 0 0 0 10 6.095v2.972a1.506 1.506 0 0 0-.389-.343L3.288 4.818Z"
id="button-forward-icon"
/>
<path
hidden
d="M5.75 3a.75.75 0 0 0-.75.75v12.5c0 .414.336.75.75.75h1.5a.75.75 0 0 0 .75-.75V3.75A.75.75 0 0 0 7.25 3h-1.5ZM12.75 3a.75.75 0 0 0-.75.75v12.5c0 .414.336.75.75.75h1.5a.75.75 0 0 0 .75-.75V3.75a.75.75 0 0 0-.75-.75h-1.5Z"
id="button-forward-pause-icon"
/>
</svg>
</button>
<div id="timescale-height-buttons" hidden>
<button data-to="900k">≤900k</button>
<button data-to="850k">≤850k</button>
<button data-to="800k">≤800k</button>
<button data-to="750k">≤750k</button>
<button data-to="700k">≤700k</button>
<button data-to="650k">≤650k</button>
<button data-to="600k">≤600k</button>
<button data-to="550k">≤550k</button>
<button data-to="500k">≤500k</button>
<button data-to="450k">≤450k</button>
<button data-to="400k">≤400k</button>
<button data-to="350k">≤350k</button>
<button data-to="300k">≤300k</button>
<button data-to="250k">≤250k</button>
<button data-to="200k">≤200k</button>
<button data-to="150k">≤150k</button>
<button data-to="100k">≤100k</button>
<button data-to="50k">≤50k</button>
</div>
<!-- </div> -->
</div>
</div>
<div id="dashboard" hidden></div>
<div id="simulation" hidden>
<div>
<div>
<h4>Amount</h4>
<div>Initial</div>
<input
id="simulation-amount-initial"
type="number"
placeholder="US Dollars"
min="0"
/>
<input
type="range"
id="simulation-amount-initial-range"
title="Initially invested"
min="0"
max="100"
/>
<div>Recurrent</div>
<input
id="simulation-amount-recurrent"
type="number"
placeholder="US Dollars"
min="0"
/>
</div>
<hr />
<div>
<h4>Frequency</h4>
<ul>
<li>Daily</li>
<li>Weekly</li>
<li>Monthly</li>
</ul>
<ul id="simulation-frequency-choices">
<li>Monday</li>
<li>Tuesday</li>
<li>Wednesday</li>
<li>Thursday</li>
<li>Friday</li>
<li>Saturday</li>
<li>Sunday</li>
</ul>
</div>
<hr />
<div>
<h4>Interval</h4>
<div>
<input type="date" value="2021-04-15" />
<button>Reset</button>
</div>
<div>
<input type="date" value="2024-04-15" />
<button>Reset</button>
</div>
</div>
<hr />
<div>
<h4>Fees</h4>
<input type="number" value="0.025" />
</div>
<hr />
<div>
<h4>Strategy</h4>
<ul id="simulation-strategy">
<li>All in</li>
<li>Weighted Local</li>
<li>Weighted Cycle</li>
</ul>
</div>
</div>
<div></div>
</div>
</section>
</aside>
<div id="share-div" hidden>
+1 -84
View File
@@ -17,7 +17,7 @@
* @param {Ids} args.ids
* @param {Accessor<boolean>} args.dark
*/
export function initChartsElement({
export function init({
colors,
consts,
dark,
@@ -796,89 +796,6 @@ export function initChartsElement({
}
function initTimeScaleElement() {
function initScrollButtons() {
const buttonBackward = utils.dom.getElementById("button-backward");
const buttonBackwardIcon = utils.dom.getElementById(
"button-backward-icon",
);
const buttonBackwardPauseIcon = utils.dom.getElementById(
"button-backward-pause-icon",
);
const buttonForward = utils.dom.getElementById("button-forward");
const buttonForwardIcon = utils.dom.getElementById("button-forward-icon");
const buttonForwardPauseIcon = utils.dom.getElementById(
"button-forward-pause-icon",
);
let interval = /** @type {number | undefined} */ (undefined);
let direction = /** @type {1 | -1 | 0} */ (0);
const DELAY = 5;
const MULTIPLIER = DELAY / 10000;
function scrollChart() {
if (direction <= 0) {
buttonForwardIcon.removeAttribute("hidden");
buttonForwardPauseIcon.setAttribute("hidden", "");
}
if (direction >= 0) {
buttonBackwardIcon.removeAttribute("hidden");
buttonBackwardPauseIcon.setAttribute("hidden", "");
}
if (direction === -1) {
buttonBackwardIcon.setAttribute("hidden", "");
buttonBackwardPauseIcon.removeAttribute("hidden");
}
if (direction === 1) {
buttonForwardIcon.setAttribute("hidden", "");
buttonForwardPauseIcon.removeAttribute("hidden");
}
if (!direction) {
clearInterval(interval);
return;
}
interval = setInterval(() => {
const time = charts.at(-1)?.timeScale();
if (!time) return;
const range = time.getVisibleLogicalRange();
if (!range) return;
const speed = (range.to - range.from) * MULTIPLIER * direction;
// @ts-ignore
range.from += speed;
// @ts-ignore
range.to += speed;
time.setVisibleLogicalRange(range);
}, DELAY);
}
buttonBackward.addEventListener("click", () => {
if (direction !== -1) {
direction = -1;
} else {
direction = 0;
}
scrollChart();
});
buttonForward.addEventListener("click", () => {
if (direction !== 1) {
direction = 1;
} else {
direction = 0;
}
scrollChart();
});
}
initScrollButtons();
const GENESIS_DAY = "2009-01-03";
/**
+74 -9
View File
@@ -1,7 +1,7 @@
// @ts-check
/**
* @import { OptionPath, PartialOption, PartialOptionsGroup, PartialOptionsTree, Option, OptionsGroup, Series, PriceSeriesType, ResourceDataset, TimeScale, SerializedHistory, TimeRange, Unit, Marker, Weighted, DatasetPath, OHLC, FetchedJSON, DatasetValue, FetchedResult, AnyDatasetPath, SeriesBlueprint, BaselineSpecificSeriesBlueprint, CandlestickSpecificSeriesBlueprint, LineSpecificSeriesBlueprint, SpecificSeriesBlueprintWithChart, Signal, Color, SettingsTheme, DatasetCandlestickData, FoldersFilter, PartialChartOption, ChartOption, AnyPartialOption, ProcessedOptionAddons, OptionsTree, AnyPath } from "./types/self"
* @import { OptionPath, PartialOption, PartialOptionsGroup, PartialOptionsTree, Option, OptionsGroup, Series, PriceSeriesType, ResourceDataset, TimeScale, SerializedHistory, TimeRange, Unit, Marker, Weighted, DatasetPath, OHLC, FetchedJSON, DatasetValue, FetchedResult, AnyDatasetPath, SeriesBlueprint, BaselineSpecificSeriesBlueprint, CandlestickSpecificSeriesBlueprint, LineSpecificSeriesBlueprint, SpecificSeriesBlueprintWithChart, Signal, Color, SettingsTheme, DatasetCandlestickData, FoldersFilter, PartialChartOption, ChartOption, AnyPartialOption, ProcessedOptionAddons, OptionsTree, AnyPath, SimulationOption } from "./types/self"
* @import {createChart as CreateClassicChart, createChartEx as CreateCustomChart, LineStyleOptions} from "./packages/lightweight-charts/v4.2.0/types";
* @import * as _ from "./packages/ufuzzy/v1.0.14/types"
* @import { DeepPartial, ChartOptions, IChartApi, IHorzScaleBehavior, WhitespaceData, SingleValueData, ISeriesApi, Time, LogicalRange, SeriesMarker, CandlestickData, SeriesType, BaselineStyleOptions, SeriesOptionsCommon } from "./packages/lightweight-charts/v4.2.0/types"
@@ -720,7 +720,9 @@ const utils = {
label.for = inputId;
label.title = labelTitle;
label.addEventListener("click", onClick || (() => {}));
if (onClick) {
label.addEventListener("click", onClick);
}
return {
label,
@@ -734,6 +736,7 @@ const utils = {
* @param {string} args.inputId
* @param {string} args.inputValue
* @param {string} args.labelTitle
* @param {string} [args.href]
* @param {(event: MouseEvent) => void} args.onClick
*/
createComplexLabeledInput({
@@ -743,6 +746,7 @@ const utils = {
labelTitle,
name,
onClick,
href,
}) {
const { label, input } = this.createLabeledInput({
inputId,
@@ -757,7 +761,30 @@ const utils = {
label.append(spanMain);
const spanName = this.createSpanName(name);
spanMain.append(spanName);
if (href) {
const anchor = window.document.createElement("a");
anchor.href = href;
anchor.append(spanName);
spanMain.append(anchor);
if (href.includes(".")) {
anchor.target = "_target";
anchor.rel = "noopener noreferrer";
anchor.addEventListener("click", (event) => {
event.stopPropagation();
// event.preventDefault();
});
} else {
anchor.addEventListener("click", (event) => {
// event.stopPropagation();
event.preventDefault();
});
}
} else {
spanMain.append(spanName);
}
return {
label,
@@ -1249,7 +1276,7 @@ const elements = {
selectedHr: utils.dom.getElementById("selected-hr"),
home: utils.dom.getElementById("home"),
charts: utils.dom.getElementById("charts"),
dashboard: utils.dom.getElementById("dashboard"),
simulation: utils.dom.getElementById("simulation"),
};
/** @typedef {typeof elements} Elements */
@@ -2144,6 +2171,9 @@ packages.signals().then((signals) =>
const lastChartOption = signals.createSignal(
/** @type {ChartOption | null} */ (null),
);
const lastSimulationOption = signals.createSignal(
/** @type {SimulationOption | null} */ (null),
);
const owner = signals.getOwner();
@@ -2151,7 +2181,7 @@ packages.signals().then((signals) =>
undefined
);
let firstChartOption = true;
let firstDashboardOption = true;
let firstSimulationOption = true;
signals.createEffect(() => {
const option = options.selected();
@@ -2187,9 +2217,9 @@ packages.signals().then((signals) =>
if (firstChartOption) {
const lightweightCharts = packages.lightweightCharts();
const chartsScript = import("./chart.js");
const chartScript = import("./chart.js");
utils.dom.importStyleAndThen("/styles/chart.css", () =>
chartsScript.then(({ initChartsElement }) =>
chartScript.then(({ init: initChartsElement }) =>
lightweightCharts.then((lightweightCharts) =>
signals.runWithOwner(owner, () =>
initChartsElement({
@@ -2215,8 +2245,43 @@ packages.signals().then((signals) =>
break;
}
case "pdf": {
utils.dom.open(`/assets/pdfs/${option.file}`, true);
case "simulation": {
element = elements.simulation;
lastSimulationOption.set(option);
if (firstSimulationOption) {
const lightweightCharts = packages.lightweightCharts();
const simulationScript = import("./simulation.js");
utils.dom.importStyleAndThen("/styles/simulation.css", () =>
simulationScript.then(({ init }) =>
lightweightCharts.then((lightweightCharts) =>
signals.runWithOwner(owner, () =>
init({
colors,
consts,
dark,
datasets,
elements,
ids,
lightweightCharts,
options,
selected: /** @type {any} */ (lastChartOption),
signals,
utils,
webSockets,
}),
),
),
),
);
}
firstSimulationOption = false;
break;
}
default: {
return;
}
}
+23 -3
View File
@@ -4820,6 +4820,17 @@ function createPartialOptions(colors) {
},
],
},
{
name: "Simulations",
tree: [
{
icon: "🧪",
kind: "simulation",
title: "Dollar Cost Average Simulation",
name: "Dollar Cost Average",
},
],
},
{
name: "Library",
tree: [
@@ -5075,7 +5086,12 @@ export function initOptions({
inputName: `option-${frame}${id || ""}`,
labelTitle: option.title,
name: name || option.name,
onClick: () => selected.set(option),
onClick: () => {
// if (option.kind !== "pdf") {
selected.set(option);
// }
},
href: `/${option.kind === "pdf" ? option.file : option.id}`,
});
if (top) {
@@ -5343,6 +5359,7 @@ export function initOptions({
kind = "pdf";
id = `${ids.fromString(anyPartial.name)}-pdf`;
title = anyPartial.name;
anyPartial.file = `assets/pdfs/${anyPartial.file}`;
} else if ("scale" in anyPartial) {
kind = "chart";
id = `chart-${anyPartial.scale}-to-${ids.fromString(
@@ -5350,8 +5367,11 @@ export function initOptions({
)}`;
title = anyPartial.title;
} else {
console.log(anyPartial);
throw "Unreachable";
kind = anyPartial.kind;
title = anyPartial.title;
console.log("Unprocessed", anyPartial);
id = `${kind}-${ids.fromString(anyPartial.title)}`;
// return;
}
/** @type {ProcessedOptionAddons} */
+35
View File
@@ -0,0 +1,35 @@
/**
* @import {Options} from './options';
*/
/**
* @param {Object} args
* @param {Colors} args.colors
* @param {Consts} args.consts
* @param {LightweightCharts} args.lightweightCharts
* @param {Accessor<ChartOption>} args.selected
* @param {Signals} args.signals
* @param {Utilities} args.utils
* @param {Options} args.options
* @param {Datasets} args.datasets
* @param {WebSockets} args.webSockets
* @param {Elements} args.elements
* @param {Ids} args.ids
* @param {Accessor<boolean>} args.dark
*/
export function init({
colors,
consts,
dark,
datasets,
elements,
ids,
lightweightCharts,
options,
selected,
signals,
utils,
webSockets,
}) {
const simulationElement = elements.simulation;
}
File diff suppressed because one or more lines are too long
+11 -3
View File
@@ -125,6 +125,12 @@ interface PartialChartOption extends PartialOption {
};
}
interface PartialSimulationOption extends PartialOption {
kind: "simulation";
title: "Dollar Cost Average Simulation";
name: "Dollar Cost Average";
}
interface PartialPdfOption extends PartialOption {
file: string;
}
@@ -136,8 +142,9 @@ interface PartialOptionsGroup {
type AnyPartialOption =
| PartialHomeOption
| PartialPdfOption
| PartialChartOption;
| PartialChartOption
| PartialSimulationOption
| PartialPdfOption;
type PartialOptionsTree = (AnyPartialOption | PartialOptionsGroup)[];
@@ -155,6 +162,7 @@ type OptionPath = {
}[];
type HomeOption = PartialHomeOption & ProcessedOptionAddons;
type SimulationOption = PartialSimulationOption & ProcessedOptionAddons;
interface PdfOption extends PartialPdfOption, ProcessedOptionAddons {
kind: "pdf";
@@ -165,7 +173,7 @@ interface ChartOption extends PartialChartOption, ProcessedOptionAddons {
kind: "chart";
}
type Option = HomeOption | PdfOption | ChartOption;
type Option = HomeOption | PdfOption | ChartOption | SimulationOption;
type OptionsTree = (Option | OptionsGroup)[];
+23 -40
View File
@@ -109,53 +109,36 @@
}
}
> #timescale {
> hr {
margin-top: 1rem;
display: flex;
overflow: hidden;
z-index: 50;
}
@media (max-width: 767px) {
margin-bottom: -1.5rem;
border-top: 1px;
> #timescale {
> #timescale-date-buttons,
> #timescale-height-buttons {
display: flex;
overflow-x: auto;
display: flex;
overflow-x: auto;
margin-bottom: -0.5rem;
padding: 0.5rem 0.5rem;
padding-top: 0.5rem;
margin-left: -1.5rem;
margin-right: -1.5rem;
}
@media (min-width: 768px) {
border-radius: 9999px;
border: 1px;
}
> button {
flex: 0;
}
> div {
min-width: 0;
flex: 1;
display: flex;
position: relative;
> #timescale-date-buttons,
> #timescale-height-buttons {
display: flex;
overflow-x: auto;
> button {
color: var(--off-color);
flex-shrink: 0;
flex-grow: 1;
padding: 0.5rem;
white-space: nowrap;
min-width: 5rem;
}
> button {
color: var(--off-color);
flex-shrink: 0;
flex-grow: 1;
padding: 0.5rem;
white-space: nowrap;
min-width: 5rem;
}
}
> *:not(:first-child):not(:last-child) {
border-left: 1px;
border-right: 1px;
@media (max-width: 767px) {
margin-bottom: -1.5rem;
padding-top: 0.5rem;
}
}
}
}
+23
View File
@@ -0,0 +1,23 @@
#simulation {
min-height: 0;
display: flex;
height: 100%;
width: 100%;
> div {
flex: 1;
/* min-height: 0; */
overflow-y: auto;
display: flex;
flex-direction: column;
width: 32rem;
gap: 1rem;
> div {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
}
}