Esempio n. 1
0
        // The key identifies unique items to be cached and specifies the order.
        private static string CacheKeySelector(IAccountUpdate v)
        {
            if (v == null)
            {
                throw new ArgumentNullException(nameof(v));
            }

            if (v is AccountUpdateTime)
            {
                return("!"); // top
            }
            if (v is PortfolioValue ap)
            {
                return($"{ap.Account} (1) {(ap.Contract == null ? "" : ap.Contract.Stringify(includeTypeName: false))}");
            }

            if (v is AccountValue av)
            {
                return($"{av.Account} (2) {av.Key}:{av.Currency}");
            }

            // AccountUpdateEnd is last and indicates that the initial values for the partcular account have been emitted.
            return($"{((AccountUpdateEnd)v).Account} (3)");
        }
Esempio n. 2
0
 private void HandleAccountUpdates(IAccountUpdate update)
 {
     OnAccountUpdate?.Invoke(update);
 }
 private static void AlpacaStreamingClient_OnAccountUpdate(IAccountUpdate obj)
 {
     Logger.LogInformation($"AlpacaStreamingClient_OnAccountUpdate: {obj}");
 }