{"record":{"id":"c438ebe3d955aa26","repo":"StockSharp/StockSharp","slug":"invalid-value-c438eb","errorCode":null,"errorMessage":"Invalid value.","messagePattern":"Invalid value\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"Algo.Strategies/Quoting/QuotingProcessor.cs","lineNumber":63,"sourceCode":"\t/// <param name=\"container\"><see cref=\"IMarketRuleContainer\"/></param>\n\t/// <param name=\"transProvider\"><see cref=\"ITransactionProvider\"/></param>\n\t/// <param name=\"timeProvider\"><see cref=\"ITimeProvider\"/></param>\n\t/// <param name=\"mdProvider\"><see cref=\"IMarketDataProvider\"/></param>\n\t/// <param name=\"isAllowed\">Is the strategy allowed to trade.</param>\n\t/// <param name=\"useBidAsk\">To use the best bid and ask prices from the order book. If the information in the order book is missed, the processor will not recommend any actions.</param>\n\t/// <param name=\"useTicks\">To use the last trade price, if the information in the order book is missed.</param>\n\tpublic QuotingProcessor(\n\t\tIQuotingBehavior behavior,\n\t\tSecurity security, Portfolio portfolio,\n\t\tSides quotingSide, decimal quotingVolume, decimal maxOrderVolume,\n\t\tTimeSpan timeOut, ISubscriptionProvider subProvider,\n\t\tIMarketRuleContainer container, ITransactionProvider transProvider,\n\t\tITimeProvider timeProvider, IMarketDataProvider mdProvider,\n\t\tFunc<StrategyTradingModes, bool> isAllowed,\n\t\tbool useBidAsk, bool useTicks)\n\t{\n\t\tif (quotingVolume <= 0)\n\t\t\tthrow new ArgumentOutOfRangeException(nameof(quotingVolume), quotingVolume, LocalizedStrings.InvalidValue);\n\n\t\tif (maxOrderVolume <= 0)\n\t\t\tthrow new ArgumentOutOfRangeException(nameof(maxOrderVolume), maxOrderVolume, LocalizedStrings.InvalidValue);\n\n\t\t_security = security ?? throw new ArgumentNullException(nameof(security));\n\t\t_portfolio = portfolio ?? throw new ArgumentNullException(nameof(portfolio));\n\t\t_quotingSide = quotingSide;\n\t\t_quotingVolume = quotingVolume;\n\t\t_maxOrderVolume = maxOrderVolume;\n\t\t_behavior = behavior ?? throw new ArgumentNullException(nameof(behavior));\n\t\t_timeOut = timeOut;\n\t\t_subProvider = subProvider ?? throw new ArgumentNullException(nameof(subProvider));\n\t\t_container = container ?? throw new ArgumentNullException(nameof(container));\n\t\t_transProvider = transProvider ?? throw new ArgumentNullException(nameof(transProvider));\n\t\t_timeProvider = timeProvider ?? throw new ArgumentNullException(nameof(timeProvider));\n\t\t_mdProvider = mdProvider ?? throw new ArgumentNullException(nameof(mdProvider));\n\t\t_isAllowed = isAllowed ?? throw new ArgumentNullException(nameof(isAllowed));\n\t\t_useBidAsk = useBidAsk;","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/StockSharp/StockSharp/blob/601a191de678bff83da28b14828f8885214ca71c/Algo.Strategies/Quoting/QuotingProcessor.cs#L45-L81","documentation":"Thrown by the QuotingProcessor constructor when quotingVolume is less than or equal to zero. QuotingProcessor is the rule-driven quoting engine that fulfills a target volume; a non-positive target means there is nothing to quote, so construction is rejected up front. The message comes from LocalizedStrings.InvalidValue.","triggerScenarios":"Constructing 'new QuotingProcessor(...)' with quotingVolume <= 0. The guard is the very first statement in the constructor body, so it fires before any dependency (security, providers) is touched.","commonSituations":"Deriving quotingVolume from (targetPosition - currentPosition) when the position already meets the target, yielding 0; deserializing a strategy whose Volume parameter was not set; feeding an unset OptimizableParam into the processor.","solutions":["Ensure quotingVolume is a positive decimal representing the absolute quantity to quote.","If quotingVolume is computed from a residual, skip constructing the processor when the residual is already <= 0.","Bind the parameter from a validated strategy property (e.g. Volume > 0) rather than a raw input.","Add a preflight assertion in your strategy's OnStarted before instantiating the processor."],"exampleFix":"// before\nvar proc = new QuotingProcessor(behavior, sec, pf, Sides.Buy, quotingVolume: residual, maxOrderVolume: 10, ...);\n\n// after\nif (residual <= 0) { this.LogInfo(\"Nothing to quote\"); return; }\nvar proc = new QuotingProcessor(behavior, sec, pf, Sides.Buy, quotingVolume: residual, maxOrderVolume: 10, ...);","handlingStrategy":"validation","validationCode":"if (quotingVolume <= 0)\n{\n    this.LogInfo($\"Quoting skipped: residual volume {quotingVolume} is not positive.\");\n    return;\n}\nvar proc = new QuotingProcessor(behavior, sec, pf, side, quotingVolume, maxOrderVolume, timeOut, subProvider, container, transProvider, timeProvider, mdProvider, isAllowed, useBidAsk, useTicks);","typeGuard":"static bool IsValidQuotingVolume(decimal v) => v > 0;","tryCatchPattern":null,"preventionTips":["Compute residual volume and skip processor creation when it is <= 0.","Surface a clear log line so operators understand why quoting did not start.","Validate the strategy's Volume parameter in OnStarted before building the processor.","Cover the quoting-volume parameter in serialization so it cannot deserialize to 0."],"tags":["quoting","constructor-validation","argument-out-of-range","volume","trading"],"backgroundTag":null,"analyzedSha":"601a191de678bff83da28b14828f8885214ca71c","analyzedAt":"2026-08-13T20:43:24.460Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}