Firetron’s InputOrderOptions

1 31 Views No Comments 2 weeks ago
  • Creates a group of inputs for order options: type, timeout, triggerPrice.

    Custom Command Dependencies:
    None

    HaasScript Code
    --  ============================================================================
    --    Firetron's InputOrderOptions
    --
    --    Creates a group of inputs for order options: type, timeout, triggerPrice.
    --
    --    Custom Command Dependencies:
    --    None
    --
    --    Discord: @FiretronP75
    --  ============================================================================
    
    --  ========================================================
    --    Variables
    --  ========================================================
    
    --  ------------------------------------
    --    Definition
    --  ------------------------------------
    
    local description
    local inputSuggestions
    local label
    local output
    local outputSuggestions
    local tooltip
    
    --  ------------------------------------
    --    Parameter
    --  ------------------------------------
    
    local pGroup
    local pTimeout
    local pTriggerPrice
    local pType
    
    --  ========================================================
    --    Command Definition
    --  ========================================================
    
    description = 'Creates a group of inputs for order options: type, timeout, triggerPrice.'
    DefineCommand('InputOrderOptions', description)
    
    --  ========================================================
    --    Parameter Definition
    --  ========================================================
    
    description      = 'The group of the input fields.'
    inputSuggestions = 'Text'
    pGroup           = DefineParameter(StringType, 'group', description, true, 'OrderOptions', inputSuggestions)
    
    --  ========================================================
    --    Input Definitions
    --  ========================================================
    
    label   = '  Type'
    tooltip = 'The type of order. Default is limit.'
    pType   = InputOrderType(label, LimitOrderType, tooltip, pGroup)
    
    label    = ' Timeout'
    tooltip  = 'The order timeout in seconds. By default the timeout is 600 seconds / 10 minutes.'
    pTimeout = Input(label, 600, tooltip, pGroup)
    
    label         = 'Trigger Price'
    tooltip       = 'Trigger price, used for conditional orders. This parameter must only be set when using native order types that are supported by the exchange.'
    pTriggerPrice = Input(label, -1, tooltip, pGroup)
    
    --  ========================================================
    --    Output Definitions
    --  ========================================================
    
    output = {
      type         = pType,
      timeout      = pTimeout,
      triggerPrice = pTriggerPrice,
    }
    
    description       = 'ListDynamic with named elements.'
    outputSuggestions = 'Trade'
    DefineOutput(ListDynamicType, output, description, outputSuggestions)
    
    description = 'The type of order.'
    DefineOutputIndex( 1, EnumType, 'type', description)
    
    description = 'The order timeout in seconds.'
    DefineOutputIndex( 2, NumberType, 'timeout', description)
    
    description = 'Trigger price, used for conditional orders.'
    DefineOutputIndex( 3, NumberType, 'triggerPrice', description)
Login or Register to Comment

Unlock your crypto trading potential

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

Join for Free