public async Task Can_delete_currency_without_product_referencing_it()
        {
            // Arrange
            const string currencyId = "testCurrencyId";
            var          currency   = CreateCurrency(currencyId);

            using (var db = _contextFactory.CreateDataContext())
            {
                await db.Currencies.AddAsync(currency);

                await db.SaveChangesAsync();
            }

            var repository = new CurrenciesRepository(_contextFactory);
            var service    = new CurrenciesService(repository, _auditService, _cqrsMessageSender, _convertService);

            // Act
            const string userName      = "******";
            string       correlationId = Guid.NewGuid().ToString("N");
            var          result        = await service.DeleteAsync(currencyId, userName, correlationId);

            // Assert
            Assert.True(result.IsSuccess);

            using (var db = _contextFactory.CreateDataContext())
            {
                Assert.True(await db.Currencies.AllAsync(x => x.Id != currencyId));
            }
        }
        public async void GetAverageCurencyRateForDates_CallsApiOnce_WhenFiredWithDateRange()
        {
            //Arrange
            DateTime startDate      = DateTime.Now.AddDays(-5);
            DateTime endDate        = DateTime.Now;
            int      apiFireTimes   = DateTimeHelper.GetDatesCollection(startDate, endDate).Count();
            string   firstCurrency  = "USD";
            string   secondCurrency = "PLN";
            var      apiReturnValue = new List <CurrencyPair>()
            {
                new CurrencyPair(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <float>(), It.IsAny <DateTime>(),
                                 It.IsAny <DateTime>()),
                new CurrencyPair(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <float>(), It.IsAny <DateTime>(),
                                 It.IsAny <DateTime>())
            };

            Mock <ICurrencyApi> apiMock = new Mock <ICurrencyApi>();

            apiMock
            .Setup(x => x.GetCurrencyByDateRange(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <DateTime>(),
                                                 It.IsAny <DateTime>()))
            .ReturnsAsync(() => apiReturnValue);

            Mock <ICurrenciesConfiguration> config = new Mock <ICurrenciesConfiguration>();

            config.SetupGet(x => x.AvaibleCurrencies).Returns(new[] { "USD", "PLN" });
            CurrenciesService service = new CurrenciesService(apiMock.Object, config.Object);

            //Act
            await service.GetAverageCurencyRateForDates(firstCurrency, secondCurrency, startDate, endDate);

            //Assert
            apiMock.Verify(x => x.GetCurrencyByDateRange(firstCurrency, secondCurrency, startDate, endDate), Times.Once());
        }
Example #3
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (_loaded)
            {
                return;
            }

            _loaded = true;

            _creating = NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
                        StartsWith("admin/currency_inflation/create",
                                   StringComparison.InvariantCulture);

            if (Id <= 0 &&
                !_creating)
            {
                return;
            }

            _currencies = await CurrenciesService.GetAsync();

            _model = _creating ? new CurrencyInflationViewModel() : await Service.GetAsync(Id);

            _authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();

            _editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
                       StartsWith("admin/currency_inflation/edit/",
                                  StringComparison.InvariantCulture);

            StateHasChanged();
        }
