Class InMemoryPositionStorage
- Namespace
- StockSharp.Algo.Storages
- Assembly
- StockSharp.Algo.dll
In memory implementation of IPositionStorage.
public class InMemoryPositionStorage : IPositionStorage, IPositionProvider, IPortfolioProvider
- Inheritance
-
InMemoryPositionStorage
- Implements
- Inherited Members
- Extension Methods
Constructors
InMemoryPositionStorage()
Initializes a new instance of the InMemoryPositionStorage.
public InMemoryPositionStorage()
InMemoryPositionStorage(IPortfolioProvider)
Initializes a new instance of the InMemoryPositionStorage.
public InMemoryPositionStorage(IPortfolioProvider underlying)
Parameters
underlying
IPortfolioProviderUnderlying provider.
Properties
Portfolios
Get all portfolios.
public IEnumerable<Portfolio> Portfolios { get; }
Property Value
Positions
Get all positions.
public IEnumerable<Position> Positions { get; }
Property Value
SyncRoot
Sync object.
public SyncObject SyncRoot { get; }
Property Value
- SyncObject
Methods
Delete(Portfolio)
Delete portfolio.
public void Delete(Portfolio portfolio)
Parameters
portfolio
PortfolioPortfolio.
Delete(Position)
Delete position.
public void Delete(Position position)
Parameters
position
PositionPosition.
GetPosition(Portfolio, Security, string, Sides?, string, string, TPlusLimits?)
To get the position by portfolio and instrument.
public Position GetPosition(Portfolio portfolio, Security security, string strategyId, Sides? side, string clientCode = "", string depoName = "", TPlusLimits? limitType = null)
Parameters
portfolio
PortfolioThe portfolio on which the position should be found.
security
SecurityThe instrument on which the position should be found.
strategyId
stringStrategy ID.
side
Sides?Side.
clientCode
stringThe client code.
depoName
stringThe depository name where the stock is located physically. By default, an empty string is passed, which means the total position by all depositories.
limitType
TPlusLimits?Limit type for Т+ market.
Returns
- Position
Position.
LookupByPortfolioName(string)
To get the portfolio by the code name.
public Portfolio LookupByPortfolioName(string name)
Parameters
name
stringPortfolio code name.
Returns
Save(Portfolio)
Save portfolio.
public void Save(Portfolio portfolio)
Parameters
portfolio
PortfolioPortfolio.
Save(Position)
Save position.
public void Save(Position position)
Parameters
position
PositionPosition.
Events
NewPortfolio
New portfolio received.
public event Action<Portfolio> NewPortfolio
Event Type
NewPosition
New position received.
public event Action<Position> NewPosition
Event Type
PortfolioChanged
Portfolio changed.
public event Action<Portfolio> PortfolioChanged
Event Type
PositionChanged
Position changed.
public event Action<Position> PositionChanged