Execution speed concerns
Execution speed concerns
13 Nov 2012, 01:45
Hello,
I ran a few test to measure the execution times of my trades.
I coded a small algo (see below) that writes the execution speeds into a logfile.
I ran the algo on my VPS and my home computer.
The log file from my VPS (quadcore, 4GB of RAM, windows server 2008 R2, ping to the proxyserver 4ms)
Server Time: 11/13/2012 1:11:06 AM Execution Time:1179
Server Time: 11/13/2012 1:11:09 AM Execution Time:1094
Server Time: 11/13/2012 1:11:22 AM Execution Time:1754
Server Time: 11/13/2012 1:11:28 AM Execution Time:849
Server Time: 11/13/2012 1:11:42 AM Execution Time:896
Server Time: 11/13/2012 1:11:55 AM Execution Time:1209
Server Time: 11/13/2012 1:12:01 AM Execution Time:1316
Server Time: 11/13/2012 1:12:14 AM Execution Time:814
Server Time: 11/13/2012 1:12:19 AM Execution Time:912
Server Time: 11/13/2012 1:12:31 AM Execution Time:1059
Server Time: 11/13/2012 1:13:02 AM Execution Time:1329
Server Time: 11/13/2012 1:13:18 AM Execution Time:1753
Server Time: 11/13/2012 1:13:21 AM Execution Time:1263
Server Time: 11/13/2012 1:13:36 AM Execution Time:3727
Server Time: 11/13/2012 1:14:00 AM Execution Time:2899
Server Time: 11/13/2012 1:14:13 AM Execution Time:1897
Server Time: 11/13/2012 1:14:18 AM Execution Time:1567
Server Time: 11/13/2012 1:14:21 AM Execution Time:1280
Server Time: 11/13/2012 1:14:25 AM Execution Time:793
Server Time: 11/13/2012 1:14:44 AM Execution Time:1725
Server Time: 11/13/2012 1:15:06 AM Execution Time:6920
Server Time: 11/13/2012 1:15:51 AM Execution Time:4716
Server Time: 11/13/2012 1:16:01 AM Execution Time:1103
Server Time: 11/13/2012 1:16:05 AM Execution Time:2308
Server Time: 11/13/2012 1:16:09 AM Execution Time:1069
Server Time: 11/13/2012 1:16:11 AM Execution Time:960
Server Time: 11/13/2012 1:16:14 AM Execution Time:1545
Server Time: 11/13/2012 1:16:19 AM Execution Time:1090
Server Time: 11/13/2012 1:16:21 AM Execution Time:1066
Server Time: 11/13/2012 1:16:23 AM Execution Time:1188
Server Time: 11/13/2012 1:16:28 AM Execution Time:1112
Server Time: 11/13/2012 1:16:39 AM Execution Time:1065
Server Time: 11/13/2012 1:17:09 AM Execution Time:11240
Server Time: 11/13/2012 1:17:15 AM Execution Time:3253
Server Time: 11/13/2012 1:17:17 AM Execution Time:880
Server Time: 11/13/2012 1:17:37 AM Execution Time:852
Server Time: 11/13/2012 1:17:44 AM Execution Time:2235
Server Time: 11/13/2012 1:18:36 AM Execution Time:1683
Server Time: 11/13/2012 1:18:45 AM Execution Time:1604
Server Time: 11/13/2012 1:18:50 AM Execution Time:2776
Server Time: 11/13/2012 1:18:55 AM Execution Time:946
Server Time: 11/13/2012 1:18:58 AM Execution Time:1746
Server Time: 11/13/2012 1:19:06 AM Execution Time:1663
Log file from my home computer (quadcore, 4GB RAM, windows 7 Ultimate, Ping to proxyserver 312ms)
Server Time: 11/13/2012 1:12:31 AM Execution Time:995
Server Time: 11/13/2012 1:13:02 AM Execution Time:978
Server Time: 11/13/2012 1:13:06 AM Execution Time:961
Server Time: 11/13/2012 1:13:18 AM Execution Time:1007
Server Time: 11/13/2012 1:13:20 AM Execution Time:953
Server Time: 11/13/2012 1:13:33 AM Execution Time:973
Server Time: 11/13/2012 1:13:35 AM Execution Time:721
Server Time: 11/13/2012 1:13:59 AM Execution Time:1052
Server Time: 11/13/2012 1:14:12 AM Execution Time:944
Server Time: 11/13/2012 1:14:17 AM Execution Time:963
Server Time: 11/13/2012 1:14:20 AM Execution Time:1000
Server Time: 11/13/2012 1:14:25 AM Execution Time:980
Server Time: 11/13/2012 1:14:44 AM Execution Time:973
Server Time: 11/13/2012 1:15:01 AM Execution Time:962
Server Time: 11/13/2012 1:15:03 AM Execution Time:974
Server Time: 11/13/2012 1:15:05 AM Execution Time:1001
Server Time: 11/13/2012 1:15:08 AM Execution Time:961
Server Time: 11/13/2012 1:15:12 AM Execution Time:985
Server Time: 11/13/2012 1:15:47 AM Execution Time:1020
Server Time: 11/13/2012 1:15:50 AM Execution Time:969
Server Time: 11/13/2012 1:16:01 AM Execution Time:1035
Server Time: 11/13/2012 1:16:03 AM Execution Time:1002
Server Time: 11/13/2012 1:16:06 AM Execution Time:972
Server Time: 11/13/2012 1:16:09 AM Execution Time:975
Server Time: 11/13/2012 1:16:13 AM Execution Time:985
Server Time: 11/13/2012 1:16:19 AM Execution Time:966
Server Time: 11/13/2012 1:16:21 AM Execution Time:1026
Server Time: 11/13/2012 1:16:24 AM Execution Time:974
Server Time: 11/13/2012 1:16:28 AM Execution Time:1000
Server Time: 11/13/2012 1:16:39 AM Execution Time:987
Server Time: 11/13/2012 1:16:59 AM Execution Time:1030
Server Time: 11/13/2012 1:17:03 AM Execution Time:999
Server Time: 11/13/2012 1:17:08 AM Execution Time:985
Server Time: 11/13/2012 1:17:13 AM Execution Time:985
Server Time: 11/13/2012 1:17:16 AM Execution Time:975
Server Time: 11/13/2012 1:17:38 AM Execution Time:985
Server Time: 11/13/2012 1:17:43 AM Execution Time:978
Server Time: 11/13/2012 1:18:36 AM Execution Time:1001
Server Time: 11/13/2012 1:18:42 AM Execution Time:1006
Server Time: 11/13/2012 1:18:45 AM Execution Time:987
Server Time: 11/13/2012 1:18:48 AM Execution Time:979
Server Time: 11/13/2012 1:18:55 AM Execution Time:993
Server Time: 11/13/2012 1:19:06 AM Execution Time:973
Server Time: 11/13/2012 1:24:52 AM Execution Time:1004
Server Time: 11/13/2012 1:24:58 AM Execution Time:1021
using System; using System.Diagnostics; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.Indicators; using System.IO; namespace cAlgo.Robots { [Robot] public class Executiontestlogfile : Robot { [Parameter(DefaultValue = 1000, MinValue = 0)] public int Volume { get; set; } StreamWriter _fileWriter; private Position position; int counter = 0; Stopwatch stopwatch = new Stopwatch(); protected override void OnStart() { var desktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);//getting location of user's Desktop folder var filePath = Path.Combine(desktopFolder, "ExecutionTime.txt"); _fileWriter = File.AppendText(filePath);//creating file _fileWriter.AutoFlush = true;//file will be saved on each change } protected override void OnTick() { if (Trade.IsExecuting) return; if (position == null) { stopwatch.Start(); Trade.CreateBuyMarketOrder(Symbol, Volume); } } protected override void OnPositionOpened(Position openedPosition) { stopwatch.Stop(); string Code = " " + Convert.ToString(stopwatch.ElapsedMilliseconds); ChartObjects.DrawText("Labels", "Execution: " , StaticPosition.BottomLeft, Colors.Blue); ChartObjects.DrawText("Code", Code, StaticPosition.BottomLeft, Colors.LimeGreen); Trade.Close(openedPosition); _fileWriter.WriteLine("Server Time: " + Server.Time + " Execution Time: " + Code); } protected override void OnPositionClosed(Position position) { position = null; stopwatch.Reset(); } } }