def freezePolicyPatternSearchTest(createTestFile=False): """ PATTERN SEQ(AppleStockPriceUpdate a, AmazonStockPriceUpdate b, AvidStockPriceUpdate c) WHERE a.OpeningPrice > c.OpeningPrice WITHIN 5 minutes """ pattern = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a"), PrimitiveEventStructure("AMZN", "b"), PrimitiveEventStructure("AVID", "c")), GreaterThanCondition(Variable("a", lambda x: x["Opening Price"]), Variable("c", lambda x: x["Opening Price"])), timedelta(minutes=5), ConsumptionPolicy(freeze="a")) runTest("freezePolicy", [pattern], createTestFile, eventStream=nasdaqEventStreamTiny)
def MinMax_1_TestKleeneClosure(createTestFile=False): pattern = Pattern( SeqOperator(KleeneClosureOperator(PrimitiveEventStructure("GOOG", "a"))), SimpleCondition(Variable("a", lambda x: x["Opening Price"]), relation_op=lambda x: x > 0), timedelta(minutes=5) ) runTest("MinMax_1_", [pattern], createTestFile, events=nasdaqEventStreamKC)
def oneArgumentsearchTest(createTestFile=False): pattern = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a")), GreaterThanCondition(Variable("a", lambda x: x["Opening Price"]), 135), timedelta(minutes=120) ) runTest("one", [pattern], createTestFile)
def oneArgumentsearchTestKleeneClosure(createTestFile=False): pattern = Pattern( SeqOperator(KleeneClosureOperator(PrimitiveEventStructure("AAPL", "a"), min_size=1, max_size=5)), SimpleCondition(Variable("a", lambda x: x["Opening Price"]), relation_op=lambda x: x > 135), timedelta(minutes=5) ) runTest("oneArgumentKC", [pattern], createTestFile)
def nonFrequencyTailoredPatternSearchTest(createTestFile=False): pattern = Pattern( SeqOperator(PrimitiveEventStructure("DRIV", "a"), PrimitiveEventStructure("MSFT", "b"), PrimitiveEventStructure("CBRL", "c")), SimpleCondition(Variable("a", lambda x: x["Opening Price"]), Variable("b", lambda x: x["Opening Price"]), Variable("c", lambda x: x["Opening Price"]), relation_op=lambda x, y, z: x > y > z), timedelta(minutes=360)) eval_params = TreeBasedEvaluationMechanismParameters( TreePlanBuilderParameters(TreePlanBuilderTypes.TRIVIAL_LEFT_DEEP_TREE), DEFAULT_TESTING_EVALUATION_MECHANISM_SETTINGS.storage_params) runTest('nonFrequencyTailored1', [pattern], createTestFile, eval_mechanism_params=eval_params, events=nasdaqEventStream)
def leafIsRoot(createTestFile=False): pattern1 = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a")), GreaterThanCondition(Variable("a", lambda x: x["Peak Price"]), 135), timedelta(minutes=5)) pattern2 = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a"), NegationOperator(PrimitiveEventStructure("AMZN", "b")), PrimitiveEventStructure("GOOG", "c")), AndCondition( GreaterThanCondition(Variable("a", lambda x: x["Opening Price"]), Variable("b", lambda x: x["Opening Price"])), SmallerThanCondition(Variable("b", lambda x: x["Opening Price"]), Variable("c", lambda x: x["Opening Price"]))), timedelta(minutes=5)) runMultiTest("FirstMultiPattern", [pattern1, pattern2], createTestFile)
def oneArgumentsearchTest(createTestFile=False, eval_mechanism_params=DEFAULT_TESTING_EVALUATION_MECHANISM_SETTINGS, test_name = "one"): pattern = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a")), GreaterThanCondition(Variable("a", lambda x: x["Opening Price"]), 135), timedelta(minutes=120) ) runTest(test_name, [pattern], createTestFile, eval_mechanism_params)
def googleIncreasePatternSearchTest(createTestFile=False, eval_mechanism_params=DEFAULT_TESTING_EVALUATION_MECHANISM_SETTINGS, test_name = "googleIncrease"): """ This Pattern is looking for a 1% increase in the google stock in a half-hour. PATTERN SEQ(GoogleStockPriceUpdate a, GoogleStockPriceUpdate b) WHERE b.PeakPrice >= 1.01 * a.PeakPrice WITHIN 30 minutes """ googleIncreasePattern = Pattern( SeqOperator(PrimitiveEventStructure("GOOG", "a"), PrimitiveEventStructure("GOOG", "b")), BinaryCondition(Variable("b", lambda x: x["Peak Price"]), Variable("a", lambda x: x["Peak Price"]), relation_op=lambda x, y: x >= y * 1.01), timedelta(minutes=30) ) runTest(test_name, [googleIncreasePattern], createTestFile, eval_mechanism_params)
def arrivalRatesPatternSearchTest(createTestFile=False): pattern = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a"), PrimitiveEventStructure("AMZN", "b"), PrimitiveEventStructure("LOCM", "c")), SimpleCondition(Variable("a", lambda x: x["Opening Price"]), Variable("b", lambda x: x["Opening Price"]), Variable("c", lambda x: x["Opening Price"]), relation_op=lambda x, y, z: x > y > z), timedelta(minutes=5)) pattern.set_statistics(StatisticsTypes.ARRIVAL_RATES, [0.0159, 0.0153, 0.0076]) eval_params = TreeBasedEvaluationMechanismParameters( TreePlanBuilderParameters( TreePlanBuilderTypes.SORT_BY_FREQUENCY_LEFT_DEEP_TREE), DEFAULT_TESTING_EVALUATION_MECHANISM_SETTINGS.storage_params) runTest("arrivalRates", [pattern], createTestFile, eval_params)
def googleAmazonLowPatternSearchTest(createTestFile=False): """ This pattern is looking for low prices of Amazon and Google at the same minute. PATTERN AND(AmazonStockPriceUpdate a, GoogleStockPriceUpdate g) WHERE a.PeakPrice <= 73 AND g.PeakPrice <= 525 WITHIN 1 minute """ googleAmazonLowPattern = Pattern( AndOperator(PrimitiveEventStructure("AMZN", "a"), PrimitiveEventStructure("GOOG", "g")), AndCondition( SimpleCondition(Variable("a", lambda x: x["Peak Price"]), relation_op=lambda x: x <= 73), SimpleCondition(Variable("g", lambda x: x["Peak Price"]), relation_op=lambda x: x <= 525) ), timedelta(minutes=1) ) runTest('googleAmazonLow', [googleAmazonLowPattern], createTestFile)
def rootAndInner(createTestFile=False): #similar to leafIsRoot, but the time windows are different pattern1 = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a")), GreaterThanEqCondition(Variable("a", lambda x: x["Peak Price"]), 135), timedelta(minutes=5)) pattern2 = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a"), PrimitiveEventStructure("AMZN", "b"), PrimitiveEventStructure("GOOG", "c")), AndCondition( GreaterThanEqCondition(Variable("a", lambda x: x["Peak Price"]), 135), SmallerThanCondition(Variable("b", lambda x: x["Peak Price"]), Variable("c", lambda x: x["Peak Price"]))), timedelta(minutes=3)) runMultiTest("RootAndInner", [pattern1, pattern2], createTestFile)
def iiRandomPatternSearchTest(createTestFile=False): pattern = Pattern( SeqOperator(PrimitiveEventStructure("MSFT", "a"), PrimitiveEventStructure("DRIV", "b"), PrimitiveEventStructure("ORLY", "c"), PrimitiveEventStructure("CBRL", "d")), AndCondition( SimpleCondition(Variable("a", lambda x: x["Peak Price"]), Variable("b", lambda x: x["Peak Price"]), Variable("c", lambda x: x["Peak Price"]), relation_op=lambda x, y, z: x < y < z), SmallerThanCondition(Variable("c", lambda x: x["Peak Price"]), Variable("d", lambda x: x["Peak Price"]))), timedelta(minutes=3)) selectivityMatrix = [[1.0, 0.9457796098355941, 1.0, 1.0], [0.9457796098355941, 1.0, 0.15989723367389616, 1.0], [1.0, 0.15989723367389616, 1.0, 0.9992557393942864], [1.0, 1.0, 0.9992557393942864, 1.0]] arrivalRates = [ 0.016597077244258872, 0.01454418928322895, 0.013917884481558803, 0.012421711899791231 ] pattern.set_statistics({ StatisticsTypes.SELECTIVITY_MATRIX: selectivityMatrix, StatisticsTypes.ARRIVAL_RATES: arrivalRates }) eval_params = TreeBasedEvaluationMechanismParameters( optimizer_params=StatisticsDeviationAwareOptimizerParameters( tree_plan_params=IterativeImprovementTreePlanBuilderParameters( DEFAULT_TREE_COST_MODEL, 20, IterativeImprovementType.SWAP_BASED, IterativeImprovementInitType.RANDOM), statistics_collector_params=StatisticsCollectorParameters( statistics_types=[ StatisticsTypes.ARRIVAL_RATES, StatisticsTypes.SELECTIVITY_MATRIX ])), storage_params=DEFAULT_TESTING_EVALUATION_MECHANISM_SETTINGS. storage_params) runTest('iiRandom1', [pattern], createTestFile, eval_mechanism_params=eval_params, events=nasdaqEventStream)
def amazonSpecificPatternSearchTest(createTestFile=False): """ This pattern is looking for an amazon stock in peak price of 73. """ amazonSpecificPattern = Pattern( SeqOperator(PrimitiveEventStructure("AMZN", "a")), EqCondition(Variable("a", lambda x: x["Peak Price"]), 73), timedelta(minutes=120) ) runTest('amazonSpecific', [amazonSpecificPattern], createTestFile)
def KC_Specific_Value(createTestFile=False): pattern = Pattern( SeqOperator(KleeneClosureOperator(PrimitiveEventStructure("GOOG", "a"))), AndCondition( SimpleCondition(Variable("a", lambda x: x["Opening Price"]), relation_op=lambda x: x > 0), KCValueCondition(names={'a'}, getattr_func=lambda x: x["Peak Price"], relation_op=lambda x, y: x > y, index=2, value=530.5) ), timedelta(minutes=5) ) runTest("KC_Specific_Value_", [pattern], createTestFile, events=nasdaqEventStreamKC)
def KC_AND(createTestFile=False): """ KC(And([a, b, c])) """ pattern = Pattern( KleeneClosureOperator( AndOperator( PrimitiveEventStructure("GOOG", "a"), PrimitiveEventStructure("GOOG", "b"), PrimitiveEventStructure("GOOG", "c") ), min_size=1, max_size=3 ), AndCondition( SmallerThanCondition(Variable("a", lambda x: x["Peak Price"]), Variable("b", lambda x: x["Peak Price"])), SmallerThanCondition(Variable("b", lambda x: x["Peak Price"]), Variable("c", lambda x: x["Peak Price"])), ), timedelta(minutes=3) ) runTest("KC_AND_", [pattern], createTestFile, events=nasdaqEventStreamKC)
def KC_AND_IndexCondition_02(createTestFile=False): """ KC(And([a, b])) """ pattern = Pattern( KleeneClosureOperator( AndOperator( PrimitiveEventStructure("GOOG", "a"), PrimitiveEventStructure("GOOG", "b") ), min_size=1, max_size=3 ), AndCondition( SmallerThanCondition(Variable("a", lambda x: x["Peak Price"]), Variable("b", lambda x: x["Peak Price"])), KCIndexCondition(names={'a', 'b'}, getattr_func=lambda x: x["Peak Price"], relation_op=lambda x, y: x < y, offset=2), ), timedelta(minutes=3) ) runTest("KC_AND_IndexCondition_02_", [pattern], createTestFile, events=nasdaqEventStreamKC)
def amazonInstablePatternSearchTest(createTestFile=False): """ This pattern is looking for an in-stable day for Amazon. PATTERN SEQ(AmazonStockPriceUpdate x1, AmazonStockPriceUpdate x2, AmazonStockPriceUpdate x3) WHERE x1.LowestPrice <= 75 AND x2.PeakPrice >= 78 AND x3.LowestPrice <= x1.LowestPrice WITHIN 1 day """ amazonInstablePattern = Pattern( SeqOperator(PrimitiveEventStructure("AMZN", "x1"), PrimitiveEventStructure("AMZN", "x2"), PrimitiveEventStructure("AMZN", "x3")), AndCondition( SmallerThanEqCondition(Variable("x1", lambda x: x["Lowest Price"]), 75), GreaterThanEqCondition(Variable("x2", lambda x: x["Peak Price"]), 78), BinaryCondition(Variable("x3", lambda x: x["Lowest Price"]), Variable("x1", lambda x: x["Lowest Price"]), relation_op=lambda x, y: x <= y) ), timedelta(days=1) ) runTest('amazonInstable', [amazonInstablePattern], createTestFile)
def notInTheBeginningShareFullSharing(createTestFile=False): getattr_func = lambda x: x["Opening Price"] pattern1 = Pattern( SeqOperator(NegationOperator(PrimitiveEventStructure("TYP1", "x")), NegationOperator(PrimitiveEventStructure("TYP2", "y")), NegationOperator(PrimitiveEventStructure("TYP3", "z")), PrimitiveEventStructure("AAPL", "a"), PrimitiveEventStructure("AMZN", "b"), PrimitiveEventStructure("GOOG", "c")), AndCondition( GreaterThanCondition(Variable("a", getattr_func), Variable("b", getattr_func)), SmallerThanCondition(Variable("b", getattr_func), Variable("c", getattr_func))), timedelta(minutes=5)) pattern2 = Pattern( SeqOperator(NegationOperator(PrimitiveEventStructure("TYP1", "x")), NegationOperator(PrimitiveEventStructure("TYP2", "y")), PrimitiveEventStructure("AAPL", "a"), PrimitiveEventStructure("AMZN", "b")), GreaterThanCondition(Variable("a", getattr_func), Variable("b", getattr_func)), timedelta(minutes=5)) pattern3 = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a"), PrimitiveEventStructure("AMZN", "b"), PrimitiveEventStructure("GOOG", "c")), AndCondition( GreaterThanCondition(Variable("a", getattr_func), Variable("b", getattr_func)), GreaterThanCondition(Variable("c", getattr_func), Variable("b", getattr_func))), timedelta(minutes=5)) runMultiTest("MultipleNotBeginningShareFullSharing", [pattern1, pattern2, pattern3], createTestFile, subtree_sharing_eval_mechanism_params, expected_file_name="MultipleNotBeginningShare")
def simplePatternSearchTest(createTestFile=False): """ PATTERN SEQ(AppleStockPriceUpdate a, AmazonStockPriceUpdate b, AvidStockPriceUpdate c) WHERE a.OpeningPrice > b.OpeningPrice AND b.OpeningPrice > c.OpeningPrice WITHIN 5 minutes """ pattern = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a"), PrimitiveEventStructure("AMZN", "b"), PrimitiveEventStructure("AVID", "c")), AndCondition( BinaryCondition(Variable("a", lambda x: x["Opening Price"]), Variable("b", lambda x: x["Opening Price"]), relation_op=lambda x, y: x > y), BinaryCondition(Variable("b", lambda x: x["Opening Price"]), Variable("c", lambda x: x["Opening Price"]), relation_op=lambda x, y: x > y) ), timedelta(minutes=5) ) runTest("simple", [pattern], createTestFile)
def oneArgumentsearchTest(createTestFile=False): pattern = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a")), GreaterThanCondition(Variable("a", lambda x: x["Opening Price"]), 136.27), timedelta(minutes=120), confidence=0.875, ) runTest("oneProb", [pattern], createTestFile, eventStream=nasdaqEventStreamP)
def googleAmazonLowPatternSearchTest(createTestFile=False, eval_mechanism_params=DEFAULT_TESTING_EVALUATION_MECHANISM_SETTINGS, test_name = "googleAmazonLow"): """ This pattern is looking for low prices of Amazon and Google at the same minute. PATTERN AND(AmazonStockPriceUpdate a, GoogleStockPriceUpdate g) WHERE a.PeakPrice <= 73 AND g.PeakPrice <= 525 WITHIN 1 minute """ googleAmazonLowPattern = Pattern( AndOperator(PrimitiveEventStructure("AMZN", "a"), PrimitiveEventStructure("GOOG", "g")), AndCondition( SimpleCondition(Variable("a", lambda x: x["Peak Price"]), relation_op=lambda x: x <= 73), SimpleCondition(Variable("g", lambda x: x["Peak Price"]), relation_op=lambda x: x <= 525) ), timedelta(minutes=1) ) runTest(test_name, [googleAmazonLowPattern], createTestFile, eval_mechanism_params)
def structuralTest2(): """ KC(a) """ structural_test_pattern = Pattern( KleeneClosureOperator(PrimitiveEventStructure("GOOG", "a")), SimpleCondition(Variable("a", lambda x: x["Opening Price"]), relation_op=lambda x: x > 135), timedelta(minutes=3) ) expected_result = ('KC', 'a') runStructuralTest('structuralTest2', [structural_test_pattern], expected_result)
def hierarchyPatternSearchTest(createTestFile=False): """ The following pattern is looking for Amazon < Apple < Google cases in one minute windows. PATTERN AND(AmazonStockPriceUpdate a, AppleStockPriceUpdate b, GoogleStockPriceUpdate c) WHERE a.PeakPrice < b.PeakPrice AND b.PeakPrice < c.PeakPrice WITHIN 1 minute """ hierarchyPattern = Pattern( AndOperator(PrimitiveEventStructure("AMZN", "a"), PrimitiveEventStructure("AAPL", "b"), PrimitiveEventStructure("GOOG", "c")), AndCondition( BinaryCondition(Variable("a", lambda x: x["Peak Price"]), Variable("b", lambda x: x["Peak Price"]), relation_op=lambda x, y: x < y), BinaryCondition(Variable("b", lambda x: x["Peak Price"]), Variable("c", lambda x: x["Peak Price"]), relation_op=lambda x, y: x < y) ), timedelta(minutes=1) ) runTest('hierarchy', [hierarchyPattern], createTestFile)
def googleAscendPatternSearchTest(createTestFile=False): """ This pattern is looking for a short ascend in the Google peak prices. PATTERN SEQ(GoogleStockPriceUpdate a, GoogleStockPriceUpdate b, GoogleStockPriceUpdate c) WHERE a.PeakPrice < b.PeakPrice AND b.PeakPrice < c.PeakPrice WITHIN 3 minutes """ googleAscendPattern = Pattern( SeqOperator(PrimitiveEventStructure("GOOG", "a"), PrimitiveEventStructure("GOOG", "b"), PrimitiveEventStructure("GOOG", "c")), AndCondition( BinaryCondition(Variable("a", lambda x: x["Peak Price"]), Variable("b", lambda x: x["Peak Price"]), relation_op=lambda x, y: x < y), BinaryCondition(Variable("b", lambda x: x["Peak Price"]), Variable("c", lambda x: x["Peak Price"]), relation_op=lambda x, y: x < y) ), timedelta(minutes=3) ) runTest('googleAscend', [googleAscendPattern], createTestFile)
def leafIsRootFullSharing(createTestFile=False): pattern1 = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a")), GreaterThanCondition(Variable("a", lambda x: x["Peak Price"]), 135), timedelta(minutes=5)) pattern2 = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a"), NegationOperator(PrimitiveEventStructure("AMZN", "b")), PrimitiveEventStructure("GOOG", "c")), AndCondition( GreaterThanCondition(Variable("a", lambda x: x["Opening Price"]), Variable("b", lambda x: x["Opening Price"])), SmallerThanCondition(Variable("b", lambda x: x["Opening Price"]), Variable("c", lambda x: x["Opening Price"]))), timedelta(minutes=5)) runMultiTest("FirstMultiPatternFullSharing", [pattern1, pattern2], createTestFile, subtree_sharing_eval_mechanism_params, expected_file_name="FirstMultiPattern")
def frequencyTailoredPatternSearchTest(createTestFile=False): pattern = Pattern( SeqOperator(PrimitiveEventStructure("DRIV", "a"), PrimitiveEventStructure("MSFT", "b"), PrimitiveEventStructure("CBRL", "c")), AndCondition( GreaterThanCondition(Variable("a", lambda x: x["Opening Price"]), Variable("b", lambda x: x["Opening Price"])), GreaterThanCondition(Variable("b", lambda x: x["Opening Price"]), Variable("c", lambda x: x["Opening Price"]))), timedelta(minutes=360)) frequencyDict = {"MSFT": 256, "DRIV": 257, "CBRL": 1} pattern.set_statistics(StatisticsTypes.FREQUENCY_DICT, frequencyDict) eval_params = TreeBasedEvaluationMechanismParameters( TreePlanBuilderParameters( TreePlanBuilderTypes.SORT_BY_FREQUENCY_LEFT_DEEP_TREE), DEFAULT_TESTING_EVALUATION_MECHANISM_SETTINGS.storage_params) runTest('frequencyTailored1', [pattern], createTestFile, eval_mechanism_params=eval_params, events=nasdaqEventStream)
def amazonSpecificPatternSearchTest(createTestFile=False, eval_mechanism_params=DEFAULT_TESTING_EVALUATION_MECHANISM_SETTINGS, test_name = "amazonSpecific"): """ This pattern is looking for an amazon stock in peak price of 73. """ amazonSpecificPattern = Pattern( SeqOperator(PrimitiveEventStructure("AMZN", "a")), EqCondition(Variable("a", lambda x: x["Peak Price"]), 73), timedelta(minutes=120) ) runTest(test_name, [amazonSpecificPattern], createTestFile, eval_mechanism_params)
def sortedStorageTest(createTestFile=False): pattern = Pattern( AndOperator(PrimitiveEventStructure("DRIV", "a"), PrimitiveEventStructure("MSFT", "b"), PrimitiveEventStructure("CBRL", "c")), AndCondition( GreaterThanCondition(Variable("a", lambda x: x["Opening Price"]), Variable("b", lambda x: x["Opening Price"])), GreaterThanCondition(Variable("b", lambda x: x["Opening Price"]), Variable("c", lambda x: x["Opening Price"])), ), timedelta(minutes=360), ) storage_params = TreeStorageParameters(True, clean_up_interval=500) eval_params = TreeBasedEvaluationMechanismParameters( DEFAULT_TESTING_EVALUATION_MECHANISM_SETTINGS.tree_plan_params, storage_params) runTest("sortedStorageTest", [pattern], createTestFile, eval_mechanism_params=eval_params, events=nasdaqEventStream)
def nonsensePatternSearchTest(createTestFile=False, eval_mechanism_params=DEFAULT_TESTING_EVALUATION_MECHANISM_SETTINGS, test_name = "nonsense"): """ This pattern is looking for something that does not make sense. PATTERN AND(AmazonStockPriceUpdate a, AvidStockPriceUpdate b, AppleStockPriceUpdate c) WHERE a.PeakPrice < b.PeakPrice AND b.PeakPrice < c.PeakPrice AND c.PeakPrice < a.PeakPrice """ nonsensePattern = Pattern( AndOperator(PrimitiveEventStructure("AMZN", "a"), PrimitiveEventStructure("AVID", "b"), PrimitiveEventStructure("AAPL", "c")), AndCondition( BinaryCondition(Variable("a", lambda x: x["Peak Price"]), Variable("b", lambda x: x["Peak Price"]), relation_op=lambda x, y: x < y), BinaryCondition(Variable("b", lambda x: x["Peak Price"]), Variable("c", lambda x: x["Peak Price"]), relation_op=lambda x, y: x < y), BinaryCondition(Variable("c", lambda x: x["Peak Price"]), Variable("a", lambda x: x["Peak Price"]), relation_op=lambda x, y: x < y) ), timedelta(minutes=1) ) runTest(test_name, [nonsensePattern], createTestFile, eval_mechanism_params)
def samePatternDifferentTimeStampsFullSharing(createTestFile=False): pattern1 = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a"), PrimitiveEventStructure("AMZN", "b"), PrimitiveEventStructure("GOOG", "c")), AndCondition( GreaterThanEqCondition(Variable("a", lambda x: x["Peak Price"]), 135), SmallerThanCondition(Variable("b", lambda x: x["Peak Price"]), Variable("c", lambda x: x["Peak Price"]))), timedelta(minutes=5)) pattern2 = Pattern( SeqOperator(PrimitiveEventStructure("AAPL", "a"), PrimitiveEventStructure("AMZN", "b"), PrimitiveEventStructure("GOOG", "c")), AndCondition( GreaterThanEqCondition(Variable("a", lambda x: x["Peak Price"]), 135), SmallerThanCondition(Variable("b", lambda x: x["Peak Price"]), Variable("c", lambda x: x["Peak Price"]))), timedelta(minutes=2)) runMultiTest("DifferentTimeStampFullSharing", [pattern1, pattern2], createTestFile, subtree_sharing_eval_mechanism_params, expected_file_name="DifferentTimeStamp")