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:

  1. The closing value of the account of the previous day is recorded (Y = Yesterday's value).

  2. All transactions of the current day that don't have at ReturnCalculationType of "Transfer" are summed (R = Realized result)

  3. All transactions with ReturnCalculationType of "Transfer" are summed (T = Transfers)

  4. The closing value of the current day is recorded (C) and yesterdays value (Y) is subtracted (U = Unrealized result)

  5. The total of R+U is divided by Y to get the relative change of the current day (D)

  6. 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

Avkastningsberäkning.xlsx

 

Related pages

© 2009 - 2023 Huddlestock Technologies AB All rights reserved | Huddlestock Terms of use | Support portal