Strategy Input parameter validation

Dec 30 2018
  • Strategy Input parameter validation

  • This is important to validate all the inputs parameter against the constraint that is defined for the variables in the given strategy. For example a user defined parameter named UserBenchmark must have a positive value.

  • [StrategyParameter("UserBenchmark", "0.0", "Target Spread")]
    private double UserBenchmark = 0;
    [StrategyParameterAttribute(("VWAPPriceTillDepth", "4", "VWAP Till Depth")]
    private int VWAPTillDepth = 0;
    ...........
    ...........
    protected override bool ValidateStrategyParameter(string parameterName, object paramterValue, out string errorString)
    {
        errorString = string.Empty;
        bool retValue = false;
        switch (parameterName)
        {
            case "UserBenchmark" :
                retValue = paramterValue is double;
                if (retValue == false || retValue < 0)
                    errorString = parameterName + " value is invalid.";
                break;
            case "VWAPTillDepth" :
                retValue = paramterValue is int;
                if (retValue == false || retValue < 0)
                    errorString = parameterName + " value is invalid.";
                break;
             default:
                 retValue = base.ValidateStrategyParameter(parameterName, paramterValue, out errorString);
                 break;
            case StrategyInputParameter.BuyJumpPrice:
        }
     }
     
 
  • Strategy Input parameter validation

  • This is important to validate all the inputs parameter against the constraint that is defined for the variables in the given strategy. For example a user defined parameter named UserBenchmark must have a positive value.

  • [StrategyParameter("UserBenchmark", "0.0", "Target Spread")]
    private double UserBenchmark = 0;
    [StrategyParameterAttribute(("VWAPPriceTillDepth", "4", "VWAP Till Depth")]
    private int VWAPTillDepth = 0;
    ...........
    ...........
    protected override bool ValidateStrategyParameter(string parameterName, object paramterValue, out string errorString)
    {
        errorString = string.Empty;
        bool retValue = false;
        switch (parameterName)
        {
            case "UserBenchmark" :
                retValue = paramterValue is double;
                if (retValue == false || retValue < 0)
                    errorString = parameterName + " value is invalid.";
                break;
            case "VWAPTillDepth" :
                retValue = paramterValue is int;
                if (retValue == false || retValue < 0)
                    errorString = parameterName + " value is invalid.";
                break;
             default:
                 retValue = base.ValidateStrategyParameter(parameterName, paramterValue, out errorString);
                 break;
            case StrategyInputParameter.BuyJumpPrice:
        }
     }

     

Contact US

Let us help you to achieve your goals!

     

     

     

     

     

    By providing Symphony with your contact information Symphony will process your personal data for the purpose of providing you with the information you have requested. For more information regarding Symphony's processing of your personal data, please read Symphony's Privacy Notice here.


    • Get latest updates from Us