/// <summary> /// get the value of a single position /// </summary> /// <param name="position">position</param> /// <param name="quoteFeed">quote feed</param> /// <returns>value</returns> public static decimal PositionValue(Position position, IQuoteFeed quoteFeed) { Contract.Requires(position != null); Contract.Requires(quoteFeed != null); Quote lastQuote = quoteFeed.GetQuote(position.Symbol); return(lastQuote.Price * position.Quantity); }
/// <summary> /// update the prices in the database /// </summary> /// <param name="database">database</param> /// <param name="quoteFeed">quote feed</param> private static void UpdatePrices(IDatabase database, IQuoteFeed quoteFeed) { List <string> symbols = database.GetSymbols(); foreach (string symbol in symbols) { Quote quote = quoteFeed.GetQuote(symbol); database.SaveQuote(quote); } }