Account Performance Calculation
In BFS Account Performance is calculated on a daily basis. For each day in a period the relative change of value of an account or a group of accounts is calculated in the following manner:
The closing value of the account of the previous day is recorded (Y = Yesterday's value).
All transactions of the current day that don't have at ReturnCalculationType of "Transfer" are summed (R = Realized result)
All transactions with ReturnCalculationType of "Transfer" are summed (T = Transfers)
The closing value of the current day is recorded (C) and yesterdays value (Y) is subtracted (U = Unrealized result)
The total of R+U is divided by Y to get the relative change of the current day (D)
C is added to T to go into the next day's calculation as Y
Then for the days in the period 1, 2, 3, ... , n the total  change is calculated as (1 + C1) * (1 + C2) * (1 + C3) * ... * (1 + Cn) - 1.
Pseudo-code, which we use for the calculation
// data model of the input
public class SourceValueRecordForPerformanceCalculation
{
public DateTime Date { get; set; }
public Decimal ValueOfTransferTransactionsInDisplayCurrency { get; set; }
public Decimal YesterdaysValueOfPositionsInDisplayCurrency { get; set; }
public Decimal TodaysValueOfPositionsInDisplayCurrency { get; set; }
public string DisplayCurrencyCode { get; set; }
}
public static DailyPerformanceRecord GetSingleDayPerformanceRecord(SourceValueRecordForPerformanceCalculation sourceValue)
{
// The calculation for a day record
Decimal num1 = sourceValue.YesterdaysValueOfPositionsInDisplayCurrency + sourceValue.ValueOfTransferTransactionsInDisplayCurrency;
Decimal num2 = sourceValue.TodaysValueOfPositionsInDisplayCurrency - num1;
Decimal num3 = !(num2 != 0M) || !(num1 != 0M) ? 0M : num2 / Math.Abs(num1);
return new DailyPerformanceRecord()
{
Date = sourceValue.Date,
AbsoluteReturn = num2,
PercentageReturn = num3,
ReturnCurrency = sourceValue.DisplayCurrencyCode
};
}
Examples
Â
Related pages
© 2009 - 2023 Huddlestock Technologies AB All rights reserved | Huddlestock Terms of use | Support portal