Esempio n. 1
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());
        }
Esempio n. 2
0
        //private int v1;
        //private string v2;

        //public Instrument(decimal localValue, string localiso, decimal reportingValue, string reportingiso, FX pricefx            )
        //{
        //ReportingPrice = new FinancialTypes.Price(reportingValue, reportingiso);
        //LocalPrice = new Price(localValue, localiso);
        //}

        //public Instrument(decimal value, string iso) : this(value, iso, value, iso)
        //{ }

        public Instrument(int id, string name, DateTime valuationDate, DateTime valuationDateProxy, FX priceFX, CurrencyInfo reportingCurrency, Price localPrice)
        {
            ID                 = id;
            Name               = name;
            ValuationDate      = valuationDate;
            ValuationDateProxy = valuationDateProxy;
            LocalPrice         = localPrice;
            PriceFX            = priceFX;
            ReportingCurrency  = reportingCurrency;
        }
Esempio n. 3
0
 public Money(decimal value, CurrencyInfo currencyInfo) : base(value, currencyInfo)
 {
 }
Esempio n. 4
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);
        }
Esempio n. 5
0
 public MoneyPriceBase(decimal value, CurrencyInfo currencyInfo)
 {
     Value        = value;
     CurrencyInfo = currencyInfo;
 }
Esempio n. 6
0
 public FX GetFX(CurrencyInfo reporting, CurrencyInfo local)
 {
     return(items.First(p => p.ReportingCurrency == reporting && p.LocalCurrency == local));
 }
Esempio n. 7
0
 public Valuation(CurrencyInfo currencyInfo)
 {
     CurrencyInfo = currencyInfo;
 }
Esempio n. 8
0
 public Money ExposureToLocal(CurrencyInfo currencyInfo)
 {
     return(new Money(Items.Where(P => P.Instrument.LocalPrice.CurrencyInfo == currencyInfo).Sum(p => p.LocalValue.Value), currencyInfo.ISO));
 }
Esempio n. 9
0
 public Price(decimal value, CurrencyInfo currencyInfo) : base(value, currencyInfo)
 {
 }