public EmailMainViewModel(IExchangeService exchangeService)
 {
     this.exchangeService = exchangeService;
     this.inbox = new ObservableCollection<EmailMessage>();
     this.inbox.AddRange(this.exchangeService.GetInbox());
     this.SelectedEmail = new ObservableObject<EmailMessage>();
 }
        public double Sell(Currencies currency, double amount)
        {         

            try
            {
                if (!UseAsmx)
                {
                    // Call the WCF service
                    currencyProx = currencyChf.CreateChannel();
                    return currencyProx.Sell(currency, amount);
                }
                else
                {
                    // Call the WCF service
                    currencyAsmxProx = currencyAsmxChf.CreateChannel();
                    return currencyAsmxProx.Sell(currency, amount);
                }
            }
            catch (Exception ex)
            {
                LoggingManager.Logger.Log(LoggingCategory.Error, StringsResource.FailedToContactCurrencyExchange + " " + ex.Message);
                throw new FaultException<CurrencyExchangeException>
                    (new CurrencyExchangeException(StringsResource.FailedToContactCurrencyExchange + " " + ex.Message, ex));
            }
            finally
            {
                var channel = currencyProx as ICommunicationObject;
                if ((channel != null) && (channel.State == CommunicationState.Opened))
                    channel.Close();

                channel = currencyAsmxProx as ICommunicationObject;
                if ((channel != null) && (channel.State == CommunicationState.Opened))
                    channel.Close();
            }
        }
 public NewEmailUseCase(
     IViewToRegionBinder viewtoToRegionBinder,
     ObjectFactory<NewEmailViewModel> newEmailViewFactory,
     ObjectFactory< NewEmailToolBarViewModel> newEmailToolBarFactory,
     IExchangeService exchangeService, 
     IRegionManager regionManager) : base (viewtoToRegionBinder)
 {
     this.AddInitializationMethods(
         () => this.newEmailViewModel = newEmailViewFactory.CreateInstance()
         , () => this.newEmailToolBarViewModel = newEmailToolBarFactory.CreateInstance());
     
     this.exchangeService = exchangeService;
     this.RegionManager = regionManager;
 }
Beispiel #4
0
 public CalculatorApp(IExchangeService exchangeService, IUserInteraction userInteraction)
 {
     _exchangeService = exchangeService;
     _userInteraction = userInteraction;
 }
 public Exchangeservice_IsExchangeShould()
 {
     _exchangeService = new TCMBExchangeService();
 }
 public ExchangeController(IExchangeService exchangeService)
 {
     _exchangeService = exchangeService;
 }
 public ExchangeRateCommandHandler(IExchangeCurrencyHttpQuery exchangeRateQuery, IExchangeService exchangeRateService)
 {
     _exchangeRateQuery   = exchangeRateQuery;
     _exchangeRateService = exchangeRateService;
 }
        public async virtual Task AddExchangeService(IEnumerable <StrategySubscription> strategySubscriptions, Exchange exchange, IExchangeService exchangeService)
        {
            if (exchangeServices.ContainsKey(exchange))
            {
                return;
            }

            exchangeServices.Add(exchange, exchangeService);

            var symbols = await exchangeService.GetSymbolsAsync(exchange, cancellationToken);

            var subscribedSymbols = (from s in symbols
                                     join ss in strategySubscriptions on s.ExchangeSymbol equals ss.Symbol
                                     select s).ToList();

            exchangeSymbols.Add(exchange, subscribedSymbols);
        }
 public void Setup()
 {
     _repositoryMock  = Substitute.For <IRepository>();
     _exchangeService = new ExchangeService(_repositoryMock);
 }
Beispiel #10
0
 public ConsoleAction(IStockService stockService, IExchangeService exchangeService)
 {
     this.stockService    = stockService;
     this.exchangeService = exchangeService;
 }
Beispiel #11
0
 public DemoTerminalAppController(ILoggerFactory loggerFactory,
                                  IExchangeService exchangeService)
 {
     _logger          = loggerFactory.CreateLogger(nameof(DemoTerminalAppController));
     _exchangeService = exchangeService;
 }