Example #4
0
        public CoinbaseProClient(
            IAuthenticator authenticator,
            IHttpClient httpClient,
            bool sandBox = false)
        {
            var clock = new Clock();
            var httpRequestMessageService = new HttpRequestMessageService(authenticator, clock, sandBox);
            var createWebSocketFeed       = (Func <IWebSocketFeed>)(() => new WebSocketFeed(sandBox));
            var queryBuilder = new QueryBuilder();

            AccountsService              = new AccountsService(httpClient, httpRequestMessageService);
            CoinbaseAccountsService      = new CoinbaseAccountsService(httpClient, httpRequestMessageService);
            OrdersService                = new OrdersService(httpClient, httpRequestMessageService, queryBuilder);
            PaymentsService              = new PaymentsService(httpClient, httpRequestMessageService);
            WithdrawalsService           = new WithdrawalsService(httpClient, httpRequestMessageService);
            DepositsService              = new DepositsService(httpClient, httpRequestMessageService);
            ProductsService              = new ProductsService(httpClient, httpRequestMessageService, queryBuilder);
            CurrenciesService            = new CurrenciesService(httpClient, httpRequestMessageService);
            FillsService                 = new FillsService(httpClient, httpRequestMessageService);
            FundingsService              = new FundingsService(httpClient, httpRequestMessageService, queryBuilder);
            ReportsService               = new ReportsService(httpClient, httpRequestMessageService);
            UserAccountService           = new UserAccountService(httpClient, httpRequestMessageService);
            StablecoinConversionsService = new StablecoinConversionsService(httpClient, httpRequestMessageService);
            FeesService     = new FeesService(httpClient, httpRequestMessageService);
            ProfilesService = new ProfilesService(httpClient, httpRequestMessageService);
            WebSocket       = new WebSocket.WebSocket(createWebSocketFeed, authenticator, clock);

            Log.Information("CoinbaseProClient constructed");
        }
        public HttpResponseMessage GetAllCurrencies()
        {
            //obtengo la lista de paises con el cambio a dolar y escribo el archivo
            GerenicResposponse res = CurrenciesService.getAllCurrencies();

            //retorno el request
            return(Request.CreateResponse(res.statusCode, res.data));
        }
        public HttpResponseMessage GetCurrencies(string from, string to)
        {
            //obtengo la conversion de la moneda
            GerenicResposponse res = CurrenciesService.getCurrencyConversions(from, to);

            //retorno el request
            return(Request.CreateResponse(res.statusCode, res.data));
        }
        public HttpResponseMessage GetAll()
        {
            //obtengo el tipo de moneda
            GerenicResposponse res = CurrenciesService.getAll();

            //retorno el request
            return(Request.CreateResponse(res.statusCode, res.data));
        }
 public CurrenciesController(
     ILogger <CurrenciesController> logger,
     IApiKeyService apiKeyService,
     CurrenciesService currenciesService)
 {
     _logger            = logger;
     _currenciesService = currenciesService;
     _apiKeyService     = apiKeyService;
 }
Example #9
0
        public CurrenciesServiceTests()
        {
            long Id = singleEntity.Id;

            Mock    = DefaultContextMock.GetMock();
            MockSet = SetUpMock.SetUpFor(testEntities);
            Mock.Setup(c => c.Set <Currency>()).Returns(MockSet.Object);
            Mock.Setup(c => c.Currency).Returns(MockSet.Object);
            testedService = new CurrenciesService(Mock.Object);
        }
Example #10
0
        public void GetExchangeRates_ReturnsNull_IfDateIsBelow2000_Test()
        {
            //Arrange
            var repository = new CurrenciesRepository();
            var service = new CurrenciesService(repository);

            //Act
            var exchangeRates = service.GetExchangeRates(new DateTime(1998, 01 ,01));

            Assert.IsNull(exchangeRates);
        }
Example #11
0
        public void GetExchangeRateTest(string from, string to, double amount)
        {
            //Arrange
            var repository = new CurrenciesRepository();
            var service = new CurrenciesService(repository);

            //Act
            var rate = service.GetExchangeRate(from, to, DateTime.Now, amount);

            //Assert
            Assert.AreEqual(amount, rate);
        }
        /// <summary>
        /// Fetches all available currencies
        /// </summary>
        /// <returns>GetAllCurrenciesModelView containing all available currencies</returns>
        public GetAllCurrenciesModelView getAllCurrencies()
        {
            IEnumerable <string>      availableCurrencies    = CurrenciesService.getAvailableCurrencies();
            GetAllCurrenciesModelView allCurrenciesModelView = new GetAllCurrenciesModelView();

            foreach (string currency in availableCurrencies)
            {
                CurrencyModelView currencyModelView = new CurrencyModelView();
                currencyModelView.currency = currency;
                allCurrenciesModelView.Add(currencyModelView);
            }

            return(allCurrenciesModelView);
        }
