tbapi.api.interfaces.ichart_scale
1from __future__ import annotations 2from typing import TYPE_CHECKING 3from tbapi.common.decorators import tb_interface 4from tbapi.common.converters import to_python_datetime, to_net_datetime 5from datetime import datetime 6from Tickblaze.Scripts.Api.Interfaces import IChartScale as _IChartScale 7from typing import Any, overload 8from abc import ABC, abstractmethod 9 10@tb_interface(_IChartScale) 11class IChartScale(): 12 """Represents the scale for the price axis in a chart, including the maximum and minimum price. It provides methods to format prices and convert between price values and their corresponding Y coordinates.""" 13 14 @property 15 def max_price(self) -> float: 16 """The maximum price value on the scale.""" 17 val = self._value.MaxPrice 18 return val 19 @property 20 def min_price(self) -> float: 21 """The minimum price value on the scale.""" 22 val = self._value.MinPrice 23 return val 24 25 @abstractmethod 26 def format_price(self, value: float) -> str: 27 """Formats the given price value into a string representation. The price value to format. A string representing the formatted price.""" 28 result = self._value.FormatPrice(value) 29 return result 30 31 @abstractmethod 32 def get_ycoordinate_by_value(self, value: float) -> float: 33 """Gets the Y coordinate in pixels for the specified axis value. The axis value to convert. The Y coordinate in pixels corresponding to the specified axis value.""" 34 result = self._value.GetYCoordinateByValue(value) 35 return result 36 37 @abstractmethod 38 def get_value_by_ycoordinate(self, y: float) -> float: 39 """Gets the axis value for the specified Y coordinate in pixels. The Y coordinate in pixels to convert. The axis value corresponding to the specified Y coordinate in pixels.""" 40 result = self._value.GetValueByYCoordinate(y) 41 return result 42
16@tb_interface(_IChartScale) 17class IChartScale(): 18 """Represents the scale for the price axis in a chart, including the maximum and minimum price. It provides methods to format prices and convert between price values and their corresponding Y coordinates.""" 19 20 @property 21 def max_price(self) -> float: 22 """The maximum price value on the scale.""" 23 val = self._value.MaxPrice 24 return val 25 @property 26 def min_price(self) -> float: 27 """The minimum price value on the scale.""" 28 val = self._value.MinPrice 29 return val 30 31 @abstractmethod 32 def format_price(self, value: float) -> str: 33 """Formats the given price value into a string representation. The price value to format. A string representing the formatted price.""" 34 result = self._value.FormatPrice(value) 35 return result 36 37 @abstractmethod 38 def get_ycoordinate_by_value(self, value: float) -> float: 39 """Gets the Y coordinate in pixels for the specified axis value. The axis value to convert. The Y coordinate in pixels corresponding to the specified axis value.""" 40 result = self._value.GetYCoordinateByValue(value) 41 return result 42 43 @abstractmethod 44 def get_value_by_ycoordinate(self, y: float) -> float: 45 """Gets the axis value for the specified Y coordinate in pixels. The Y coordinate in pixels to convert. The axis value corresponding to the specified Y coordinate in pixels.""" 46 result = self._value.GetValueByYCoordinate(y) 47 return result
Represents the scale for the price axis in a chart, including the maximum and minimum price. It provides methods to format prices and convert between price values and their corresponding Y coordinates.
20 @property 21 def max_price(self) -> float: 22 """The maximum price value on the scale.""" 23 val = self._value.MaxPrice 24 return val
The maximum price value on the scale.
25 @property 26 def min_price(self) -> float: 27 """The minimum price value on the scale.""" 28 val = self._value.MinPrice 29 return val
The minimum price value on the scale.
31 @abstractmethod 32 def format_price(self, value: float) -> str: 33 """Formats the given price value into a string representation. The price value to format. A string representing the formatted price.""" 34 result = self._value.FormatPrice(value) 35 return result
Formats the given price value into a string representation. The price value to format. A string representing the formatted price.
37 @abstractmethod 38 def get_ycoordinate_by_value(self, value: float) -> float: 39 """Gets the Y coordinate in pixels for the specified axis value. The axis value to convert. The Y coordinate in pixels corresponding to the specified axis value.""" 40 result = self._value.GetYCoordinateByValue(value) 41 return result
Gets the Y coordinate in pixels for the specified axis value. The axis value to convert. The Y coordinate in pixels corresponding to the specified axis value.
43 @abstractmethod 44 def get_value_by_ycoordinate(self, y: float) -> float: 45 """Gets the axis value for the specified Y coordinate in pixels. The Y coordinate in pixels to convert. The axis value corresponding to the specified Y coordinate in pixels.""" 46 result = self._value.GetValueByYCoordinate(y) 47 return result
Gets the axis value for the specified Y coordinate in pixels. The Y coordinate in pixels to convert. The axis value corresponding to the specified Y coordinate in pixels.