47 lines
1.1 KiB
C#
47 lines
1.1 KiB
C#
using System.Collections.Concurrent;
|
|
|
|
namespace KLHZ.Trader.Core.Exchange.Models.AssetsAccounting
|
|
{
|
|
public class ManagedAccount : LockableExchangeObject
|
|
{
|
|
public readonly string AccountId;
|
|
private readonly object _locker = new();
|
|
private decimal _balance = 0;
|
|
private decimal _total = 0;
|
|
|
|
internal decimal Balance
|
|
{
|
|
get
|
|
{
|
|
lock (_locker)
|
|
return _balance;
|
|
}
|
|
set
|
|
{
|
|
lock (_locker)
|
|
_balance = value;
|
|
}
|
|
}
|
|
internal decimal Total
|
|
{
|
|
get
|
|
{
|
|
lock (_locker)
|
|
return _total;
|
|
}
|
|
set
|
|
{
|
|
lock (_locker)
|
|
_total = value;
|
|
}
|
|
}
|
|
|
|
internal readonly ConcurrentDictionary<string, Asset> Assets = new();
|
|
|
|
public ManagedAccount(string accountId)
|
|
{
|
|
AccountId = accountId;
|
|
}
|
|
}
|
|
}
|