Example #13
0
        public void Start()
        {
            if (!Win32.IsPoERun())
            {
                throw new Exception("Path of Exile is not running!");
            }


            if (Win32.GetActiveWindowTitle() != "Path of Exile")
            {
                Win32.PoE_MainWindow();
            }

            _CurrenciesService = new CurrenciesService(_loggerService);
            _ItemService       = new ItemsService(_CurrenciesService);

            // Go to hideout
            Win32.ChatCommand("/hideout");
            Thread.Sleep(700);

            // Detect Stash
            if (!_StashHelper.OpenStash())
            {
                _loggerService.Log("Stash is not found in the area.");
                throw new Exception("Stash is not found in the area.");
            }

            // Clean inventory

            _StashHelper.ClearInventory("5");

            _StashHelper.ScanTab();

            // Listen for trades
            _LogReaderServices = new ReadLogsServce(_loggerService, _CurrenciesService);
            _LogReaderServices.TradeRequest += TradeRequest;

            // Move for not been afk
            _LogReaderServices.AFK += StopAFK;

            // Trade accepted event
            _LogReaderServices.TradeAccepted += TradeAccepted;
            // Trade canceled event
            _LogReaderServices.TradeCanceled += TradeCanceled;
            //Trade customer left event
            _LogReaderServices.CustomerLeft += CustomerLeft;
            // Trade customer arrived event
            _LogReaderServices.CustomerArrived += BeginTrade;
        }
        public async void GetCurrentConcurrencyRate_ThrowsException_WhenCurrencyIsNotConfigured()
        {
            //Arrange
            string firstCurrency  = "USD";
            string secondCurrency = "PLN";
            Mock <ICurrencyApi>             apiMock = new Mock <ICurrencyApi>();
            Mock <ICurrenciesConfiguration> config  = new Mock <ICurrenciesConfiguration>();

            config.SetupGet(x => x.AvaibleCurrencies).Returns(new[] { "EUR", "PLN" });
            CurrenciesService service = new CurrenciesService(apiMock.Object, config.Object);

            //Act
            //Assert
            await Assert.ThrowsAsync <InvalidOperationException>(() => service.GetCurrentCurrencyRate(firstCurrency, secondCurrency));
        }
        public async void GetCurrentConcurrencyRate_CallsApiOnce_WhenFired()
        {
            //Arrange
            string firstCurrency  = "USD";
            string secondCurrency = "PLN";
            Mock <ICurrencyApi>             apiMock = new Mock <ICurrencyApi>();
            Mock <ICurrenciesConfiguration> config  = new Mock <ICurrenciesConfiguration>();

            config.SetupGet(x => x.AvaibleCurrencies).Returns(new[] { "USD", "PLN" });
            CurrenciesService service = new CurrenciesService(apiMock.Object, config.Object);

            //Act
            await service.GetCurrentCurrencyRate(firstCurrency, secondCurrency);

            //Assert
            apiMock.Verify(x => x.GetCurentCurrencyRate(firstCurrency, secondCurrency), Times.Once());
        }
Example #16
0
        public GDAXClient(Authenticator authenticator, bool sandBox = false)
        {
            this.authenticator = authenticator;

            var httpClient = new HttpClient.HttpClient();
            var clock      = new Clock();
            var httpRequestMessageService = new Services.HttpRequest.HttpRequestMessageService(clock, sandBox);

            AccountsService         = new AccountsService(httpClient, httpRequestMessageService, authenticator);
            CoinbaseAccountsService = new CoinbaseAccountsService(httpClient, httpRequestMessageService, authenticator);
            OrdersService           = new OrdersService(httpClient, httpRequestMessageService, authenticator);
            PaymentsService         = new PaymentsService(httpClient, httpRequestMessageService, authenticator);
            WithdrawalsService      = new WithdrawalsService(httpClient, httpRequestMessageService, authenticator);
            DepositsService         = new DepositsService(httpClient, httpRequestMessageService, authenticator);
            ProductsService         = new ProductsService(httpClient, httpRequestMessageService, authenticator);
            CurrenciesService       = new CurrenciesService(httpClient, httpRequestMessageService, authenticator);
        }
Example #17
0
        public void Start()
        {
            if (!Win32.IsPoERun())
            {
                throw new Exception("Path of Exile is not running!");
            }


            if (Win32.GetActiveWindowTitle() != "Path of Exile")
            {
                Win32.PoE_MainWindow();
            }

            if (!ValidateFarmTabs())
            {
                throw new Exception("Tabs not settup propperly.");
            }

            _CurrenciesSerive = new CurrenciesService(_loggerService);
            _ItemService      = new ItemsService(_CurrenciesSerive);
            _TradeService     = new TradeService(_ItemService, _CurrenciesSerive, _loggerService, new Tab());

            // Go to hideout

            // Clean inventory

            _TradeService.ClearInventory("recycle_tab");

            _StashHelper.ScanTab();

            // Listen for trades
            _LogReaderServices = new ReadLogsServce(_loggerService, _CurrenciesSerive);
            _LogReaderServices.TradeRequest += _TradeService.TradeRequest;

            // Move for not been afk
            _LogReaderServices.AFK += _TradeService.StopAFK;

            // Trade accepted event
            _LogReaderServices.TradeAccepted += _TradeService.TradeAccepted;
            // Trade canceled event
            _LogReaderServices.TradeCanceled += _TradeService.TradeCanceled;
            //Trade customer left event
            _LogReaderServices.CustomerLeft += _TradeService.CustomerLeft;
            // Trade customer arrived event
            _LogReaderServices.CustomerArrived += _TradeService.BeginTrade;
        }
