Prediction markets: news reaction, clues, gas/CRA/era markets, intel broker, bigger stakes
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ca3230e7d2
commit
002606056d
12 files changed
+637
-52
No files matched your search
@@ -108,6 +108,14 @@ namespace Decentralized.Domain
|
||||
}
|
||||
|
||||
/// <summary>按价格表估值(信用点)。</summary>
|
||||
/// <summary>花掉(销毁)一笔币:污点与成本按这笔币占钱包总价值的比例一起带走。</summary>
|
||||
public void Spend(string asset, double amount, Func<string, double> price)
|
||||
{
|
||||
double total = Value(price), share = total > 0 ? Math.Min(1, amount * price(asset) / total) : 0;
|
||||
double taint = Taint * share, basis = Basis * share;
|
||||
Add(asset, -amount); Taint -= taint; Basis -= basis;
|
||||
}
|
||||
|
||||
public double Value(Func<string, double> price) => Balances.Sum(kv => kv.Value * price(kv.Key));
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user