Firetron’s FormatRoundedQuoteCurrency

2 71 Views No Comments 4 weeks ago
  • Formats a number to be rounded and have the quote currency symbol.

    Custom Command Dependencies:
    Firetron’s QuoteDecimals

    • This topic was modified 3 weeks, 5 days ago by Team HaasScripts.
    • This topic was modified 3 days, 17 hours ago by Firetron. Reason: Can now automatically decide how many decimal places to round to
    • This topic was modified 3 days, 6 hours ago by Firetron. Reason: Added hyperlink to command
    HaasScript Code
    --  ============================================================================
    --    Firetron's FormatRoundedQuoteCurrency
    --
    --    Formats a number to be rounded and have the quote currency symbol.
    --
    --    Custom Command Dependencies:
    --    Firetron's QuoteDecimals
    --
    --    Discord:  @FiretronP75
    --    BTC Tips: 14WLDZsrhshcP6qvBarKW8ABACv3iUXEro
    --    ETH Tips: 0xfaaac99fbf11f8f4abc4b3bf079cb2c7a43b5f87
    --  ============================================================================
    
    --  ========================================================
    --    Definition
    --  ========================================================
    
    DefineCommand('FormatRoundedQuoteCurrency', 'Formats a number to be rounded and have the quote currency symbol.')
    
    --  ========================================================
    --    Parameters
    --  ========================================================
    
    local input  = DefineParameter(NumberType, 'Input',  'The number to format',   true,  0)
    local market = DefineParameter(StringType, 'market', 'The currency market',    false, PriceMarket(), 'InputAccountMarket, InputMarket, PriceMarket')
    local digits = DefineParameter(NumberType, 'Digits', 'The digits to round to', false, CC_QuoteDecimals(market), 'CC_QuoteDecimals')
    local symbol = DefineParameter(StringType, 'Symbol', 'The symbol to append',   false, ' '..QuoteCurrency(market))
    
    --  ========================================================
    --    Output
    --  ========================================================
    
    DefineOutput(StringType, Round(input, digits)..symbol, 'Formatted Value')
Login or Register to Comment

Unlock your crypto trading potential

Create a free account and enjoy everything we have to offer.

Join for Free