コード例 #1
0
 public static OrderHistoryClientContract ToClientContract(this OrderHistoryBackendContract src)
 {
     return(new OrderHistoryClientContract
     {
         Id = src.Id,
         AccountId = src.AccountId,
         Instrument = src.Instrument,
         AssetAccuracy = src.AssetAccuracy,
         Type = src.Type,
         Status = src.Status,
         CloseReason = src.CloseReason,
         OpenDate = src.OpenDate,
         CloseDate = src.CloseDate,
         OpenPrice = src.OpenPrice,
         ClosePrice = src.ClosePrice,
         Volume = src.Volume,
         TakeProfit = src.TakeProfit,
         StopLoss = src.StopLoss,
         TotalPnL = src.TotalPnl,
         PnL = src.Pnl,
         InterestRateSwap = src.InterestRateSwap,
         OpenCommission = src.OpenCommission,
         CloseCommission = src.CloseCommission
     });
 }
コード例 #2
0
        private async Task SendIosNotificationAsync(string notificationsId, NotificationType notificationType,
                                                    string message, OrderHistoryBackendContract order = null)
        {
            var apnsMessage = new IosNotification
            {
                Aps = new IosPositionFields
                {
                    Alert = message,
                    Type  = notificationType,
                    Order = order
                }
            };

            var payload = apnsMessage.ToJson(ignoreNulls: true);

            try
            {
                var hub = CustomNotificationHubClient.CreateClientFromConnectionString(_connectionString, _hubName);

                await hub.SendAppleNativeNotificationAsync(payload, new[] { notificationsId });
            }
            catch (Exception e)
            {
                _log.WriteError(nameof(SendIosNotificationAsync), payload, e);
            }
        }
コード例 #3
0
        private async Task SendNotification(string clientId, NotificationType notificationType, string message,
                                            OrderHistoryBackendContract order)
        {
            if (await _clientAccountService.IsPushEnabled(clientId))
            {
                var notificationId = await _clientAccountService.GetNotificationId(clientId);

                await _appNotifications.SendNotification(notificationId, notificationType, message, order);
            }
        }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the AccountHistoryItemBackend class.
 /// </summary>
 public AccountHistoryItemBackend(System.DateTime?date = default(System.DateTime?), AccountHistoryBackendContract account = default(AccountHistoryBackendContract), OrderHistoryBackendContract position = default(OrderHistoryBackendContract))
 {
     Date     = date;
     Account  = account;
     Position = position;
 }
コード例 #5
0
        private async Task SendAndroidNotificationAsync(string notificationsId, NotificationType notificationType, string message, OrderHistoryBackendContract order = null)
        {
            var gcmMessage = new AndroidNotification
            {
                Data = new AndroidPositionFields
                {
                    Entity  = EventsAndEntities.GetEntity(notificationType),
                    Event   = EventsAndEntities.GetEvent(notificationType),
                    Order   = order,
                    Message = message
                }
            };

            var payload = gcmMessage.ToJson(ignoreNulls: true);

            try
            {
                var hub = CustomNotificationHubClient.CreateClientFromConnectionString(_connectionString, _hubName);

                await hub.SendGcmNativeNotificationAsync(payload, new[] { notificationsId });
            }
            catch (Exception e)
            {
                _log.WriteError(nameof(SendAndroidNotificationAsync), payload, e);
            }
        }
コード例 #6
0
        public async Task SendNotification(string notificationsId, NotificationType notificationType, string message, OrderHistoryBackendContract order = null)
        {
            if (string.IsNullOrEmpty(notificationsId))
            {
                _log.WriteWarning(nameof(SendNotification), notificationType, "Notification id is empty");
                return;
            }

            await SendIosNotificationAsync(notificationsId, notificationType, message, order);
            await SendAndroidNotificationAsync(notificationsId, notificationType, message, order);
        }