Beispiel #12
0
 public MemberController(IMemberService memberService, ILoginCodeService loginCodeService, IExchangeService exchangeService, IRechargeRecordService rechargeRecordService,
                         ICooperationService cooperationService, IRefundService refundService, ICosFileStatService cosFileStatService)
 {
     _memberService         = memberService;
     _loginCodeService      = loginCodeService;
     _exchangeService       = exchangeService;
     _rechargeRecordService = rechargeRecordService;
     _cooperationService    = cooperationService;
     _refundService         = refundService;
     _cosFileStatService    = cosFileStatService;
 }
Beispiel #13
0
 protected abstract Task ExecuteOnExchangeAsync(IExchangeService exchangeService, Instrument instrument);
 public ExchangeController(IExchangeService exchangeService, ILogger <ExchangeController> logger)
 {
     _exchangeService = exchangeService;
     _logger          = logger;
 }
Beispiel #15
0
 public OrderService(IExchangeService exchange)
 {
     _exchange = ValidateExchangeService(exchange);
 }
Beispiel #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MeetingHelper"/> class.
 /// </summary>
 /// <param name="meetingProvider">Provider for post and get API calls to Graph.</param>
 /// <param name="userConfigurationProvider">Provider for getting user specific configuration.</param>
 /// <param name="roomCollectionStorageProvider">Storage provider to perform fetch operation on RoomCollection table.</param>
 /// <param name="memoryCache">Memory cache to store rooms.</param>
 public MeetingHelper(IMeetingProvider meetingProvider, IMemoryCache memoryCache, IExchangeService exchangeService)
 {
     this.meetingProvider = meetingProvider;
     this.memoryCache     = memoryCache;
     this.exchangeService = exchangeService;
 }
Beispiel #17
0
 public CurrencyController(IExchangeService service)
 {
     _service = service;
 }
Beispiel #18
0
 public ExchangeSubscriptionsCacheFactory(IExchangeService exchangeService)
 {
     this.exchangeService       = exchangeService;
     exchangeSubscriptionsCache = new ConcurrentDictionary <Exchange, IExchangeSubscriptionsCache>();
 }
Beispiel #19
0
 protected override async Task ExecuteOnExchangeAsync(IExchangeService exchangeService, Instrument instrument)
 {
     await _traderService.ProcessSignals(exchangeService, instrument);
 }
Beispiel #20
0
 public ControllerExchange()
 {
     exchangeService = new ExchangeTest();
 }
        public static ExchangeResponseDTO MapExchangeDetailsToDto(Exchangesusers exchangeDetails, IExchangeService exchangeService)
        {
            _exchangeService = exchangeService;
            string count  = string.Empty;
            var    result = new ExchangeResponseDTO
            {
                ID          = exchangeDetails.EuId,
                DateEnabled = exchangeDetails.ExchangeuCrDt,
            };

            result.ExchangeName = _exchangeService.GetExchangeTypeById(exchangeDetails.ExchangeuId);
            result.APIsEntered  = _exchangeService.GetApiEnteredCount(exchangeDetails.EuId);

            return(result);
        }
 public ExchangeRateController(IExchangeService service)
 {
     _service = service;
 }
