mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-25 12:25:10 -08:00
25 lines
653 B
C#
25 lines
653 B
C#
using System.Collections.Immutable;
|
|
using System.Linq;
|
|
|
|
namespace Game
|
|
{
|
|
/// <summary>
|
|
/// Represents a single trading day.
|
|
/// </summary>
|
|
public record TradingDay
|
|
{
|
|
/// <summary>
|
|
/// Gets the average share price of all companies in the market this
|
|
/// day.
|
|
/// </summary>
|
|
public double AverageSharePrice =>
|
|
Companies.Average (company => company.SharePrice);
|
|
|
|
/// <summary>
|
|
/// Gets the collection of public listed companies in the stock market
|
|
/// this day.
|
|
/// </summary>
|
|
public ImmutableArray<Company> Companies { get; init; }
|
|
}
|
|
}
|