public void ProfitCorrectlyCalculatedAfterReversing() { var pos = new CurrencyPosition(_currency); decimal fxRate = 1.35m; int quantity = 1000; var transaction1 = new FXTransaction { Quantity = quantity, Proceeds = fxRate * quantity, Cost = -fxRate * quantity, FXCurrency = _currency }; pos.AddFXTransaction(transaction1); decimal newFxRate = 1.36m; int newQuantity = -2000; var transaction2 = new FXTransaction { Quantity = newQuantity, Proceeds = newFxRate * newQuantity, Cost = -newFxRate * newQuantity, FXCurrency = _currency }; pos.AddFXTransaction(transaction2); Assert.AreEqual(quantity * (newFxRate - fxRate), pos.RealizedPnL); pos.Update(newFxRate); Assert.AreEqual(quantity * (newFxRate - fxRate), pos.TotalPnL); }
public KashFlow.CompanyDetails ToData() { return(new KashFlow.CompanyDetails() { Address1 = Address1, Address2 = Address2, Address3 = Address3, Address4 = Address4, BusinessType = BusinessType, BusinessType1 = BusinessType1, BusinessType1Name = BusinessName1, BusinessType2 = BusinessType2, BusinessType2Name = BusinessName2, BusinessType3 = BusinessType3, BusinessType3Name = BusinessName3, CompanyName = CompanyName, CurrencyId = CurrencyID, CurrencyName = CurrencyName, CurrencyPosition = CurrencyPosition.ToString(), CurrencySymbol = CurrencySymbol, Mobile = Mobile, PaymentTerms = PaymentTerms, PaymentTermsType = PaymentTermsType.ToString(), Postcode = Postcode, PrimaryContact = PrimaryContact, PrimaryEmail = PrimaryEmail, Telephone = Telephone, UsDate = IsUsingAmericanDate ? "Yes" : "No", VatRegistered = IsVATRegistered ? "Yes" : "No", VatRegistrationNumber = VATRegistrationNumber }); }
public CountryCurrency(DateTime datefrom, DateTime dateto, string currencysymbol,CurrencyPosition position, double rate) { this.DateFrom = datefrom; this.DateTo = dateto; this.CurrencySymbol = currencysymbol; this.Rate = rate; this.Position = position; }
public CountryCurrency( DateTime datefrom, DateTime dateto, string currencysymbol, CurrencyPosition position, double rate) { DateFrom = datefrom; DateTo = dateto; CurrencySymbol = currencysymbol; Rate = rate; Position = position; }
public void QuantityAndPriceReflectAddedTransactions() { var pos = new CurrencyPosition(_currency); decimal fxRate = 1.35m; int quantity = 1000; var transaction1 = new FXTransaction { Quantity = quantity, Proceeds = fxRate * quantity, Cost = -fxRate * quantity, FXCurrency = _currency }; pos.AddFXTransaction(transaction1); Assert.AreEqual(quantity, pos.Quantity); Assert.AreEqual(fxRate, pos.CostBasis); Assert.AreEqual(fxRate, pos.PriorPeriodCostBasis); }
public void RealizedProfitsWithUpdateBetweenTradesCalculatedCorrectly() { var pos = new CurrencyPosition(_currency); decimal fxRate = 1.35m; int quantity = 1000; var transaction1 = new FXTransaction { Quantity = quantity, Proceeds = fxRate * quantity, Cost = -fxRate * quantity, FXCurrency = _currency }; pos.AddFXTransaction(transaction1); decimal newFxRate = 1.36m; pos.Update(newFxRate); Assert.AreEqual(quantity * (newFxRate - fxRate), pos.TotalPnL); int newQuantity = -1000; decimal newFxRate2 = 1.37m; var transaction2 = new FXTransaction { Quantity = newQuantity, Proceeds = newFxRate2 * newQuantity, Cost = -newFxRate2 * newQuantity, FXCurrency = _currency }; pos.AddFXTransaction(transaction2); Assert.AreEqual(-newQuantity * (newFxRate2 - fxRate), pos.RealizedPnL); }
public CountryCurrency(DateTime datefrom, DateTime dateto, string currencysymbol, CurrencyPosition position, double rate) { this.DateFrom = datefrom; this.DateTo = dateto; this.CurrencySymbol = currencysymbol; this.Rate = rate; this.Position = position; }