Beispiel #23
0
        public void TestHoardGames()
        {
            hoardFixture.InitializeFromConfig();
            HoardService = hoardFixture.HoardService;

            //ulong amount = (ulong)HoardService.GetHRDAmount(HoardService.DefaultPlayer);

            if (HoardService.DefaultGame != GameID.kInvalidID)
            {
                ErrorCallbackProvider.ReportInfo("\tName: " + HoardService.DefaultGame.Name);
                ErrorCallbackProvider.ReportInfo("\tBackend Url: " + HoardService.DefaultGame.Url);
                ErrorCallbackProvider.ReportInfo("\tGameID: " + HoardService.DefaultGame.ID);
            }

            ErrorCallbackProvider.ReportInfo("Getting Hoard games...");

            GameID[] games = HoardService.GetAllHoardGames().Result;

            ErrorCallbackProvider.ReportInfo(string.Format("Found {0} Hoard games.", games.Length));

            foreach (GameID game in games)
            {
                //Register hoard provider for this gam
                ErrorCallbackProvider.ReportInfo(string.Format("Registering Hoard game {0}", game.Name));
                HoardService.RegisterHoardGame(game);

                ErrorCallbackProvider.ReportInfo(string.Format("Getting player items for game {0}", game.Name));
                GameItem[] items = HoardService.GetPlayerItems(hoardFixture.UserIDs[0], game).Result;

                ErrorCallbackProvider.ReportInfo(string.Format("Found {0} items.", items.Length));
                foreach (GameItem gi in items)
                {
                    //assume we need to populate properties
                    //TODO: if properties is not null we would need to compare state with some cached data and if there is mismatch update too
                    ErrorCallbackProvider.ReportInfo(string.Format("Getting properties for item {0}:{1}...", gi.Symbol, gi.State));
                    if (gi.Properties == null)
                    {
                        HoardService.FetchItemProperties(gi);
                    }
                    //TODO: enumerate properties...
                }
            }

            // Check exchange
            IExchangeService exchange = HoardService.ExchangeService;

            if (exchange != null)
            {
                var orders = exchange.ListOrders(null, null, null).Result;
                ErrorCallbackProvider.ReportInfo(string.Format("Found {0} exchange orders.", orders.Length));
                foreach (Order order in orders)
                {
                    ErrorCallbackProvider.ReportInfo(string.Format("Order: Buy {0} {1} for {2} {3}.",
                                                                   order.amountGive,
                                                                   order.gameItemGive.Symbol,
                                                                   order.amountGet,
                                                                   order.gameItemGet.Symbol
                                                                   ));
                }
                // test trade:

                /*if (orders.Length > 1)
                 * {
                 *  Order order = orders[0];
                 *  bool result = exchange.Deposit(order.gameItemGet, order.amountGet).Result;
                 *  result = exchange.Trade(order, order.amountGet).Result;
                 *  result = exchange.Withdraw(order.gameItemGive, order.amountGive).Result;
                 * }*/
            }

            ErrorCallbackProvider.ReportInfo("Shutting down HOARD...");

            HoardService.Shutdown();
        }
 public ExchangeController(IOptions <AppSettings> settings,
                           IExchangeService exchangeService)
 {
     _settings        = settings.Value;
     _exchangeService = exchangeService;
 }
Beispiel #25
0
 public Worker(ILogger <Worker> logger, IHubContext <ExchangeHub, IExchangeHub> exchangeHub, IExchangeService exchangeService)
 {
     _logger          = logger;
     _exchangeHub     = exchangeHub;
     _exchangeService = exchangeService;
     _relativeStrengthIndexIndicator = new RelativeStrengthIndex(exchangeService);
 }
 public ExchangeController()
 {
     _exchangeService = new ExchangeService();
 }
Beispiel #27
0
        public async virtual Task AddExchangeService(IEnumerable <StrategySubscription> strategySubscriptions, Exchange exchange, IExchangeService exchangeService)
        {
            if (exchangeService == null)
            {
                throw new ArgumentNullException(nameof(exchangeService));
            }

            if (ExchangeServices.ContainsKey(exchange))
            {
                return;
            }

            ExchangeServices.Add(exchange, exchangeService);

            var symbols = await exchangeService.GetSymbolsAsync(exchange, CancellationToken).ConfigureAwait(false);

            var subscribedSymbols = (from s in symbols
                                     join ss in strategySubscriptions on s.ExchangeSymbol equals ss.Symbol
                                     select s).ToList();

            ExchangeSymbols.Add(exchange, subscribedSymbols);
        }
 public TickersMonitorTimedTask(ILoggingService loggingService, IExchangeService exchangeService)
 {
     this.loggingService  = loggingService;
     this.exchangeService = exchangeService;
 }
 public CurrencyConverterTests()
 {
     _fakeApi = new ExchangeApiFake();
     _service = new ExchangeService(_fakeApi);
 }
 public ApiContoller(IExchangeService service)
 {
     _service = service;
 }
 public CurrencyController(IExchangeService exchangeService)
 {
     _exchangeService = exchangeService;
 }
Beispiel #32
0
 public WpfExchangeService(IExchangeService exchangeService)
 {
     this.exchangeService = exchangeService;
 }
Beispiel #33
0
 public CalculatorApp()
 {
     _exchangeService = new DefaultExchangeService();
     _userInteraction = new UserInteraction();
 }