コード例 #1
0
        public FirmRequestResult ProcessFirmRegistration(FirmRegistration request)
        {
            var firmName = request.Id;
            var depot    = wallstreetClient.GetFirmDepot(firmName, exchangeId);

            if (depot == null)
            {
                depot = new FirmDepot()
                {
                    FirmName = firmName, OwnedShares = 0
                };
            }

            depot.OwnedShares += request.Shares;

            var info = wallstreetClient.GetShareInformation(firmName, exchangeId);

            if (info == null)
            {
                info = new ShareInformation {
                    FirmName = firmName, NoOfShares = 0, PricePerShare = request.PricePerShare, PurchasingVolume = 0, SalesVolume = 0, ExchangeName = exchangeId
                };
            }
            info.NoOfShares  += request.Shares;
            info.SalesVolume += request.Shares;
            var order = new Order()
            {
                Id                  = firmName + DateTime.Now.Ticks,
                ShareName           = firmName,
                InvestorId          = firmName,
                Type                = OrderType.SELL,
                TotalNoOfShares     = request.Shares,
                NoOfOpenShares      = request.Shares,
                NoOfProcessedShares = 0,
                Status              = OrderStatus.OPEN,
                Limit               = 0,
                Prioritize          = false,
                IsFundShare         = false
            };

            return(new FirmRequestResult {
                FirmDepot = depot, ShareInformation = info, Order = order
            });
        }