Example #18
0
        public ContentResult Get()
        {
            var request = new Requests()
            {
                Date = DateTime.Now,
                Name = nameof(CurrenciesService.GetListOfCurrenciesWithCode)
            };

            _dbConnection.Requests.Add(request);
            _dbConnection.SaveChanges();

            return(new ContentResult
            {
                ContentType = "text/html; charset=utf-8",
                Content = CurrenciesService.GetListOfCurrenciesWithCode()
            });
        }
Example #19
0
        public ContentResult CalculateRates(decimal value, string fromCode, string toCode)
        {
            var result = CurrenciesService.CalculateRateBetweenCurrencies(value, fromCode.ToUpper(), toCode.ToUpper());

            var request = new Requests()
            {
                Date = DateTime.Now,
                Name = nameof(CurrenciesService.CalculateRateBetweenCurrencies)
            };

            _dbConnection.Requests.Add(request);
            _dbConnection.SaveChanges();

            return(new ContentResult
            {
                ContentType = "text/html; charset=utf-8",
                Content = $"{value} <b>{fromCode}</b> is {result} <b>{toCode}</b>"
            });
        }
Example #20
0
        public ContentResult GetCurrentRateForCode(string code)
        {
            var result = CurrenciesService.GetCurrentRateForCurrency(code.ToUpper());

            var request = new Requests()
            {
                Date = DateTime.Now,
                Name = nameof(CurrenciesService.GetCurrentRateForCurrency)
            };

            _dbConnection.Requests.Add(request);
            _dbConnection.SaveChanges();

            return(new ContentResult
            {
                ContentType = "text/html; charset=utf-8",
                Content = $"Current rate for currency <b>{ code.ToUpper() }</b> is <b>{ result }</b>"
            });
        }
Example #21
0
        public GDAXClient(
            IAuthenticator authenticator,
            bool sandBox = false)
        {
            var httpClient = new HttpClient.HttpClient();
            var clock      = new Clock();
            var httpRequestMessageService = new HttpRequestMessageService(clock, sandBox);
            var queryBuilder = new QueryBuilder();

            AccountsService         = new AccountsService(httpClient, httpRequestMessageService, authenticator);
            CoinbaseAccountsService = new CoinbaseAccountsService(httpClient, httpRequestMessageService, authenticator);
            OrdersService           = new OrdersService(httpClient, httpRequestMessageService, authenticator);
            PaymentsService         = new PaymentsService(httpClient, httpRequestMessageService, authenticator);
            WithdrawalsService      = new WithdrawalsService(httpClient, httpRequestMessageService, authenticator);
            DepositsService         = new DepositsService(httpClient, httpRequestMessageService, authenticator);
            ProductsService         = new ProductsService(httpClient, httpRequestMessageService, authenticator, queryBuilder);
            CurrenciesService       = new CurrenciesService(httpClient, httpRequestMessageService, authenticator);
            FillsService            = new FillsService(httpClient, httpRequestMessageService, authenticator);
            FundingsService         = new FundingsService(httpClient, httpRequestMessageService, authenticator, queryBuilder);
        }
