コード例 #1
0
ファイル: ValuationEngine.cs プロジェクト: kiquenet/B4F
 private bool runCalculateFeesForUnit(IDalSession session, FeeFactory feeFactory, IManagementPeriodUnit unit, out string message)
 {
     bool success = false;
     message = "";
     try
     {
         switch (unit.ManagementPeriod.ManagementType)
         {
             case B4F.TotalGiro.Accounts.ManagementPeriods.ManagementTypes.ManagementFee:
                 unit.Success = feeFactory.CalculateFeePerUnit(session, unit);
                 break;
             case B4F.TotalGiro.Accounts.ManagementPeriods.ManagementTypes.KickBack:
                 unit.Success = calculateKickBackOnUnit(session, unit, out message);
                 break;
         }
         if (!string.IsNullOrEmpty(message))
             unit.Message = message;
         success = session.Update(unit);
     }
     catch (Exception ex)
     {
         message = Util.GetMessageFromException(ex);
         string logMessage = string.Format("Error in runCalculateFeesForUnit -> unit: {0}; {1}", unit.Key, message);
         log.Error(logMessage);
     }
     return success;
 }
コード例 #2
0
ファイル: DividWepFileMapper.cs プロジェクト: kiquenet/B4F
 public static bool Update(IDalSession session, DividWepFile obj)
 {
     return session.Update(obj);
 }
コード例 #3
0
ファイル: CountryMapper.cs プロジェクト: kiquenet/B4F
 public static void Update(IDalSession session, IList list)
 {
     session.Update(list);
 }
コード例 #4
0
ファイル: ValuationEngine.cs プロジェクト: kiquenet/B4F
 private void setAccountValidityDate(IDalSession session, IAccountTypeCustomer account, DateTime maxValuationDate)
 {
     account.ValuationMutationValidityDate = maxValuationDate;
     session.Update(account);
 }
コード例 #5
0
ファイル: AccountHolderMapper.cs プロジェクト: kiquenet/B4F
 public static void Update(IDalSession session, IAccountHolder obj)
 {
     session.Update(obj);
 }
コード例 #6
0
ファイル: CountryMapper.cs プロジェクト: kiquenet/B4F
 public static void Update(IDalSession session, Country obj)
 {
     session.Update(obj);
 }
