Sha256: a94213e84bdd3d4b9c0643cb865342c93d3bb9583586776719d2c175c41844dc
Contents?: true
Size: 1.7 KB
Versions: 69
Compression:
Stored size: 1.7 KB
Contents
# frozen_string_literal: true module Cryptum # Cryptum::OrderBook Namespace module OrderBook # This module is used to indicate if the # Projected Profit Margin is greater than # the Target Profit Margin Outlined in the # Respective Bot Conf module ProfitMargin # Supported Method Parameters:: # Cryptum::OrderBook::ProfitMargin.status( # ) public_class_method def self.status(opts = {}) indicator_hash = {} target_profit_margin_percent = opts[:target_profit_margin_percent] total_invested = opts[:total_invested] total_projected_return = opts[:total_projected_return] indicator_status = opts[:indicator_status] invested = opts[:invested] ave_profit_margin_percent = 100 - ((total_invested / total_projected_return) * 100) if ave_profit_margin_percent > target_profit_margin_percent indicator_hash[:color] = :green pm_op = '>' elsif ave_profit_margin_percent < target_profit_margin_percent indicator_hash[:color] = :red pm_op = '<' else indicator_hash[:color] = :yellow pm_op = '==' end profit_margin_status_out = "Profit Margin #{pm_op} TPM" indicator_hash[:invested] = invested indicator_hash[:status] = profit_margin_status_out indicator_status.profit_margin = indicator_hash rescue Interrupt, StandardError => e Cryptum::Log.append(level: :error, msg: e, which_self: self) end # Display Usage for this Module public_class_method def self.help puts "USAGE: weighted_ave_indicator_hash = #{self}.status( ) " end end end end
Version data entries
69 entries across 69 versions & 1 rubygems