Ejemplo n.º 1
0
        public void GetDepth_Default_Test()
        {
            // Arrange
            var pair    = @"MICRO/ETH";
            var figures = Figures.Default;

            // Act
            var depth = _svc.GetDepth(pair, figures).Result;

            // Assert
            Assert.NotNull(depth);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get market depth converted
        /// </summary>
        /// <param name="pairId">Trading pair id</param>
        /// <param name="figures">Significant figures</param>
        /// <returns>DepthConverted for trading pair</returns>
        public static async Task <DepthConverted> GetDepthConverted(this IBilaxyDotNet service, int pairId, Figures figures = Figures.Default)
        {
            var results = await service.GetDepth(pairId, figures);

            var asks = new List <DepthDetail>();

            foreach (var ask in results.Asks)
            {
                var detail = new DepthDetail
                {
                    Price     = ask[0],
                    Quantity  = ask[1],
                    TotalBase = ask[2]
                };
                asks.Add(detail);
            }
            var bids = new List <DepthDetail>();

            foreach (var bid in results.Bids)
            {
                var detail = new DepthDetail
                {
                    Price     = bid[0],
                    Quantity  = bid[1],
                    TotalBase = bid[2]
                };
                bids.Add(detail);
            }

            return(new DepthConverted(asks, bids));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Get market depth
        /// </summary>
        /// <param name="pair">Trading pair</param>
        /// <param name="figures">Significant figures</param>
        /// <returns>Depth for trading pair</returns>
        public static async Task <Depth> GetDepth(this IBilaxyDotNet service, string pair, Figures figures = Figures.Default)
        {
            var asset = await GetTradingPair(service, pair);

            return(await service.GetDepth(asset.AssetId, figures));
        }