private void InitializeProcessors() { _processorsManager.RegisterProcessor(new ContractsProcessor(Client, "ES"), cbContract); _priceProcessor = _processorsManager.RegisterProcessor(new PriceProcessor(Client), lbPrice); _ordersProcessor = _processorsManager.RegisterProcessor(new OrdersProcessor(Client), lbOrders); _positionsProcessor = _processorsManager.RegisterProcessor(new PositionsProcessor(Client), lbPositions); }
public void AfterProcessing_ExtremumObjectHasProperlyAssignedLaterChange10() { //Arrange Mock <IProcessManager> mockedManager = new Mock <IProcessManager>(); Mock <IExtremumProcessor> mockedProcessor = new Mock <IExtremumProcessor>(); DataSet dataSet4 = utf.getDataSetWithQuotation(4, 1.0915, 1.0916, 1.09111, 1.09112, 1392); mockedManager.Setup(m => m.GetDataSet(4)).Returns(dataSet4); mockedProcessor.Setup(p => p.IsExtremum(dataSet4, ExtremumType.TroughByLow)).Returns(true); mockedProcessor.Setup(p => p.CalculateLaterChange(It.IsAny <Extremum>(), 10)).Returns(1.23); //Act PriceProcessor processor = new PriceProcessor(mockedManager.Object); processor.InjectExtremumProcessor(mockedProcessor.Object); processor.Process(dataSet4); //Assert double expectedValue = 1.23; Price price = dataSet4.GetPrice(); Extremum extremum = price.GetExtremum(ExtremumType.TroughByLow); var difference = (extremum.LaterChange10 - expectedValue); Assert.IsTrue(Math.Abs(difference) < MAX_DOUBLE_COMPARISON_DIFFERENCE); }
public void AfterProcessing_PriceObjectIsSet_IfQuotationIsNotNull() { //Arrange Mock <IProcessManager> mockedManager = new Mock <IProcessManager>(); DataSet dataSet1 = utf.getDataSet(1); DataSet dataSet2 = utf.getDataSetWithQuotation(2, 1.09191, 1.09218, 1.09186, 1.09194, 1411); mockedManager.Setup(m => m.GetDataSet(1)).Returns(dataSet1); mockedManager.Setup(m => m.GetDataSet(2)).Returns(dataSet2); //Act PriceProcessor processor = new PriceProcessor(mockedManager.Object); processor.Process(dataSet2); //Assert Assert.IsNotNull(dataSet2.GetPrice()); }
public static async Task Main(string[] args) { ApiHelper.InitializeClient(); await PriceProcessor.LoadData(); Console.WriteLine($"{"Breachstone",35}{"Price",10}\n======================================================================"); foreach (var Listing in PriceProcessor.Stones) { Console.WriteLine($"{Listing.CurrencyTypeName, 35} {Listing.chaosEquivalent, 10} chaos"); } List <Tuple <string, float> > profits = PriceProcessor.ProfitCalc(); Console.WriteLine($"\n\n{"Breachstone",25} {"Profit to Flip"}\n========================================================"); foreach (var listing in profits) { Console.WriteLine($"{listing.Item1,25} {listing.Item2,10:F2} chaos"); } Console.ReadLine(); }
public void AfterProcessing_DeltaCloseIsZero_IfThisIsItemIndexOne() { //Arrange Mock <IProcessManager> mockedManager = new Mock <IProcessManager>(); DataSet dataSet1 = utf.getDataSetWithQuotation(1, 1.09191, 1.09218, 1.09186, 1.09194, 1411); DataSet dataSet2 = utf.getDataSetWithQuotation(2, 1.09193, 1.09256, 1.09165, 1.09177, 1819); mockedManager.Setup(m => m.GetDataSet(1)).Returns(dataSet1); mockedManager.Setup(m => m.GetDataSet(2)).Returns(dataSet2); //Act PriceProcessor processor = new PriceProcessor(mockedManager.Object); processor.Process(dataSet1); //Assert var expected = 0; var actual = dataSet1.GetPrice().CloseDelta; Assert.AreEqual(expected, actual); }
public void AfterProcessing_DeltaCloseIsZero_IfPreviousCloseWasTheSameAsCurrentOne() { //Arrange Mock <IProcessManager> mockedManager = new Mock <IProcessManager>(); DataSet dataSet2 = utf.getDataSetWithQuotation(2, 1.09191, 1.09218, 1.09186, 1.09194, 1411); DataSet dataSet3 = utf.getDataSetWithQuotation(3, 1.09193, 1.09256, 1.09165, 1.09194, 1819); mockedManager.Setup(m => m.GetDataSet(2)).Returns(dataSet2); mockedManager.Setup(m => m.GetDataSet(3)).Returns(dataSet3); //Act PriceProcessor processor = new PriceProcessor(mockedManager.Object); processor.Process(dataSet3); //Assert var expected = 0; var actual = dataSet3.GetPrice().CloseDelta; Assert.AreEqual(expected, actual); }
public void AfterProcessing_PriceHasTroughByLow_IfExtremaProcessorReturnsTrueForIsExtrema() { //Arrange Mock <IProcessManager> mockedManager = new Mock <IProcessManager>(); Mock <IExtremumProcessor> mockedProcessor = new Mock <IExtremumProcessor>(); DataSet dataSet4 = utf.getDataSetWithQuotation(4, 1.0915, 1.0916, 1.09111, 1.09112, 1392); mockedManager.Setup(m => m.GetDataSet(4)).Returns(dataSet4); mockedProcessor.Setup(p => p.IsExtremum(dataSet4, ExtremumType.TroughByLow)).Returns(true); //Act PriceProcessor processor = new PriceProcessor(mockedManager.Object); processor.InjectExtremumProcessor(mockedProcessor.Object); processor.Process(dataSet4); //Assert Price price = dataSet4.GetPrice(); Assert.IsNotNull(price.GetExtremum(ExtremumType.TroughByLow)); }
public void AfterProcessing_IfThereIsNewPeakByCloseExtremum_ItHasIsUpdatedFlagSetToTrue() { //Arrange Mock <IProcessManager> mockedManager = new Mock <IProcessManager>(); Mock <IExtremumProcessor> mockedProcessor = new Mock <IExtremumProcessor>(); DataSet dataSet4 = utf.getDataSetWithQuotation(4, 1.0915, 1.0916, 1.09111, 1.09112, 1392); mockedManager.Setup(m => m.GetDataSet(4)).Returns(dataSet4); mockedProcessor.Setup(p => p.IsExtremum(dataSet4, ExtremumType.PeakByClose)).Returns(true); //Act PriceProcessor processor = new PriceProcessor(mockedManager.Object); processor.InjectExtremumProcessor(mockedProcessor.Object); processor.Process(dataSet4); //Assert Price price = dataSet4.GetPrice(); Extremum extremum = price.GetExtremum(ExtremumType.PeakByClose); Assert.IsTrue(extremum.Updated); }
public void AfterProcessing_DeltaCloseIsProperlyCalculated_IfPreviousCloseWasHigher() { //Arrange Mock <IProcessManager> mockedManager = new Mock <IProcessManager>(); DataSet dataSet2 = utf.getDataSetWithQuotation(2, 1.09191, 1.09218, 1.09186, 1.09194, 1411); DataSet dataSet3 = utf.getDataSetWithQuotation(3, 1.09193, 1.09256, 1.09165, 1.09213, 1819); mockedManager.Setup(m => m.GetDataSet(2)).Returns(dataSet2); mockedManager.Setup(m => m.GetDataSet(3)).Returns(dataSet3); //Act PriceProcessor processor = new PriceProcessor(mockedManager.Object); processor.Process(dataSet3); //Assert var expected = 0.00019; var actual = dataSet3.GetPrice().CloseDelta; var difference = Math.Abs(actual - expected); Assert.IsTrue(difference < MAX_DOUBLE_COMPARISON_DIFFERENCE); }
public void AfterProcessing_ExtremumObjectHasProperlyAssignedLaterCounter() { //Arrange Mock <IProcessManager> mockedManager = new Mock <IProcessManager>(); Mock <IExtremumProcessor> mockedProcessor = new Mock <IExtremumProcessor>(); DataSet dataSet4 = utf.getDataSetWithQuotation(4, 1.0915, 1.0916, 1.09111, 1.09112, 1392); mockedManager.Setup(m => m.GetDataSet(4)).Returns(dataSet4); mockedProcessor.Setup(p => p.IsExtremum(dataSet4, ExtremumType.TroughByLow)).Returns(true); mockedProcessor.Setup(p => p.CalculateLaterCounter(It.IsAny <Extremum>())).Returns(4); //Act PriceProcessor processor = new PriceProcessor(mockedManager.Object); processor.InjectExtremumProcessor(mockedProcessor.Object); processor.Process(dataSet4); //Assert int expectedValue = 4; Price price = dataSet4.GetPrice(); Extremum extremum = price.GetExtremum(ExtremumType.TroughByLow); Assert.AreEqual(expectedValue, extremum.LaterCounter); }