Example #22
0
        /// <summary>
        /// Fetches the price history of a material
        /// </summary>
        /// <param name="fetchMaterialFinishPriceHistoryDTO">FetchMaterialPriceHistoryDTO with the information about the fetch</param>
        /// <returns>GetAllMaterialPriceHistoryModelView with the material price history fetch information</returns>
        public GetAllMaterialPriceHistoryModelView fetchMaterialPriceHistory(FetchMaterialPriceHistoryDTO fetchMaterialPriceHistoryDTO, IHttpClientFactory clientFactory)
        {
            IEnumerable <MaterialPriceTableEntry> materialPriceHistory = PersistenceContext.repositories().createMaterialPriceTableRepository().fetchMaterialPriceHistory(fetchMaterialPriceHistoryDTO);

            FetchEnsurance.ensureMaterialPriceHistoryFetchWasSuccessful(materialPriceHistory);
            if (fetchMaterialPriceHistoryDTO.currency != null && fetchMaterialPriceHistoryDTO.area != null)
            {
                CurrenciesService.checkCurrencySupport(fetchMaterialPriceHistoryDTO.currency);
                AreasService.checkAreaSupport(fetchMaterialPriceHistoryDTO.area);
                foreach (MaterialPriceTableEntry materialPriceTableEntry in materialPriceHistory)
                {
                    Task <double> convertedValueTask =
                        new CurrencyPerAreaConversionService(clientFactory)
                        .convertDefaultCurrencyPerAreaToCurrencyPerArea(materialPriceTableEntry.price.value, fetchMaterialPriceHistoryDTO.currency, fetchMaterialPriceHistoryDTO.area);
                    convertedValueTask.Wait();
                    materialPriceTableEntry.price.value = convertedValueTask.Result;
                }
                return(PriceTableModelViewService.fromMaterialCollection(materialPriceHistory, fetchMaterialPriceHistoryDTO.currency, fetchMaterialPriceHistoryDTO.area));
            }
            return(PriceTableModelViewService.fromMaterialCollection(materialPriceHistory, CurrencyPerAreaConversionService.getBaseCurrency(), CurrencyPerAreaConversionService.getBaseArea()));
        }
        public async Task Cannot_delete_currency_with_product_referencing_it()
        {
            // Arrange
            const string currencyId = "testCurrencyId";
            const string productId  = "testProductId";

            var currency = CreateCurrency(currencyId);
            var product  = new ProductEntity {
                ProductId = productId, TradingCurrencyId = currencyId
            };

            using (var db = _contextFactory.CreateDataContext())
            {
                await db.Currencies.AddAsync(currency);

                await db.Products.AddAsync(product);

                await db.SaveChangesAsync();
            }

            var repository = new CurrenciesRepository(_contextFactory);
            var service    = new CurrenciesService(repository, _auditService, _cqrsMessageSender, _convertService);

            // Act
            const string userName      = "******";
            string       correlationId = Guid.NewGuid().ToString("N");
            var          result        = await service.DeleteAsync(currencyId, userName, correlationId);

            // Assert
            Assert.True(result.IsFailed);
            Assert.Equal(Core.Domain.CurrenciesErrorCodes.CannotDeleteCurrencyWithAttachedProducts, result.Error);

            using (var db = _contextFactory.CreateDataContext())
            {
                Assert.True(await db.Currencies.AnyAsync(x => x.Id == currencyId));
                Assert.True(await db.Products.AnyAsync(x => x.ProductId == productId));
            }
        }
        public async void GetAverageCurencyRateForDates_ReturnsAverageValue_FromApiValues()
        {
            //Arrange
            float    firstValue     = 10;
            float    secondValue    = 20;
            DateTime startDate      = DateTime.Now.AddDays(-5);
            DateTime endDate        = DateTime.Now;
            int      apiFireTimes   = DateTimeHelper.GetDatesCollection(startDate, endDate).Count();
            string   firstCurrency  = "USD";
            string   secondCurrency = "PLN";
            var      apiReturnValue = new List <CurrencyPair>()
            {
                new CurrencyPair(It.IsAny <string>(), It.IsAny <string>(), firstValue, It.IsAny <DateTime>(),
                                 It.IsAny <DateTime>()),
                new CurrencyPair(It.IsAny <string>(), It.IsAny <string>(), secondValue, It.IsAny <DateTime>(),
                                 It.IsAny <DateTime>())
            };

            Mock <ICurrencyApi> apiMock = new Mock <ICurrencyApi>();

            apiMock
            .Setup(x => x.GetCurrencyByDateRange(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <DateTime>(),
                                                 It.IsAny <DateTime>()))
            .ReturnsAsync(() => apiReturnValue);

            Mock <ICurrenciesConfiguration> config = new Mock <ICurrenciesConfiguration>();

            config.SetupGet(x => x.AvaibleCurrencies).Returns(new[] { "USD", "PLN" });
            CurrenciesService service = new CurrenciesService(apiMock.Object, config.Object);

            //Act
            var result = await service.GetAverageCurencyRateForDates(firstCurrency, secondCurrency, startDate, endDate);

            //Assert
            Assert.Equal(result.ExchangeRate, (firstValue + secondValue) / 2);
        }
