本文整理汇总了C#中ISender.SendMVA方法的典型用法代码示例。如果您正苦于以下问题:C# ISender.SendMVA方法的具体用法?C# ISender.SendMVA怎么用?C# ISender.SendMVA使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISender
的用法示例。
在下文中一共展示了ISender.SendMVA方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
/// <summary>
/// Application arguments:
/// arg0: Selected Exchange. Has to be enum StockModel.Master.Exchange
/// arg1: Data generator to use. Has to be IDataPublisher.
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{
//Loading system startup data for all the exchanges
List<Exchange> exchanges = new List<Exchange>();
//defaults selected...
selectedExchange = Exchange.FAKE_NASDAQ;
dataGenerator = YahooDataGenerator.Instance;
ResolveAppArgs(args);
exchanges = Enum.GetValues(typeof(Exchange)).OfType<Exchange>().ToList();
InMemoryObjects.LoadInMemoryObjects(exchanges);
TimeSpan updateDuration = TimeSpan.FromMilliseconds(Constants.FAKE_DATA_GENERATE_PERIOD);
//Start data generation - this will start fetching data for all symbols of current exchange
//Later, need to change this to only subscribe to the specific symbol(s) selected.
dataGenerator.StartDataGeneration(300, selectedExchange);
sender = SenderFactory.GetSender(FeederQueueSystem.REDIS_CACHE);
List<StockModel.Symbol> symbols = InMemoryObjects.ExchangeSymbolList.SingleOrDefault(x => x.Exchange == selectedExchange).Symbols;
List<SymbolFeeds> generatedData = new List<SymbolFeeds>();
List<StockModel.Symbol> symbolList = new List<StockModel.Symbol>();
Action<double, string> addMovingAverage = new Action<double, string>((val,MVA_id) => {
sender.SendMVA(val, MVA_id);
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Sent value {0} to redis", val);
Console.ResetColor();
});
Parallel.ForEach(symbols, (symbol) =>
{
//subscribe
dataGenerator.SubscribeFeed(symbol.Id, (Feed fd) =>
{
sender.SendFeed(fd, selectedExchange.ToString());
Console.WriteLine(fd.ToString());
});
//add subscription for each aggregator configured
//RXProcessing.AddAggregator(dataGenerator, new MovingAverage(),
// addMovingAverage
// , symbol.Id);
});
Console.Read();
}