/// <summary> /// Initializes a new instance of the <see cref="LiveTestTest"/> class. /// </summary> public LiveTestTest() { this.testApplication = Substitute.For <TestApplication>(); this.initializationManager = Substitute.For <InitializationManager>(Substitute.For <InitializationActionDiscoverer>(), Substitute.For <InitializationActionExecutor>()); LiveTestBase.TestApplicationManager.StartApplication(Arg.Is <TestApplicationHost>(host => (host.ApplicationId == "Sitecore.LiveTesting.Default") && (host.VirtualPath == "/") && (host.PhysicalPath == "..\\Website"))).Returns(this.testApplication); this.realTest = new TestWithCustomInstantiation(this.initializationManager); }
/// <summary> /// Initializes a new instance of the <see cref="LiveTestTest"/> class. /// </summary> public LiveTestTest() { this.testApplication = Substitute.For<TestApplication>(); this.initializationManager = Substitute.For<InitializationManager>(Substitute.For<InitializationActionDiscoverer>(), Substitute.For<InitializationActionExecutor>()); LiveTestBase.TestApplicationManager.StartApplication(Arg.Is<TestApplicationHost>(host => (host.ApplicationId == "Sitecore.LiveTesting.Default") && (host.VirtualPath == "/") && (host.PhysicalPath == "..\\Website"))).Returns(this.testApplication); this.realTest = new TestWithCustomInstantiation(this.initializationManager); }
/// <summary> /// Creates an instance of the test class. /// </summary> /// <param name="type">Type of the test to instantiate.</param> /// <param name="arguments">The arguments.</param> /// <returns>An instance of test class.</returns> public static new LiveTest Instantiate(Type type, params object[] arguments) { return(LiveTest.Intercept(type, new LiveTestWithArgumentSubstitution())); }
/// <summary> /// Creates uninitialized test class instance. /// </summary> /// <param name="testType">The type of the test.</param> /// <returns>The test class instance.</returns> public static LiveTest CreateUninitializedTestInstance(Type testType) { return(LiveTest.CreateUninitializedInstance(testType)); }
static void Main(string[] args) { //PARAMS LiveTestRequest request = new LiveTestRequest { TradingPairs = new List <string> { "ethbtc", "ltcbtc", "bnbbtc", "neobtc", "bccbtc", "gasbtc", "wtcbtc", "qtumbtc", "yoyobtc", "zrxbtc", "funbtc", "snmbtc", "iotabtc", "xvgbtc", "eosbtc", "sntbtc", "etcbtc", "engbtc", "zecbtc", "dashbtc", "icnbtc", "btgbtc", "trxbtc", "xrpbtc", "enjbtc", "storjbtc", "venbtc", "kmdbtc", "nulsbtc", "rdnbtc", "xmrbtc", "batbtc", "arnbtc", "gvtbtc", "cdtbtc", "gxsbtc", "poebtc", "fuelbtc", "manabtc", "dgdbtc", "adxbtc", "cmtbtc", "xlmbtc", "tnbbtc", "gtobtc", "icxbtc", "ostbtc", "elfbtc", "aionbtc", "edobtc", "navbtc", "lunbtc", "trigbtc", "vibebtc", "iostbtc", "chatbtc", "steembtc", "nanobtc", "viabtc", "blzbtc", "aebtc", "rpxbtc", "ncashbtc", "poabtc", "zilbtc", "ontbtc", "stormbtc", "xembtc", "wanbtc", "wprbtc", "qlcbtc", "sysbtc", "grsbtc", "cloakbtc", "gntbtc", "loombtc", "bcnbtc", "repbtc", "tusdbtc", "zenbtc", "skybtc", "cvcbtc", "thetabtc", "iotxbtc", "qkcbtc", "agibtc", "nxsbtc", "databtc", "scbtc", "npxsbtc", "keybtc", "nasbtc", "mftbtc", "dentbtc", "ardrbtc", "hotbtc", "vetbtc", "dockbtc", "polybtc", }, From = new DateTime(2018, 08, 30), To = new DateTime(2018, 08, 30), Interval = TimeInterval.Minutes_15, Algorthm = TradingAlgorthm.Macd, StartAmount = 1m, TradingAmount = 0.1m, OrderType = OrderType.LIMIT }; //to start back testing, load the first 100 candles to build the relavent indicators //then loop though the remianing candles to simulate live trade streaming. //the system can then make decisions at which points to buy and sell (simple SMA strategy to start with). //once the processing has been completed the result are displayed, each trade with buy price and sell price and percentage profit. var backTest = new LiveTest(request); backTest.Log += LogTrade; //TODO make this process ASYNC. Console.WriteLine($"Starting Amount: {request.StartAmount}btc"); backTest.StartTrading(); backTest.FinishTrading(); Console.WriteLine($"StartTime: {backTest.StartTime} FinishTime: {backTest.FinishTime}"); DisplayTrades(request.TradingResults); Console.WriteLine($"BTC Finishing Amount: {request.FinalAmount}btc"); Console.WriteLine($"Total PNL - {request.TradingResults.Sum(x => x.Pnl)}"); Console.WriteLine($"Total % profit - {CalculatePercent(request)}"); Console.ReadKey(); }
/// <summary> /// Instantiates the test class. /// </summary> /// <param name="testType">Type of the test class.</param> /// <param name="arguments">The arguments.</param> /// <returns>Instance of the test class.</returns> public static new LiveTest Instantiate(Type testType, params object[] arguments) { return(LiveTest.Intercept(testType, (LiveTest)Activator.CreateInstance(testType))); }