コード例 #7
0
ファイル: TBMRequest.cs プロジェクト: kiquenet/B4F
        void updateSingleQuoteHistory(IDalSession session, TradeableInstrument instrument, string sISIN, string sExchange)
        {
            XmlTextReader reader = null;

            string companyname = "";
            string issueexchange = "";
            string issuename = "";
            string issueid = "";
            string quotecurrency = "";
            string quotedate = "";
            string lastquote = "";
            string openquote = "";
            string closedquote = "";
            string highquote = "";
            string lowquote = "";
            string previousdate = "";
            string previousquote = "";

            try
            {
                reader = sendRequestXml(buildTBMXML(String.Format(TBMSingleQuoteHistoryRequest, sExchange, sISIN, TickerType, this.StartDate.ToString("yyyy/MM/dd"), this.EndDate.ToString("yyyy/MM/dd"))));
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "Organisation")
                    {
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Element && reader.Name == "Name")
                            {
                                reader.MoveToAttribute("long");
                                companyname = reader.Value;
                            }
                            if (reader.NodeType == XmlNodeType.Element && reader.Name == "Issue")
                            {
                                reader.MoveToAttribute("exchange");
                                issueexchange = reader.Value;
                                while (reader.Read())
                                {
                                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "Name")
                                    {
                                        reader.MoveToAttribute("long");
                                        issuename = reader.Value;
                                    }
                                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "Ticker")
                                    {
                                        reader.MoveToAttribute("id");
                                        issueid = reader.Value;
                                    }
                                    //if (readMetaData(reader))
                                    //   break;
                                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "Quote")
                                    {
                                        reader.MoveToAttribute("date");
                                        quotedate = reader.Value;
                                        reader.MoveToAttribute("currency");
                                        quotecurrency = reader.Value;
                                        while (reader.Read())
                                        {
                                            if (reader.NodeType == XmlNodeType.Element && reader.Name == "Open")
                                            {
                                                reader.MoveToAttribute("value");
                                                openquote = reader.Value;
                                            }
                                            if (reader.NodeType == XmlNodeType.Element && reader.Name == "Close")
                                            {
                                                reader.MoveToAttribute("value");
                                                closedquote = reader.Value;
                                            }
                                            if (reader.NodeType == XmlNodeType.Element && reader.Name == "High")
                                            {
                                                reader.MoveToAttribute("value");
                                                highquote = reader.Value;
                                            }
                                            if (reader.NodeType == XmlNodeType.Element && reader.Name == "Low")
                                            {
                                                reader.MoveToAttribute("value");
                                                lowquote = reader.Value;
                                            }
                                            if (reader.NodeType == XmlNodeType.Element && reader.Name == "Last")
                                            {
                                                reader.MoveToAttribute("value");
                                                lastquote = reader.Value;
                                            }
                                            if (reader.NodeType == XmlNodeType.Element && reader.Name == "Previous")
                                            {
                                                reader.MoveToAttribute("value");
                                                previousquote = reader.Value;
                                                reader.MoveToAttribute("date");
                                                previousdate = reader.Value;
                                            }
                                            if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "Quote")
                                            {
                                                // Only allow insert/update of a price when it exchange has closed
                                                if (closedquote.Length > 0)
                                                {

                                                    CultureInfo culture = new CultureInfo(CultureInfo.CurrentCulture.Name);

                                                    NumberFormatInfo numInfo = (NumberFormatInfo)culture.GetFormat(typeof(NumberFormatInfo));
                                                    numInfo.NumberDecimalSeparator = ".";

                                                    DateTime dtQuoteDate = DateTime.Parse(quotedate);

                                                    ICurrency newcur = (ICurrency)InstrumentMapper.GetCurrencyByName(session, quotecurrency);

                                                    // For TBM Data the price is the closed price
                                                    decimal dClosedQuote = decimal.Parse(closedquote, numInfo);
                                                    Price newclosedprice = new Price(new Money(dClosedQuote, newcur), instrument);
                                                    IHistoricalPrice newhprice = new HistoricalPrice(newclosedprice, dtQuoteDate);
                                                    newhprice.ClosedPrice = newclosedprice;

                                                    Price newopenprice = null;
                                                    Price newhighprice = null;
                                                    Price newlowprice = null;

                                                    if (openquote.Length > 0)
                                                    {
                                                        decimal dOpenQuote = decimal.Parse(openquote, numInfo);
                                                        newopenprice = new Price(new Money(dOpenQuote, newcur), instrument);
                                                        newhprice.OpenPrice = newopenprice;
                                                    }
                                                    if (highquote.Length > 0)
                                                    {
                                                        decimal dHighQuote = decimal.Parse(highquote, numInfo);
                                                        newhighprice = new Price(new Money(dHighQuote, newcur), instrument);
                                                        newhprice.HighPrice = newhighprice;
                                                    }
                                                    if (lowquote.Length > 0)
                                                    {
                                                        decimal dLowQuote = decimal.Parse(lowquote, numInfo);
                                                        newlowprice = new Price(new Money(dLowQuote, newcur), instrument);
                                                        newhprice.LowPrice = newlowprice;
                                                    }
                                                    if (instrument.HistoricalPrices.ContainsHistoricalPrice(newhprice))
                                                    {
                                                        // Look for previous price to see if it differs too much

                                                        instrument.HistoricalPrices.AddHistoricalPrice(newhprice);

                                                        if (instrument.HistoricalPrices.Count > 1)
                                                        {
                                                            IHistoricalPrice prevhprice = (IHistoricalPrice)instrument.HistoricalPrices.GetItemByDate(dtQuoteDate.AddDays(-1));
                                                            decimal diff = Math.Abs((prevhprice.Price.Quantity - newhprice.Price.Quantity) / prevhprice.Price.Quantity) * 100;
                                                            if (diff > 10)
                                                                // More than 10% difference, raise warning
                                                                throw new ApplicationException(String.Format("Price of instrument: {0} differs more than 10%. Old price: {1}, New price {2}, difference {3}", instrument.Isin, prevhprice.Price, newhprice.Price, diff));
                                                        }

                                                    }
                                                    else
                                                    {
                                                        IHistoricalPrice existinghprice = (IHistoricalPrice)instrument.HistoricalPrices.GetItemByDate(dtQuoteDate);
                                                        existinghprice.Price = newclosedprice;
                                                        existinghprice.ClosedPrice = newclosedprice;
                                                        existinghprice.OpenPrice = newopenprice;
                                                        existinghprice.HighPrice = newhighprice;
                                                        existinghprice.LowPrice = newlowprice;
                                                    }
                                                    session.Update(instrument);
                                                }
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                            if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "Organisation")
                                break;
                        }
                    }
                }
            }
            finally
            {
                // Unknown ISIN or error retrieving one
                if (reader != null)
                    reader.Close();
            }
            return;
        }
コード例 #8
0
 /// <summary>
 /// Updates a ManagementCompany
 /// </summary>
 /// <param name="session">An instance of the Data Access Library <see cref="T:B4F.TotalGiro.DAL.NHSession">NHSession</see> class</param>
 /// <param name="list">The ManagementCompany</param>
 public static void Update(IDalSession session, IManagementCompany obj)
 {
     session.Update(obj);
 }
コード例 #9
0
ファイル: ReportTemplateMapper.cs プロジェクト: kiquenet/B4F
 /// <summary>
 /// Updates a ReportTemplate
 /// </summary>
 /// <param name="session">An instance of the Data Access Library <see cref="T:B4F.TotalGiro.DAL.NHSession">NHSession</see> class</param>
 /// <param name="list">The ReportTemplate</param>
 public static void Update(IDalSession session, IReportTemplate obj)
 {
     session.Update(obj);
 }
コード例 #10
0
ファイル: LoginMapper.cs プロジェクト: kiquenet/B4F
 /// <summary>
 /// Updates an object, saves its data to the database
 /// </summary>
 /// <param name="session">An instance of the Data Access Library <see cref="T:B4F.TotalGiro.DAL.NHSession">NHSession</see> class</param>
 /// <param name="obj">Object of type Login</param>
 public static void Update(IDalSession session, ILogin obj)
 {
     session.Update(obj);
 }
コード例 #11
0
ファイル: CounterAccountMapper.cs プロジェクト: kiquenet/B4F
 public static void Update(IDalSession session, ICounterAccount obj)
 {
     session.Update(obj);
 }
コード例 #12
0
ファイル: RemisierMapper.cs プロジェクト: kiquenet/B4F
 public static bool Update(IDalSession session, IRemisier obj)
 {
     return session.Update(obj);
 }
コード例 #13
0
ファイル: FSExportFileMapper.cs プロジェクト: kiquenet/B4F
 /// <summary>
 /// Saves the data of an existing list of FSExportFile objects.
 /// </summary>
 /// <param name="DataSession">data session object</param>
 /// <param name="obj">list of existing FSExportFile objects</param>
 public static void Update(IDalSession DataSession, IList list)
 {
     DataSession.Update(list);
 }