internal void Add(Quote quote) { if (prev == null) { prev = quote; return; } DeltaAsk = (quote.Ask * 100000 - prev.Ask * 100000) / 10; DeltaBid = (quote.Bid * 100000 - prev.Bid * 100000) / 10; MaxDown = Math.Min(Math.Min(DeltaAsk, DeltaBid), MaxDown); MaxUp = Math.Max(Math.Max(DeltaAsk, DeltaBid), MaxUp); prev = quote; }
static void client_Advise(object sender, DdeAdviseEventArgs e) { Quote quote = new Quote(e.Text); beat.Add(quote); string log = string.Format("{0} {1} {2} {3} {4}", e.Text, beat.DeltaBid, beat.DeltaAsk, beat.MaxUp, beat.MaxDown); writer.WriteLog(log); //Console.WriteLine("Bid: {0} Ask: {1} Spread : {2}", quote.Bid, quote.Ask, quote.Spread); Console.WriteLine(beat.DeltaBid > 0 ? "CALL" : "PUT"); Console.WriteLine("Delta Bid : {0}, Ask : {1}", beat.DeltaBid, beat.DeltaAsk); Console.WriteLine("Max Up : {0}, Down : {1}", beat.MaxUp, beat.MaxDown); Console.WriteLine(); }