Table of Contents

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 IPortfolioProvider

Underlying provider.

Properties

Portfolios

Get all portfolios.

public IEnumerable<Portfolio> Portfolios { get; }

Property Value

IEnumerable<Portfolio>

Positions

Get all positions.

public IEnumerable<Position> Positions { get; }

Property Value

IEnumerable<Position>

SyncRoot

Sync object.

public SyncObject SyncRoot { get; }

Property Value

SyncObject

Methods

Delete(Portfolio)

Delete portfolio.

public void Delete(Portfolio portfolio)

Parameters

portfolio Portfolio

Portfolio.

Delete(Position)

Delete position.

public void Delete(Position position)

Parameters

position Position

Position.

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 Portfolio

The portfolio on which the position should be found.

security Security

The instrument on which the position should be found.

strategyId string

Strategy ID.

side Sides?

Side.

clientCode string

The client code.

depoName string

The 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 string

Portfolio code name.

Returns

Portfolio

The got portfolio. If there is no portfolio by given criteria, null is returned.

Save(Portfolio)

Save portfolio.

public void Save(Portfolio portfolio)

Parameters

portfolio Portfolio

Portfolio.

Save(Position)

Save position.

public void Save(Position position)

Parameters

position Position

Position.

Events

NewPortfolio

New portfolio received.

public event Action<Portfolio> NewPortfolio

Event Type

Action<Portfolio>

NewPosition

New position received.

public event Action<Position> NewPosition

Event Type

Action<Position>

PortfolioChanged

Portfolio changed.

public event Action<Portfolio> PortfolioChanged

Event Type

Action<Portfolio>

PositionChanged

Position changed.

public event Action<Position> PositionChanged

Event Type

Action<Position>