예제 #1
0
        /// <summary>
        /// Clamp quantiy using market info. If necessary, a network request will be made to retrieve symbol metadata.
        /// </summary>
        /// <param name="marketSymbol">Market Symbol</param>
        /// <param name="outputQuantity">Quantity</param>
        /// <returns>Clamped quantity</returns>
        protected async Task <decimal> ClampOrderQuantity(string marketSymbol, decimal outputQuantity)
        {
            ExchangeMarket market = await GetExchangeMarketFromCacheAsync(marketSymbol);

            return(market == null ? outputQuantity : CryptoUtility.ClampDecimal(market.MinTradeSize, market.MaxTradeSize, market.QuantityStepSize, outputQuantity));
        }
예제 #2
0
        /// <summary>
        /// Clamp price using market info
        /// </summary>
        /// <param name="symbol">Symbol</param>
        /// <param name="outputPrice">Price</param>
        /// <returns>Clamped price</returns>
        protected decimal ClampOrderPrice(string symbol, decimal outputPrice)
        {
            ExchangeMarket market = GetExchangeMarket(symbol);

            return(market == null ? outputPrice : CryptoUtility.ClampDecimal(market.MinPrice, market.MaxPrice, market.PriceStepSize, outputPrice));
        }
예제 #3
0
        /// <summary>
        /// Clamp price using market info. If necessary, a network request will be made to retrieve symbol metadata.
        /// </summary>
        /// <param name="marketSymbol">Market Symbol</param>
        /// <param name="outputPrice">Price</param>
        /// <returns>Clamped price</returns>
        protected async Task <decimal> ClampOrderPrice(string marketSymbol, decimal outputPrice)
        {
            ExchangeMarket market = await GetExchangeMarketFromCacheAsync(marketSymbol);

            return(market == null ? outputPrice : CryptoUtility.ClampDecimal(market.MinPrice, market.MaxPrice, market.PriceStepSize, outputPrice));
        }