Exemple #1
0
        public object Get(GetAsset request)
        {
            if (request.id < 1)
            {
                throw new HttpError(HttpStatusCode.NotFound, "Assets not found. Please check Id");
            }
            ApiUser hdUser = request.ApiUser;

            CheckAssets(hdUser);

            var query = base.Request.QueryString;

            return(base.RequestContext.ToOptimizedResultUsingCache(base.Cache, string.Format("urn:{0}:{1}{2}", base.Request.GetBasicAuth(), base.Request.PathInfo.Substring(1), (base.Request.QueryString.Count > 0 ? ":" + base.Request.QueryString.ToString() : "")),
                                                                   new System.TimeSpan(0, 1, 0), () =>
            {
                return GetAsset(request);
            }));
        }
        /*! \param maxTimeSteps is used to limit timeSteps when using Boyle-Lau
         *           optimization. If zero (the default) the maximum number of
         *           steps is calculated by an heuristic: anything when < 1000,
         *           otherwise no more than 5*timeSteps.
         *           If maxTimeSteps is equal to timeSteps Boyle-Lau is disabled.
         *           Likewise if the lattice is not CoxRossRubinstein Boyle-Lau is
         *           disabled and maxTimeSteps ignored.
         */
        public BinomialBarrierEngine(GetTree getTree, GetAsset getAsset,
                                     GeneralizedBlackScholesProcess process, int timeSteps, int maxTimeSteps = 0)
        {
            process_      = process;
            timeSteps_    = timeSteps;
            maxTimeSteps_ = maxTimeSteps;
            getTree_      = getTree;
            getAsset_     = getAsset;

            Utils.QL_REQUIRE(timeSteps > 0, () =>
                             "timeSteps must be positive, " + timeSteps + " not allowed");
            Utils.QL_REQUIRE(maxTimeSteps == 0 || maxTimeSteps >= timeSteps, () =>
                             "maxTimeSteps must be zero or greater than or equal to timeSteps, " + maxTimeSteps + " not allowed");
            if (maxTimeSteps_ == 0)
            {
                maxTimeSteps_ = Math.Max(1000, timeSteps_ * 5);
            }
            process_.registerWith(update);
        }
Exemple #3
0
 public object GetAsset(GetAsset request)
 {
     CheckAssets(request.ApiUser);
     return(Models.Assets.GetAsset(request.ApiUser, request.id));
 }