Example #25
0
        public GDAXClient(
            IAuthenticator authenticator,
            IHttpClient httpClient,
            bool sandBox = false)
        {
            var clock = new Clock();
            var httpRequestMessageService = new HttpRequestMessageService(authenticator, clock, sandBox);
            var webSocket    = new WebSocket.WebSocket(authenticator, clock, sandBox);
            var queryBuilder = new QueryBuilder();

            AccountsService         = new AccountsService(httpClient, httpRequestMessageService);
            CoinbaseAccountsService = new CoinbaseAccountsService(httpClient, httpRequestMessageService);
            OrdersService           = new OrdersService(httpClient, httpRequestMessageService);
            PaymentsService         = new PaymentsService(httpClient, httpRequestMessageService);
            WithdrawalsService      = new WithdrawalsService(httpClient, httpRequestMessageService);
            DepositsService         = new DepositsService(httpClient, httpRequestMessageService);
            ProductsService         = new ProductsService(httpClient, httpRequestMessageService, queryBuilder);
            CurrenciesService       = new CurrenciesService(httpClient, httpRequestMessageService);
            FillsService            = new FillsService(httpClient, httpRequestMessageService);
            FundingsService         = new FundingsService(httpClient, httpRequestMessageService, queryBuilder);
            ReportsService          = new ReportsService(httpClient, httpRequestMessageService);
            UserAccountService      = new UserAccountService(httpClient, httpRequestMessageService);
            WebSocket = webSocket;
        }
Example #26
0
 public CurrenciesController(CurrenciesService currenciesService)
 {
     _currenciesService = currenciesService;
 }
Example #27
0
        private static async Task Sample()
        {
            //Historical Prices
            //FOR SOME REASON SANDBOX DOESN'T PROVIDE HISTORICAL PRICES
            var prodSettingsProvider    = new ConnectionSettingsProvider(ConnectionSettingsProvider.DefaultProduction);
            var historicalPricesService = new ProductsService(prodSettingsProvider);
            var prices =
                await historicalPricesService.GetProductHistoricalRatesAsyc("BTC-USD", RateGranularities.Gr1Minute);

            Console.WriteLine($"{prices.Count} latest prices found");
            var start = DateTime.Now.AddHours(-10);
            var end   = start.AddMinutes(10);

            prices = await historicalPricesService.GetProductHistoricalRatesAsyc("BTC-USD", RateGranularities.Gr1Minute,
                                                                                 start, end);

            Console.WriteLine($"{prices.Count} prices between {start} and {end} found");

            //Use Sandbox for the rest of APIs
            var settingsProvider    = new ConnectionSettingsProvider(ConnectionSettingsProvider.DefaultSandbox);
            var credentailsProvider = new SampleCredentailsProvider();

            //Currencies
            var currencyService = new CurrenciesService(settingsProvider);
            var currencies      = await currencyService.GetCurrenciesAsync();

            Console.WriteLine($"{currencies.Count} currencies found");

            //Products
            var prdService = new ProductsService(settingsProvider);
            var products   = await prdService.GetProductsAsyc();

            Console.WriteLine($"{products.Count} products found");
            var productTicker = await prdService.GetProductTickerAsyc("BTC-USD");

            Console.WriteLine($"Latest price for BTC-USD is {productTicker.Price}");

            //Time
            var timeService = new TimeService(settingsProvider);
            var time        = await timeService.GetTimeAsync();

            Console.WriteLine($"Service time: {time.ServerTime}");

            //Accounts
            var acctService = new AccountsService(credentailsProvider, settingsProvider);
            var accts       = await acctService.GetAccountsAsync();

            Console.WriteLine($"{currencies.Count} accounts found");
            if (accts.Count > 0)
            {
                var acct = await acctService.GetAccountByIdAsync(accts[0].Id);

                Console.WriteLine($"Account with id: {acct.Id} retrieved");
                var acctHolds = await acctService.GetAccountHoldsAsync(accts[1].Id);

                Console.WriteLine($"{acctHolds.Count} account holds found for account {accts[1].Id}");
            }

            //Orders
            var orderService = new OrdersService(credentailsProvider, settingsProvider);
            //Buy BTC
            var order = await orderService.PlaceLimitGTCOrderAsync(Sides.Buy, Product.BTC_USD, 9000m, 0.01m);

            Console.WriteLine($"Order with id {order.Id} has been placed");
            var orders = await orderService.GetOrdersAsync();

            Console.WriteLine($"{orders.Count} orders found");
            var ord1 = await orderService.GetOrderByIdAsync(order.Id);

            Console.WriteLine($"Order with id: {ord1.Id} retrieved");

            //Fills
            var fillsService = new FillsService(credentailsProvider, settingsProvider);
            var fills        = await fillsService.GetFillsAsync(ord1.Id);

            Console.WriteLine($"{fills.Count} fills found for order {ord1.Id}");

            //Order Calcellation
            var msg = await orderService.CancelOrderAsync(order.Id);

            Console.WriteLine($"Order with id: {msg[0]} cancelled");
        }