Ejemplo n.º 1
0
    private static void perfRun(int runNum)
    {
        long milliseconds = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
        long start        = milliseconds;

        init();
        long buyCost  = 0;
        long sellCost = 0;

        for (int i = 0; i < NUM_RECORDS; i++)
        {
            CSMemoryTrade trade = getATrade(i);

            if (trade.getSide() == 'B')
            {
                buyCost += (trade.getPrice() * trade.getQuantity());
            }
            else
            {
                sellCost += (trade.getPrice() * trade.getQuantity());
            }
        }

        milliseconds = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
        long end      = milliseconds;
        long duration = end - start;

        System.Console.Write(runNum + " - duration " + duration + "ms\n");
        System.Console.Write("buyCost = " + buyCost + " sellCost = " + sellCost + "\n");
    }
Ejemplo n.º 2
0
    static void Main()
    {
        trades = new CSMemoryTrade[NUM_RECORDS];
        for (int i = 0; i < NUM_RECORDS; i++){
            trades[i] = new CSMemoryTrade();
        }

        for (int i = 0; i < 5; i++){
            perfRun(i);
        }
    }
Ejemplo n.º 3
0
    static void Main()
    {
        trades = new CSMemoryTrade[NUM_RECORDS];
        for (int i = 0; i < NUM_RECORDS; i++)
        {
            trades[i] = new CSMemoryTrade();
        }

        for (int i = 0; i < 5; i++)
        {
            perfRun(i);
        }
    }
Ejemplo n.º 4
0
    public static void init()
    {
        trades = new CSMemoryTrade[NUM_RECORDS];
        for (int i = 0; i < NUM_RECORDS; i++){
            CSMemoryTrade trade = new CSMemoryTrade();
            trades[i] = trade;

            trade.setTradeId(i);
            trade.setClientId(1);
            trade.setVenueCode(123);
            trade.setInstrumentCode(321);

            trade.setPrice(i);
            trade.setQuantity(i);

            trade.setSide((i & 1) == 0 ? 'B' : 'S');
        }
    }
Ejemplo n.º 5
0
    public static void init()
    {
        trades = new CSMemoryTrade[NUM_RECORDS];
        for (int i = 0; i < NUM_RECORDS; i++)
        {
            CSMemoryTrade trade = new CSMemoryTrade();
            trades[i] = trade;

            trade.setTradeId(i);
            trade.setClientId(1);
            trade.setVenueCode(123);
            trade.setInstrumentCode(321);

            trade.setPrice(i);
            trade.setQuantity(i);

            trade.setSide((i & 1) == 0 ? 'B' : 'S');
        }
    }