F6: finanza completa, correzioni della revisione
Corregge i rilievi della revisione della finanza completa (ADR 0019). - Rating: il margine resta neutro finché la finestra non è piena e ha meno di finance.ratingMinRevenueMonths (3) mesi con ricavi, così il primo incasso piccolo dopo mesi di soli costi non fa perdere tre o quattro gradini (e non fissa uno spread pessimo per dieci anni); senza ricavi e in perdita il margine è il minimo. Corretta l'affermazione dell'ADR. - Avvisi di cassa negativa dopo finance.negativeCashNoticeDays (3) giorni di fila e notizia di rientro solo dopo quel primo avviso: una cassa che oscilla intorno a zero non riempie le notizie. - Spiegazione del rating: se il punteggio vale già il gradino sopra lo dice (NextAlreadyMet, ScoreRating) senza obiettivi negativi né leve infinite sul filo; il rimborso indicato è segnato come non possibile oggi se supera la cassa o il residuo dei prestiti (RepayAffordable). - Nuovi concorrenti: la quota dei trasporti usa Company.TransportRevenue (tariffe, noli, contratti), non dividendi incassati né commercio. - Client: barra del conto alla rovescia solo con lo scoperto, frasi intere con segnaposto in strings.csv, testo distinto per bancarotta e amministrazione controllata; ClimbOutlook.LoansAllowed allineato. - PROTOCOL.md: tabella dei valori di LedgerEntry e campi nuovi di FinanceReport; ServerTests non dipende più dal cambio di mese. Refs #39. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9bf64b9286
commit
1f8830337a
20 files changed
+354
-97
No files matched your search
@@ -151,6 +151,13 @@ public sealed class FinanceReport : IMessage
|
||||
/// <summary>Prima del primo calcolo mensile: rating iniziale dei dati, misure di oggi.</summary>
|
||||
public bool RatingInitial { get; init; }
|
||||
public byte RatingMonths { get; init; }
|
||||
/// <summary>
|
||||
/// Mesi della finestra con ricavi; con <see cref="MarginNeutral"/> il margine vale 0 finché non ce ne
|
||||
/// sono <see cref="MinRevenueMonths"/> (o la finestra non è piena).
|
||||
/// </summary>
|
||||
public byte RevenueMonths { get; init; }
|
||||
public bool MarginNeutral { get; init; }
|
||||
public byte MinRevenueMonths { get; init; }
|
||||
public float Margin { get; init; }
|
||||
/// <summary>Debiti / patrimonio netto; con <see cref="LeverageUnbounded"/> il patrimonio non è positivo e la leva è infinita.</summary>
|
||||
public float Leverage { get; init; }
|
||||
@@ -161,14 +168,22 @@ public sealed class FinanceReport : IMessage
|
||||
public float LeverageComponent { get; init; }
|
||||
public float Score { get; init; }
|
||||
public List<RatingThresholdInfo> Thresholds { get; init; } = [];
|
||||
/// <summary>Gradino sopra ("" ad AAA) con la soglia, il margine che basterebbe, la leva massima e il debito da rimborsare.</summary>
|
||||
/// <summary>
|
||||
/// Gradino sopra ("" ad AAA) con la soglia, il margine che basterebbe, la leva massima e il debito da
|
||||
/// rimborsare; con <see cref="NextAlreadyMet"/> il punteggio basta già (rating <see cref="ScoreRating"/>
|
||||
/// al prossimo calcolo mensile) e gli obiettivi non si calcolano.
|
||||
/// </summary>
|
||||
public string NextRating { get; init; } = "";
|
||||
public float NextThreshold { get; init; }
|
||||
public bool NextAlreadyMet { get; init; }
|
||||
public string ScoreRating { get; init; } = "";
|
||||
public float MarginNeeded { get; init; }
|
||||
public bool MarginReachable { get; init; }
|
||||
public float LeverageMax { get; init; }
|
||||
public bool LeverageReachable { get; init; }
|
||||
public Money DebtToRepay { get; init; }
|
||||
/// <summary>Il rimborso indicato non supera la cassa né il residuo dei prestiti (lo scoperto non si rimborsa).</summary>
|
||||
public bool RepayAffordable { get; init; }
|
||||
|
||||
/// <summary>Prestiti, fido e condizioni di un nuovo prestito (base della difficoltà + spread del rating).</summary>
|
||||
public List<FinanceLoanInfo> LoanList { get; init; } = [];
|
||||
@@ -194,12 +209,13 @@ public sealed class FinanceReport : IMessage
|
||||
foreach (var l in Lines) l.Write(ref w);
|
||||
w.Count(Columns.Count);
|
||||
foreach (var c in Columns) c.Write(ref w);
|
||||
w.String(Rating); w.Bool(RatingInitial); w.U8(RatingMonths); w.F32(Margin); w.F32(Leverage); w.Bool(LeverageUnbounded);
|
||||
w.String(Rating); w.Bool(RatingInitial); w.U8(RatingMonths); w.U8(RevenueMonths); w.Bool(MarginNeutral); w.U8(MinRevenueMonths); w.F32(Margin); w.F32(Leverage); w.Bool(LeverageUnbounded);
|
||||
w.F32(MarginWeight); w.F32(LeverageWeight); w.F32(MarginComponent); w.F32(LeverageComponent); w.F32(Score);
|
||||
w.Count(Thresholds.Count);
|
||||
foreach (var t in Thresholds) t.Write(ref w);
|
||||
w.String(NextRating); w.F32(NextThreshold); w.F32(MarginNeeded); w.Bool(MarginReachable); w.F32(LeverageMax); w.Bool(LeverageReachable);
|
||||
w.Money(DebtToRepay);
|
||||
w.String(NextRating); w.F32(NextThreshold); w.Bool(NextAlreadyMet); w.String(ScoreRating);
|
||||
w.F32(MarginNeeded); w.Bool(MarginReachable); w.F32(LeverageMax); w.Bool(LeverageReachable);
|
||||
w.Money(DebtToRepay); w.Bool(RepayAffordable);
|
||||
w.Count(LoanList.Count);
|
||||
foreach (var l in LoanList) l.Write(ref w);
|
||||
w.Money(MaxLoan); w.Money(LoanAvailable); w.F32(NewLoanRate); w.F32(BaseRate); w.F32(Spread); w.I32(LoanTermMonths); w.Money(LoanStep);
|
||||
@@ -222,18 +238,24 @@ public sealed class FinanceReport : IMessage
|
||||
for (int n = r.Count(), i = 0; i < n; i++) columns.Add(IncomeColumnInfo.Read(ref r));
|
||||
string rating = r.String();
|
||||
bool initial = r.Bool();
|
||||
byte months = r.U8();
|
||||
byte months = r.U8(), revenueMonths = r.U8();
|
||||
bool neutral = r.Bool();
|
||||
byte minRevenueMonths = r.U8();
|
||||
float margin = r.F32(), leverage = r.F32();
|
||||
bool unbounded = r.Bool();
|
||||
float marginWeight = r.F32(), leverageWeight = r.F32(), marginComponent = r.F32(), leverageComponent = r.F32(), score = r.F32();
|
||||
var thresholds = new List<RatingThresholdInfo>();
|
||||
for (int n = r.Count(), i = 0; i < n; i++) thresholds.Add(RatingThresholdInfo.Read(ref r));
|
||||
string next = r.String();
|
||||
float nextThreshold = r.F32(), marginNeeded = r.F32();
|
||||
float nextThreshold = r.F32();
|
||||
bool alreadyMet = r.Bool();
|
||||
string scoreRating = r.String();
|
||||
float marginNeeded = r.F32();
|
||||
bool marginReachable = r.Bool();
|
||||
float leverageMax = r.F32();
|
||||
bool leverageReachable = r.Bool();
|
||||
var repay = r.Money();
|
||||
bool affordable = r.Bool();
|
||||
var loanList = new List<FinanceLoanInfo>();
|
||||
for (int n = r.Count(), i = 0; i < n; i++) loanList.Add(FinanceLoanInfo.Read(ref r));
|
||||
var maxLoan = r.Money();
|
||||
@@ -249,11 +271,12 @@ public sealed class FinanceReport : IMessage
|
||||
{
|
||||
Day = day, Company = company, Cash = cash, NetWorth = worth, Loans = loans, Overdraft = overdraft,
|
||||
Lines = lines, Columns = columns,
|
||||
Rating = rating, RatingInitial = initial, RatingMonths = months, Margin = margin, Leverage = leverage, LeverageUnbounded = unbounded,
|
||||
Rating = rating, RatingInitial = initial, RatingMonths = months, RevenueMonths = revenueMonths, MarginNeutral = neutral,
|
||||
MinRevenueMonths = minRevenueMonths, Margin = margin, Leverage = leverage, LeverageUnbounded = unbounded,
|
||||
MarginWeight = marginWeight, LeverageWeight = leverageWeight, MarginComponent = marginComponent, LeverageComponent = leverageComponent,
|
||||
Score = score, Thresholds = thresholds,
|
||||
NextRating = next, NextThreshold = nextThreshold, MarginNeeded = marginNeeded, MarginReachable = marginReachable,
|
||||
LeverageMax = leverageMax, LeverageReachable = leverageReachable, DebtToRepay = repay,
|
||||
NextRating = next, NextThreshold = nextThreshold, NextAlreadyMet = alreadyMet, ScoreRating = scoreRating, MarginNeeded = marginNeeded, MarginReachable = marginReachable,
|
||||
LeverageMax = leverageMax, LeverageReachable = leverageReachable, DebtToRepay = repay, RepayAffordable = affordable,
|
||||
LoanList = loanList, MaxLoan = maxLoan, LoanAvailable = available, NewLoanRate = newRate, BaseRate = baseRate, Spread = spread,
|
||||
LoanTermMonths = term, LoanStep = step, LoansAllowed = allowed,
|
||||
NegativeCashDays = negDays, BankruptcyDays = limit, Bankrupt = bankrupt, Receivership = receivership,
|
||||
|
||||
Reference in new issue
Block a user