TraderHelper
The auxiliary class for provision of various algorithmic functionalities.
プロパティ
IndicatorValue : DataType
Indicator value.
メソッド
AddAdapter(Connector, Type, Action<IMessageAdapter>) : IMessageAdapter
Create IMessageAdapter.
- connector
- The class to create connections to trading systems.
- adapterType
- Adapter type.
- init
- Initialize adapter.
戻り値: The class to create connections to trading systems.
AddAdapter``1(Connector, Action<T>)
Create IMessageAdapter.
- connector
- The class to create connections to trading systems.
- init
- Initialize adapter.
戻り値: The class to create connections to trading systems.
AddOrderErrorLog(ILogReceiver, Order, string, Func<string>)
Write order error to the log.
- receiver
- Logs receiver.
- order
- Order.
- operation
- Order action name.
- getAdditionalInfo
- Extended order info.
AddOrderInfoLog(ILogReceiver, Order, string, Func<string>)
Write order info to the log.
- receiver
- Logs receiver.
- order
- Order.
- operation
- Order action name.
- getAdditionalInfo
- Extended order info.
ApplyOffset(decimal, Sides, Unit, Security) : decimal
To use shifting for price, depending on direction .
- price
- Price.
- side
- The order direction, used as shift direction (for buy the shift is added, for sell - subtracted).
- offset
- Price shift.
- security
- Security.
戻り値: New price.
CancelOrders(IConnector, IEnumerable<Order>, bool?, Portfolio, Sides?, ExchangeBoard, Security, SecurityTypes?)
Cancel orders by filter.
- connector
- The connection of interaction with trade systems.
- orders
- The group of orders, from which the required orders shall be found and cancelled.
- isStopOrder
- , if cancel only a stop orders, - if regular orders, - both.
- portfolio
- Portfolio. If the value is equal to , then the portfolio does not match the orders cancel filter.
- side
- Order side. If the value is , the direction does not use.
- board
- Trading board. If the value is equal to , then the board does not match the orders cancel filter.
- security
- Instrument. If the value is equal to , then the instrument does not match the orders cancel filter.
- securityType
- Security type. If the value is , the type does not use.
Compile(string, IFileSystem, AssemblyLoadContextTracker) : ExpressionFormula<T>
Compile mathematical formula.
- expression
- Text expression.
- fileSystem
- File system.
- tracker
- AssemblyLoadContextTracker
戻り値: Compiled mathematical formula.
CompileAsync(string, IFileSystem, AssemblyLoadContextTracker, CancellationToken) : Task<ExpressionFormula<T>>
Compile mathematical formula.
- expression
- Text expression.
- fileSystem
- File system.
- tracker
- AssemblyLoadContextTracker
- cancellationToken
- CancellationToken
戻り値: Compiled mathematical formula.
CompileAsync``1(string, IFileSystem, AssemblyLoadContextTracker, CancellationToken)
Compile mathematical formula.
- expression
- Text expression.
- fileSystem
- File system.
- tracker
- AssemblyLoadContextTracker
- cancellationToken
- CancellationToken
戻り値: Compiled mathematical formula.
Compile``1(string, IFileSystem, AssemblyLoadContextTracker)
Compile mathematical formula.
- expression
- Text expression.
- fileSystem
- File system.
- tracker
- AssemblyLoadContextTracker
戻り値: Compiled mathematical formula.
Contains(BasketSecurity, ISecurityProvider, Security) : bool
To check whether specified instrument is used now.
- basketSecurity
- Instruments basket.
- securityProvider
- The provider of information about instruments.
- security
- The instrument that should be checked.
戻り値: , if specified instrument is used now, otherwise .
CreateProcessor(IBasketSecurityProcessorProvider, Security) : IBasketSecurityProcessor
Create market data processor for basket securities.
- processorProvider
- Basket security processors provider.
- security
- Basket security.
戻り値: Market data processor for basket securities.
DeleteAllAsync(ISecurityStorage, CancellationToken) : ValueTask
To delete all instruments.
- storage
- Securities meta info storage.
- cancellationToken
- CancellationToken
ExtractBoardsAsync(byte[]) : IAsyncEnumerable<BoardMessage>
Extract boards from the archive.
- archive
- The archive.
戻り値: Boards.
ExtractSecuritiesAsync(byte[]) : IAsyncEnumerable<SecurityMessage>
Extract securities from the archive.
- archive
- The archive.
戻り値: Securities.
FillFortsJumps(ExpirationContinuousSecurity, ISecurityProvider, string, DateTime, DateTime)
To fill transitions ExpirationJumps.
- continuousSecurity
- Continuous security.
- provider
- The provider of information about instruments.
- baseCode
- The base part of the instrument code.
- from
- The start of the expiration range.
- to
- The end of the expiration range.
Filter(IEnumerable<Order>, Security) : IEnumerable<MyTrade>
To filter orders for the given instrument.
- orders
- All orders, in which the required shall be searched for.
- security
- The instrument, for which the orders shall be filtered.
戻り値: Filtered orders.
Filter(IEnumerable<Position>, Security) : IEnumerable<MyTrade>
To filter positions for the given instrument.
- positions
- All positions, in which the required shall be searched for.
- security
- The instrument, for which positions shall be filtered.
戻り値: Filtered positions.
Filter(IEnumerable<MyTrade>, Security) : IEnumerable<MyTrade>
To filter own trades for the given instrument.
- myTrades
- All own trades, in which the required shall be looked for.
- security
- The instrument, on which the trades shall be found.
戻り値: Filtered trades.
GenerateId(SecurityIdGenerator, string, ExchangeBoard) : string
Generate SecurityId security.
- generator
- SecurityIdGenerator
- secCode
- Security code.
- board
- Security board.
戻り値: Id security.
GetAllSecurity(ISecurityProvider) : Security
Find AllSecurity instance in the specified provider.
- provider
- The provider of information about instruments.
戻り値: Found instance.
GetCurrentPrice(Security, IMarketDataProvider, Sides?) : decimal?
To calculate the current price by the instrument depending on the order direction.
- security
- The instrument used for the current price calculation.
- provider
- The market data provider.
- direction
- Order side.
戻り値: The current price. If information in order book is insufficient, then will be returned.
GetDirection(decimal) : Sides?
To get the order direction for the position.
- position
- The position value.
戻り値: Order side.
GetDirection(Position) : Sides?
To get the order direction for the position.
- position
- The position value.
戻り値: Order side.
GetFortsJumps(string, DateTime, DateTime, Func<string, Security>, bool) : IEnumerable<Security>
To get real expiration instruments for base part of the code.
- baseCode
- The base part of the instrument code.
- from
- The start of the expiration range.
- to
- The end of the expiration range.
- getSecurity
- The function to get instrument by the code.
- throwIfNotExists
- To generate exception, if some of instruments are not available.
戻り値: Expiration instruments.
GetFortsJumps(ExpirationContinuousSecurity, ISecurityProvider, string, DateTime, DateTime, bool) : IEnumerable<Security>
To get real expiration instruments for the continuous instrument.
- continuousSecurity
- Continuous security.
- provider
- The provider of information about instruments.
- baseCode
- The base part of the instrument code.
- from
- The start of the expiration range.
- to
- The end of the expiration range.
- throwIfNotExists
- To generate exception, if some of instruments for passed are not available.
戻り値: Expiration instruments.
GetInnerSecurities(BasketSecurity, ISecurityProvider) : IEnumerable<Security>
Find inner security instances.
- security
- Instruments basket.
- securityProvider
- The provider of information about instruments.
戻り値: Instruments, from which this basket is created.
GetOrCreate(ISecurityStorage, SecurityId, Func<string, Security>, bool) : Security
Get or create (if not exist).
- storage
- Securities meta info storage.
- id
- Security ID.
- creator
- Creator.
- isNew
- Is newly created.
戻り値: Security.
GetOrCreateAsync(ISecurityStorage, SecurityId, Func<string, Security>, CancellationToken) : ValueTask<ValueTuple<Security, bool>>
Get or create (if not exist).
- storage
- Securities meta info storage.
- id
- Security ID.
- creator
- Creator.
- cancellationToken
- CancellationToken
戻り値: Security and the flag whether it was newly created.
GetOrCreatePortfolio(IPositionStorage, string, Func<string, Portfolio>, bool) : Portfolio
Get or create (if not exist).
- storage
- Storage.
- portfolioName
- Portfolio code name.
- creator
- Creator.
- isNew
- Is newly created.
戻り値: Portfolio.
GetOrCreatePosition(IPositionStorage, Portfolio, Security, string, Sides?, string, string, TPlusLimits?, Func<Portfolio, Security, string, Sides?, string, string, TPlusLimits?, Position>, bool) : Position
Get or create (if not exist).
- storage
- Storage.
- portfolio
- Portfolio.
- security
- Security.
- strategyId
- Strategy ID.
- side
- Side.
- clientCode
- Client code.
- depoName
- Depo name.
- limitType
- Limit type.
- creator
- Creator.
- isNew
- Is newly created.
戻り値: Position.
GetPnL(IPnLManager) : decimal
Get the total profit and loss (PnL) value.
- manager
- IPnLManager
戻り値: Total profit and loss (PnL) value, which is the sum of unrealized and realized PnL.
GetPnL(Portfolio) : decimal
To calculate profit-loss based on the portfolio.
- portfolio
- The portfolio, for which the profit-loss shall be calculated.
戻り値: Profit-loss.
GetPosition(MyTrade) : decimal
To get the position on own trade.
- trade
- Own trade, used for position calculation. At buy the trade volume Volume is taken with positive sign, at sell - with negative.
戻り値: Position.
GetSecurityCriteria(Connector, SecurityLookupMessage, IExchangeInfoProvider) : Security
To create the search criteria Security from SecurityLookupMessage.
- connector
- Connection to the trading system.
- criteria
- The criterion which fields will be used as a filter.
- exchangeInfoProvider
- Exchanges and trading boards provider.
戻り値: Search criterion.
GetSecurityValues(IMarketDataProvider, Security) : IDictionary<Level1Fields, object>
To get all market data values for the instrument.
- provider
- The market data provider.
- security
- Security.
戻り値: Filed values. If there is no data, is returned.
GetSecurityValue``1(IMarketDataProvider, Security, Level1Fields)
To get the value of market data for the instrument.
- provider
- The market data provider.
- security
- Security.
- field
- Market-data field.
戻り値: The field value. If no data, the will be returned.
IsAssociated(SecurityId, ExchangeBoard) : bool
Is specified security id associated with the board.
- securityId
- Security ID.
- board
- Board info.
戻り値: , if associated, otherwise, .
IsContinuous(Security) : bool
Is specified security is continuous.
- security
- Security.
戻り値: Check result.
IsContinuous(SecurityMessage) : bool
Is specified security is continuous.
- security
- Security.
戻り値: Check result.
IsStockSharp(News) : bool
Determines whether the specified news related with StockSharp.
- news
- News.
戻り値: Check result.
IsTradeTime(ExchangeBoard, DateTime, bool?, WorkingTimePeriod) : bool
To check, whether the time is traded (has the session started, ended, is there a clearing).
- board
- Board info.
- time
- The passed time to be checked.
- isWorkingDay
- , if the date is traded, otherwise, is not traded.
- period
- Current working time period.
戻り値: , if time is traded, otherwise, not traded.
IsTradeTime(ExchangeBoard, DateTime) : bool
To check, whether the time is traded (has the session started, ended, is there a clearing).
- board
- Board info.
- time
- The passed time to be checked.
戻り値: , if time is traded, otherwise, not traded.
Lookup(ISecurityProvider, Security) : IEnumerable<Security>
Lookup securities by criteria .
- provider
- The provider of information about instruments.
- criteria
- The instrument whose fields will be used as a filter.
戻り値: Found instruments.
LookupAll(ISecurityProvider)
Get all available instruments.
- provider
- The provider of information about instruments.
戻り値: All available instruments.
LookupAll(Connector)
Lookup securities, portfolios and orders.
- connector
- The connection of interaction with trade systems.
LookupAllAsync(ISecurityProvider) : IAsyncEnumerable<Security>
Get all available instruments.
- provider
- The provider of information about instruments.
戻り値: All available instruments.
LookupByCode(ISecurityProvider, string, SecurityTypes?) : IEnumerable<Security>
To get the instrument by the instrument code.
- provider
- The provider of information about instruments.
- code
- Security code.
- type
- Security type.
戻り値: The got instrument. If there is no instrument by given criteria, is returned.
LookupByNativeIdAsync(ISecurityProvider, INativeIdStorageProvider, string, object, CancellationToken) : ValueTask<Security>
To get the instrument by the system identifier.
- provider
- The provider of information about instruments.
- nativeIdStorageProvider
- Security native identifier storage provider.
- storageName
- Storage name.
- nativeId
- Native (internal) trading system security id.
- cancellationToken
- CancellationToken
戻り値: The got instrument. If there is no instrument by given criteria, is returned.
ShrinkPrice(Order, ShrinkRules)
To cut the price for the order, to make it multiple of the minimal step, also to limit number of decimal places.
- order
- The order for which the price will be cut Price.
- rule
- The price rounding rule.
ShrinkPrice(Security, decimal, ShrinkRules) : decimal
To cut the price, to make it multiple of minimal step, also to limit number of signs after the comma.
- security
- The instrument from which the PriceStep and Decimals values are taken.
- price
- The price to be made multiple.
- rule
- The price rounding rule.
戻り値: The multiple price.
ToBasket(Security, IBasketSecurityProcessorProvider) : BasketSecurity
Convert Security to BasketSecurity value.
- security
- Security.
- processorProvider
- Basket security processors provider.
戻り値: Instruments basket.
ToBasket``1(IAsyncEnumerable<T>, Security, IBasketSecurityProcessorProvider)
Convert inner securities messages to basket.
- innerSecMessages
- Inner securities messages.
- security
- Basket security.
- processorProvider
- Basket security processors provider.
戻り値: Messages of basket securities.
ToBasket``1(IEnumerable<T>, Security, IBasketSecurityProcessorProvider)
Convert inner securities messages to basket.
- innerSecMessages
- Inner securities messages.
- security
- Basket security.
- processorProvider
- Basket security processors provider.
戻り値: Messages of basket securities.
ToBasket``1(Security)
Convert Security to BasketSecurity value.
- security
- Security.
戻り値: Instruments basket.
ToChannelState(ProcessStates) : ChannelStates
Convert ProcessStates value to ChannelStates.
- state
- ProcessStates value.
戻り値: ChannelStates value.
ToProcessState(ChannelStates) : ProcessStates
Convert ChannelStates value to ProcessStates.
- state
- ChannelStates value.
戻り値: ProcessStates value.
ToTimeQuotes(QuoteChangeMessage) : IEnumerable<TimeQuoteChange>
Convert depth to quotes.
- message
- Depth.
戻り値: Quotes.
ToTimeQuotes(IEnumerable<QuoteChangeMessage>) : IEnumerable<TimeQuoteChange>
Convert depths to quotes.
- messages
- Depths.
戻り値: Quotes.
TryGetAdapter(IPortfolioMessageAdapterProvider, IEnumerable<IMessageAdapter>, Portfolio) : IMessageAdapter
Get adapter by portfolio.
- portfolioProvider
- The portfolio based message adapter's provider.
- adapters
- All available adapters.
- portfolio
- Portfolio.
戻り値: Found adapter or .
TryGetAdapter(IPortfolioMessageAdapterProvider, IMessageAdapterProvider, Portfolio) : IMessageAdapter
Get adapter by portfolio.
- portfolioProvider
- The portfolio based message adapter's provider.
- adapterProvider
- The message adapter's provider.
- portfolio
- Portfolio.
戻り値: Found adapter or .
ValidateId(string) : string
To check the correctness of the entered identifier.
- id
- Security ID.
戻り値: An error message text, or if no error.