nectar.asciichart module
- class nectar.asciichart.AsciiChart(height: int | None = None, width: int | None = None, offset: int = 3, placeholder: str = '{:8.2f} ', charset: str = 'utf8')
Bases:
objectCan be used to plot price and trade history
- Parameters:
height (int) – Height of the plot
width (int) – Width of the plot
offset (int) – Offset between tick strings and y-axis (default is 3)
placeholder (str) – Defines how the numbers on the y-axes are formatted (default is ‘{:8.2f}’)
charset (str) – sets the charset for plotting, uft8 or ascii (default: utf8)
- adapt_on_series(series: List[int | float]) None
Calculates the minimum, maximum and length from the given list
- Parameters:
series (list) – time series to plot
from nectar.asciichart import AsciiChart chart = AsciiChart() series = [1, 2, 3, 7, 2, -4, -2] chart.adapt_on_series(series) chart.new_chart() chart.add_axis() chart.add_curve(series) print(str(chart))
- add_axis() None
Adds a y-axis to the canvas
from nectar.asciichart import AsciiChart chart = AsciiChart() series = [1, 2, 3, 7, 2, -4, -2] chart.adapt_on_series(series) chart.new_chart() chart.add_axis() chart.add_curve(series) print(str(chart))
- add_curve(series: List[int | float]) None
Add a curve to the canvas
- Parameters:
series (list) – List width float data points
from nectar.asciichart import AsciiChart chart = AsciiChart() series = [1, 2, 3, 7, 2, -4, -2] chart.adapt_on_series(series) chart.new_chart() chart.add_axis() chart.add_curve(series) print(str(chart))
- clear_data() None
Clears all data
- new_chart(minimum: int | float | None = None, maximum: int | float | None = None, n: int | None = None) None
Clears the canvas
from nectar.asciichart import AsciiChart chart = AsciiChart() series = [1, 2, 3, 7, 2, -4, -2] chart.adapt_on_series(series) chart.new_chart() chart.add_axis() chart.add_curve(series) print(str(chart))
- plot(series: List[int | float], return_str: bool = False) str | None
All in one function for plotting
from nectar.asciichart import AsciiChart chart = AsciiChart() series = [1, 2, 3, 7, 2, -4, -2] chart.plot(series)
- set_parameter(height: int | None = None, offset: int | None = None, placeholder: str | None = None) None
Can be used to change parameter