Closed Ingvix closed 3 years ago
Here you go
npx bitcoin-chart-cli@3.4.0 --min 0 --max 100000 -w 50
100000 ┼
92857 ┤
85714 ┤
78571 ┤
71429 ┤
64286 ┤ ╭─╮
57143 ┤ ╭─╮ ╭───────╮╭─────────╯ ╰─╮ ╭─────
50000 ┤ ╭─────╯ ╰─╮╭────╯ ╰╯ ╰──╯
42857 ┤ │ ╰╯
35714 ┼─╯
28571 ┤
21429 ┤
14286 ┤
7143 ┤
0 ┤
BTC last 90 days. Now: 55482.91 USD
I hope this lessens your disturbance as it offers you a stable y-axis. However, if the current chart value goes below the min or higher than the max option it will default back to dynamic y-axis sizing, there's no cutoff.
This is nice too though you misunderstood me a bit. I hoped to set the minimum (and maximum) distance between the highest and lowest y-axis values. The chart's min and max values aren't set and can change freely but the minimum distance between them would be constant when the price values would fit in a smaller range.
So since we can already use min and max, now we just need to get the highest and lowest of the price values and first check if the distance between them is lower than the selected minimum distance. If it is, we split the remainder of the set minimum distance minus the distance between high and low values and add the other half to the high value and reduce the other from the low value. Then we set these as the max and min parameters in the asciichart. I looked around the code but I'm not quite skilled enough in js to make the changes myself.
If cutoff is not possible the max range probably can't be implemented.
@madnight The above feature can be controlled with asciichart's height
option. Hope that helps. Thx for your work!
@Ingvix Ah okay, I think I got you this time
$ npx bitcoin-chart-cli@3.5.0 --min-range 50000 -w 50
76377 ┤
72805 ┤
69234 ┤
65662 ┤ ╭─╮
62091 ┤ ╭╮ ╭╯ ╰╮
58519 ┤ ╭╮ ╭╯╰───╮ ╭───────╯ ╰╮ ╭────
54948 ┤ ╭─╯│ ╭╯ ╰──╯ ╰╮ ╭─╯
51377 ┤ │ ╰─╮ ╭───╯ ╰─╯
47805 ┤╭────╯ ╰─╯
44234 ┤│
40662 ┼╯
37091 ┤
33519 ┤
29948 ┤
26377 ┤
BTC last 90 days. Now: 56235.51 USD
$ npx bitcoin-chart-cli@3.5.0 --coin ADA --min-range 3 -w 50
2.65 ┤
2.43 ┤
2.22 ┼
2.00 ┤
1.79 ┤ ╭
1.57 ┤ ╭─╮ ╭╯
1.36 ┤ ╭──╮ ╭╮ ╭──╮ ╭─────────╯ ╰──╮ ╭────╯
1.15 ┤ ╭──╯ ╰──╯╰──╯ ╰─╯ ╰─╯
0.93 ┤ ╭─────╯
0.72 ┼─╯
0.50 ┤
0.29 ┤
0.07 ┤
-0.14 ┤
-0.35 ┤
ADA last 90 days. Now: 1.662 USD
Is that what you wanted?
@kroitor I make use of this feature https://github.com/kroitor/asciichart/commit/7c72b334521ef55e749ba508187b2adf3688dc66, thx for your help!
Yeah, that's what I was after and it's great, thanks!
I find it a bit disturbing how much the chart may change on update due to the min and max values of the requested timeframe changing and the chart range depending on them.
So I'd like to be able to set something like have the minimum range be 50 units of the selected currency and the chart range wouldn't go smaller than that even if all the values from the requested timeframe are spread on a range less than 50 units.
I was thinking of requesting also max range option but that could be a bit too hard to implement in a way that satisfies all. Maybe take the average of the values within the selecter timeframe and center the chart on it if the current value is within that range? Otherwise use the current value as the min or max of the range depending on whether it was under or over the range determined from the average. Anyway the max value is less important to me but might as well lay it here as well.