public MatchedBetCalculatorViewModel(IMatchedBet matchedBet) { this.matchedBet = matchedBet; CreateCalculators(); SetCalculatorsInModel(); Messenger.Default.Register<MatchedBetTargetChangedMessage>(this, TargetChanged); Messenger.Default.Register<MatchedBetTargetLayOddsChangedMessage>(this, OddsChanged); }
public int Calculate(IMatchedBet matchedBet) { var divisor = (matchedBet.LayOdds - matchedBet.LayCommission); if (divisor != 0) { var layStake = (matchedBet.BackWinReturn + matchedBet.BackStake) / divisor ; return (int)Math.Round(layStake); } return 0; }
public int CalculateLayProfit(IMatchedBet matchedBet) { var layReturn = (matchedBet.LayWinReturn * (1 - matchedBet.LayCommission)); return (int)Math.Round(layReturn); }
public int CalculateBackProfit(IMatchedBet matchedBet) { var backReturn = (matchedBet.BackWinReturn) - matchedBet.LayLossAmount; return backReturn; }
public int Calculate(IMatchedBet matchedBet) { var layStake = (matchedBet.BackWinReturn) / (matchedBet.LayOdds - matchedBet.LayCommission); return (int)Math.Round(layStake); }