コード例 #1
0
        public IHttpActionResult GetHoldings([FromBody] object jsonData)
        {
            var reply = _accounts.GetUser(Request.Headers);

            if (reply.FailureReason != GetUserResponse.Reason.None)
            {
                return(BadRequest("Invalid User"));
            }

            var allHoldings = _holdingsProvider.GetHoldings(reply.User);

            return(Ok(allHoldings));
        }
コード例 #2
0
        /// <summary>
        /// Extension method to return the quantity of holdings, if no holdings are present, then zero is returned.
        /// </summary>
        /// <param name="provider">The <see cref="IHoldingsProvider"/></param>
        /// <param name="symbol">The symbol we want holdings quantity for</param>
        /// <returns>The quantity of holdings for the specified symbol</returns>
        public static decimal GetHoldingsQuantity(this IHoldingsProvider provider, Symbol symbol)
        {
            var holding = provider.GetHoldings(symbol);

            return(holding == null ? 0 : holding.Quantity);
        }