/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using QuantConnect.Securities; using System; namespace QuantConnect.ToolBox.RandomDataGenerator { /// /// Defines a type capable of producing random values for use in random data generation /// /// /// Any parameters referenced as a percentage value are always in 'percent space', meaning 1 is 1%. /// public interface IRandomValueGenerator { /// /// Randomly return a value with the specified odds of being true /// /// The percent odds of being true in percent space, so 10 => 10% /// True or false bool NextBool(double percentOddsForTrue); /// /// Returns a random floating-point number that is greater than or equal to 0.0, and less than 1.0 /// /// A double-precision floating point number that is greater than or equal to 0.0, and less than 1.0. double NextDouble(); /// /// Returns a random integer that is within a specified range. /// /// the inclusive lower bound of the random number returned /// the exclusive upper bound of the random number returned /// A 32-bit signed integer greater than or equal to minValue and less than maxValue. int NextInt(int minValue, int maxValue); /// /// Returns a non-negative random integer that is less than the specified maximum. /// /// the exclusive upper bound of the random number to be generated. /// A 32-bit signed integer that is greater than or equal to 0, and less than maxValue. int NextInt(int maxValue); /// /// Generates a random between the specified and /// . is optionally specified to force the /// result to a particular day of the week /// /// The minimum date time, inclusive /// The maximum date time, inclusive /// Optional. The day of week to force /// A new within the specified range and optionally of the specified day of week DateTime NextDate(DateTime minDateTime, DateTime maxDateTime, DayOfWeek? dayOfWeek); /// /// Generates a random suitable as a price. This should observe minimum price /// variations if available in , and if not, truncating to 2 /// decimal places. /// /// Throw when the or /// is less than or equal to zero. /// The security type the price is being generated for /// The market of the security the price is being generated for /// The reference price used as the mean of random price generation /// The maximum percent deviation. This value is in percent space, /// so a value of 1m is equal to 1%. /// A new decimal suitable for usage as price within the specified deviation from the reference price decimal NextPrice(SecurityType securityType, string market, decimal referencePrice, decimal maximumPercentDeviation); } }