PyHodl  0.2.8
Framework to download, update, analyze and plot your crypto-transactions. Completely off-line and security-oriented.
pyhodl.utils.misc Namespace Reference

Functions

def get_actual_class_name (class_name)
 
def callable_to_str (func, args, kwargs)
 
def normalize (val, min_val, max_val, min_range=-1.0, max_range=1.0)
 
def is_nan (candidate)
 
def remove_same_coordinates (x_data, y_val)
 
def num_to_str (num, form="short")
 
def get_ratio (new, last)
 
def get_percentage (new, last)
 
def get_relative_percentage (new, last)
 
def get_relative_delta (new, last)
 
def print_balance_info (total_value, delta, percentage, last_time, color=False)
 
def color_number (number, low_color=Fore.RED, high_color=Fore.GREEN, default_color=Fore.WHITE, eps=1e-3)
 

Variables

string LONG_DEC_FORMAT = "{0:.5f}"
 
string SHORT_DEC_FORMAT = "{0:.3f}"
 

Function Documentation

def pyhodl.utils.misc.callable_to_str (   func,
  args,
  kwargs 
)
:param func: callback function
    Function to wrap
:param args: *
    args for callback function
:param kwargs: **
    kwargs for callback function
:return: str
    Name of function
def pyhodl.utils.misc.color_number (   number,
  low_color = Fore.RED,
  high_color = Fore.GREEN,
  default_color = Fore.WHITE,
  eps = 1e-3 
)
:param number: str or float
    Number ot print
:param low_color: int
    Color to use with low numbers
:param high_color: int
    Color to use with high numbers
:param default_color: int
    Color to use with nor lor, nor high numbers
:param eps: float
    If number is < eps, color with low, else color with high, else default
:return: str
    Colorful number
def pyhodl.utils.misc.get_actual_class_name (   class_name)
:param class_name: str
    Class name of object
:return: str
    Actual class name (without all path)
def pyhodl.utils.misc.get_percentage (   new,
  last 
)
:param new: float
    New value
:param last: float
    Last value
:return: float in [0, 100]
    Percentage increase (or decrease) since last value
def pyhodl.utils.misc.get_ratio (   new,
  last 
)
:param new: float
    New value
:param last: float
    Last value
:return: float in [0, 100]
   Ratio (with errors handling)
def pyhodl.utils.misc.get_relative_delta (   new,
  last 
)
:param new: float
    New value
:param last: float
    Last value
:return: float
    Increase (or decrease) since last value
def pyhodl.utils.misc.get_relative_percentage (   new,
  last 
)
:param new: float
    New value
:param last: float
    Last value
:return: float in [0, 100]
    Percentage (with errors handling)
def pyhodl.utils.misc.is_nan (   candidate)
:param candidate: float, str
    Candidate to check
:return: bool
    True iff is considered NotANumber
def pyhodl.utils.misc.normalize (   val,
  min_val,
  max_val,
  min_range = -1.0,
  max_range = 1.0 
)
:param val: float
    Value to normalize
:param min_val: float
    Min value of value
:param max_val: float
    Msx value of value
:param min_range: float
    Min value of range
:param max_range: float
    Max value of value
:return: float
    Normalized var in range
def pyhodl.utils.misc.num_to_str (   num,
  form = "short" 
)
:param num: float
    Number to convert to string
:param form: str
    Format to use. Must be in ["short", "long"]
:return: str
    Convert to str using the specified format
def pyhodl.utils.misc.print_balance_info (   total_value,
  delta,
  percentage,
  last_time,
  color = False 
)
:param total_value: float
    Total value of balance
:param delta: float
    Delta since last time
:param percentage: float
    % since last time
:param last_time: datetime
    Date of last balance report
:param color: bool
    True iff you want colorful output
:return: void
    Prints balance
def pyhodl.utils.misc.remove_same_coordinates (   x_data,
  y_val 
)
:param x_data: [] of *
    List of data on x-axis
:param y_val: [] of float
    List of values
:return: tuple ([] of *, [] of float)
    Original list minus the points with same x-coordinate

Variable Documentation

string pyhodl.utils.misc.LONG_DEC_FORMAT = "{0:.5f}"
string pyhodl.utils.misc.SHORT_DEC_FORMAT = "{0:.3f}"