コード例 #1
0
ファイル: FXCollection.cs プロジェクト: mart6061/MoneyType
        public void Fill(DateTime valuationDate, CurrencyInfo reportingCurrencyInfo)
        {
            items = new List <FX>();

            items.Add(new FX(1, CurrencyInfoCollection.GetCurrencyInfo("BRL"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.68m));
            items.Add(new FX(2, CurrencyInfoCollection.GetCurrencyInfo("CAD"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 2.68m));
            items.Add(new FX(3, CurrencyInfoCollection.GetCurrencyInfo("CNY"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.68m));
            items.Add(new FX(4, CurrencyInfoCollection.GetCurrencyInfo("DKK"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.68m));
            items.Add(new FX(5, CurrencyInfoCollection.GetCurrencyInfo("GEL"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.68m));
            items.Add(new FX(6, CurrencyInfoCollection.GetCurrencyInfo("GEL"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.68m));
            items.Add(new FX(7, CurrencyInfoCollection.GetCurrencyInfo("HKD"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.68m));
            items.Add(new FX(8, CurrencyInfoCollection.GetCurrencyInfo("INR"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.68m));
            items.Add(new FX(9, CurrencyInfoCollection.GetCurrencyInfo("JPY"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 180m));
            items.Add(new FX(10, CurrencyInfoCollection.GetCurrencyInfo("KRW"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 10m));
            items.Add(new FX(11, CurrencyInfoCollection.GetCurrencyInfo("CHF"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 10m));
            items.Add(new FX(12, CurrencyInfoCollection.GetCurrencyInfo("MYR"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.8m));
            items.Add(new FX(13, CurrencyInfoCollection.GetCurrencyInfo("MXN"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.8m));
            items.Add(new FX(14, CurrencyInfoCollection.GetCurrencyInfo("EUR"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.95m));
            items.Add(new FX(15, CurrencyInfoCollection.GetCurrencyInfo("AUD"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 2.68m));
            items.Add(new FX(16, CurrencyInfoCollection.GetCurrencyInfo("SGD"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.68m));
            items.Add(new FX(17, CurrencyInfoCollection.GetCurrencyInfo("SEK"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.68m));
            items.Add(new FX(18, CurrencyInfoCollection.GetCurrencyInfo("TWD"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.68m));
            items.Add(new FX(19, CurrencyInfoCollection.GetCurrencyInfo("TRY"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.68m));
            items.Add(new FX(20, CurrencyInfoCollection.GetCurrencyInfo("USD"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 0.68m));
            items.Add(new FX(21, CurrencyInfoCollection.GetCurrencyInfo("GBP"), reportingCurrencyInfo, reportingCurrencyInfo.Name, valuationDate, valuationDate, 1m));
        }
コード例 #2
0
        private static Instrument createinstrument(int id, string name, decimal px, string localiso, CurrencyInfo reportingCurrencyInfo, FXCollection fxs)
        {
            CurrencyInfo localcurrencyinfo = CurrencyInfoCollection.GetCurrencyInfo(localiso);
            FX           fx         = fxs.GetFX(reportingCurrencyInfo, localcurrencyinfo);
            Price        price      = new Price(px, localcurrencyinfo);
            Instrument   instrument = new Instrument(id, name, DateTime.Now.Date, DateTime.Now.Date, fx, reportingCurrencyInfo, price);

            return(instrument);
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            CurrencyInfo reportingcurrency = CurrencyInfoCollection.GetCurrencyInfo("GBP");

            InstrumentCollection icoll = new InstrumentCollection();

            icoll.Fill(DateTime.Now.Date, reportingcurrency);

            List <Transaction> transvod = new List <Transaction>();

            transvod.Add(new Transaction(new Quantity(100), DateTime.Now.AddDays(-1000)));
            transvod.Add(new Transaction(new Quantity(2100), DateTime.Now.AddDays(-100)));
            transvod.Add(new Transaction(new Quantity(80), DateTime.Now.AddDays(-10)));

            Holding hvod = new Holding(icoll.GetInstrument(1), transvod);

            List <Transaction> transapl = new List <Transaction>();

            transapl.Add(new Transaction(new Quantity(45), DateTime.Now.AddDays(-2000)));
            transapl.Add(new Transaction(new Quantity(200), DateTime.Now.AddDays(-222)));
            transapl.Add(new Transaction(new Quantity(70), DateTime.Now.AddDays(-22)));

            Holding hapl = new Holding(icoll.GetInstrument(2), transapl);

            Valuation v = new Valuation(CurrencyInfoCollection.GetCurrencyInfo("GBP"));

            v.Items.Add(hapl);
            v.Items.Add(hvod);

            //MessageBox.Show(hvod.ReportingValue.ToCurrency());
            //hvod.ReportingValue.Value = 5;
            //MessageBox.Show(hvod.ReportingValue.ToDetailedCurrency());

            //MessageBox.Show("local " + v.ExposureToLocal(CurrencyInfoCollection.GetCurrencyInfo("USD")).ToCurrency() +", reporting " + v.ExposureToReporting(CurrencyInfoCollection.GetCurrencyInfo("USD")).ToCurrency());// .ToDetailedCurrency());
            //MessageBox.Show(v.BookValue().ToDetailedCurrency());
        }
コード例 #4
0
 public MoneyPriceBase(decimal value, string iso)
 {
     Value        = value;
     CurrencyInfo = CurrencyInfoCollection.GetCurrencyInfo(iso);
 }