New issue 473 by frantajosh: profile ExecutionPerformance unit test
http://code.google.com/p/tradelink/issues/detail?id=473
to see why executions are slower than rest of the simulation.
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
here is my test, which I'm profiling using EQATEC free .net profiler
class Program
{
static int tickcount = 0;
static long lasttime = 0;
const double EXPECTEX = .8;
static HistSim h;
static void Main(string[] args)
{
h = new
HistSim(@"C:\Users\jfranta\Desktop\TLS\TradeLinkTests\");
h.GotTick += new TradeLink.API.TickDelegate(execute_GotTick);
h.SimBroker.GotFill += new
TradeLink.API.FillDelegate(SimBroker_GotFill);
for (int i = 0; i < 1000; i++)
GO();
}
static void GO()
{
h.Reset();
h.Initialize();
System.Threading.Thread.Sleep(1000);
tickcount = 0;
lasttime = 0;
fillcount = 0;
DateTime start = DateTime.Now;
h.PlayTo(HistSim.ENDSIM);
double time = DateTime.Now.Subtract(start).TotalSeconds;
Console.WriteLine("Execution runtime: " + time.ToString("N2")
+ "sec,
versus: " + EXPECTEX + "sec expected.");
Console.WriteLine("Execution " + ((double)tickcount /
time).ToString("N0") + " ticks/sec. " + ((double)fillcount /
time).ToString("N0") +
" fills/sec");
h.Stop();
}
const double EXPECT2SYMTIME = 1.5;
const int desiredfills = 1000;
static int fillcount = 0;
static List<string> syms = new List<string>();
static void SimBroker_GotFill(TradeLink.API.Trade t)
{
fillcount++;
}
static void execute_GotTick(TradeLink.API.Tick t)
{
tickcount++;
// generate fills periodically
if (fillcount >= desiredfills) return;
if (tickcount % 50 == 0)
{
bool side = fillcount % 2 == 0;
h.SimBroker.sendOrder(new MarketOrder(t.symbol, side, 100));
(No comment was entered for this change.)
Attachments:
TL473.jpg 48.0 KB
Comment #3 on issue 473 by frantajosh: profile ExecutionPerformance unit
test
http://code.google.com/p/tradelink/issues/detail?id=473
reworked account.Equals call to use faster comparison here :
http://blogs.msdn.com/noahc/archive/2007/06/29/string-equals-performance-
comparison.aspx
got around 20% increase. rest of increase will need to come from
refactoring the
process.