Class Core
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Namespace: TradingPlatform .BusinessLayer
Syntax
public class Core
Properties
AccountOperations
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public AccountOperation[] AccountOperations { get; }
Property Value
Type | Description |
---|---|
Account |
Accounts
Gets all available Accounts from open connections
Declaration
public Account[] Accounts { get; }
Property Value
Type | Description |
---|---|
Account[] |
Assets
Gets all available Assets from open connections
Declaration
public Asset[] Assets { get; }
Property Value
Type | Description |
---|---|
Asset[] |
BrandingInformation
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public IBrandingInformation BrandingInformation { get; }
Property Value
Type | Description |
---|---|
IBranding |
ClosedPositions
Gets all available Closed
Declaration
public ClosedPosition[] ClosedPositions { get; }
Property Value
Type | Description |
---|---|
Closed |
Connections
Gets an access to all created connections and manages them
Declaration
public ConnectionsManager Connections { get; }
Property Value
Type | Description |
---|---|
Connections |
CorporateActions
Gets all available Corporate
Declaration
public CorporateAction[] CorporateActions { get; }
Property Value
Type | Description |
---|---|
Corporate |
CurrentVersion
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public Version CurrentVersion { get; }
Property Value
Type | Description |
---|---|
Version |
CustomSessions
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public CustomSessionsManager CustomSessions { get; }
Property Value
Type | Description |
---|---|
Custom |
DealTickets
Gets all available Deal
Declaration
public DealTicket[] DealTickets { get; }
Property Value
Type | Description |
---|---|
Deal |
DeliveredAssets
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public DeliveredAsset[] DeliveredAssets { get; }
Property Value
Type | Description |
---|---|
Delivered |
Exchanges
Gets all available Exchanges from open connections
Declaration
public Exchange[] Exchanges { get; }
Property Value
Type | Description |
---|---|
Exchange[] |
Indicators
Gets an access to the all available indicators and creates them
Declaration
public IndicatorManager Indicators { get; }
Property Value
Type | Description |
---|---|
Indicator |
Instance
Gets a singleton instance of Core. API entry point
Declaration
public static Core Instance { get; }
Property Value
Type | Description |
---|---|
Core |
LocalOrders
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public LocalOrdersManager LocalOrders { get; }
Property Value
Type | Description |
---|---|
Local |
Loggers
Gets an access to the system logging mechanism
Declaration
public LoggerManager Loggers { get; }
Property Value
Type | Description |
---|---|
Logger |
MailUtils
Gets SMTP mail service for sending emails
Declaration
public MailUtils MailUtils { get; }
Property Value
Type | Description |
---|---|
Mail |
Messengers
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public MessengersManager Messengers { get; }
Property Value
Type | Description |
---|---|
Messengers |
OrderPlacingStrategies
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public OrderPlacingStrategiesManager OrderPlacingStrategies { get; }
Property Value
Type | Description |
---|---|
Order |
OrderTypes
Gets all available Order
Declaration
public OrderType[] OrderTypes { get; }
Property Value
Type | Description |
---|---|
Order |
Orders
Gets all available Orders from open connections
Declaration
public Order[] Orders { get; }
Property Value
Type | Description |
---|---|
Order[] |
Positions
Gets all available Positions from open connections
Declaration
public Position[] Positions { get; }
Property Value
Type | Description |
---|---|
Position[] |
ReportTypes
Gets all available Report
Declaration
public ReportType[] ReportTypes { get; }
Property Value
Type | Description |
---|---|
Report |
Strategies
Gets an access to the all available trading strategies and manages them
Declaration
public StrategyManager Strategies { get; }
Property Value
Type | Description |
---|---|
Strategy |
SymbolTypes
Gets all available Symbol
Declaration
public SymbolType[] SymbolTypes { get; }
Property Value
Type | Description |
---|---|
Symbol |
Symbols
Gets all available Symbols from open connections
Declaration
public Symbol[] Symbols { get; }
Property Value
Type | Description |
---|---|
Symbol[] |
SymbolsMapping
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public SymbolsMappingManager SymbolsMapping { get; }
Property Value
Type | Description |
---|---|
Symbols |
TimeUtils
Gets a time based conversion and synchronization mechanism
Declaration
public TimeUtils TimeUtils { get; }
Property Value
Type | Description |
---|---|
Time |
TradingProtection
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public TradingProtector TradingProtection { get; }
Property Value
Type | Description |
---|---|
Trading |
TradingStatus
Represents current trading status
Declaration
public TradingStatus TradingStatus { get; set; }
Property Value
Type | Description |
---|---|
Trading |
VolumeAnalysis
Access to Volume Analysis calculations
Declaration
public VolumeAnalysisManager VolumeAnalysis { get; }
Property Value
Type | Description |
---|---|
Volume |
Methods
Alert(string, string, string, Action)
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public void Alert(string text, string symbolName = "", string connectionName = "", Action onConfirm = null)
Parameters
Alert(string, string, string, Action, string)
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public void Alert(string text, string symbolName, string connectionName, Action onConfirm, string alertName)
Parameters
Type | Name | Description |
---|---|---|
string | text | |
string | symbolName | |
string | connectionName | |
Action | onConfirm | |
string | alertName |
Alert(Alert)
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public void Alert(Alert alert)
Parameters
Type | Name | Description |
---|---|---|
Alert | alert |
CalculatePnL(PnLRequestParameters)
Gets Profit'n'Loss Pn
Declaration
public PnL CalculatePnL(PnLRequestParameters parameters)
Parameters
Type | Name | Description |
---|---|---|
Pn |
parameters |
Returns
Type | Description |
---|---|
Pn |
CancelOrder(CancelOrderRequestParameters)
Cancels Order with given request parameters
Declaration
public TradingOperationResult CancelOrder(CancelOrderRequestParameters request)
Parameters
Type | Name | Description |
---|---|---|
Cancel |
request |
Returns
Type | Description |
---|---|
Trading |
CancelOrder(Order, string)
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public TradingOperationResult CancelOrder(Order order, string sendingSource = null)
Parameters
Returns
Type | Description |
---|---|
Trading |
ClosePosition(ClosePositionRequestParameters)
Closes Position with given request parameters
Declaration
public TradingOperationResult ClosePosition(ClosePositionRequestParameters request)
Parameters
Type | Name | Description |
---|---|---|
Close |
request |
Returns
Type | Description |
---|---|
Trading |
ClosePosition(Position, double)
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public TradingOperationResult ClosePosition(Position position, double closeQuantity = -1)
Parameters
Returns
Type | Description |
---|---|
Trading |
ForceTimeSync()
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public void ForceTimeSync()
GetAccount(BusinessObjectInfo)
Gets an instance of exist Account or creates a new one with given info parameter
Declaration
public Account GetAccount(BusinessObjectInfo accountInfo)
Parameters
Type | Name | Description |
---|---|---|
Business |
accountInfo |
Returns
Type | Description |
---|---|
Account |
GetOrderById(string, string)
Gets Order instance by given Id string. Otherwise returns null
Declaration
public Order GetOrderById(string orderId, string connectionId = null)
Parameters
Type | Name | Description |
---|---|---|
string | orderId | |
string | connectionId | Must be specified if open connections total is more than one |
Returns
Type | Description |
---|---|
Order |
GetOrderType(string, string)
Gets Order
Declaration
public OrderType GetOrderType(string orderTypeId, string connectionId = null)
Parameters
Type | Name | Description |
---|---|---|
string | orderTypeId | |
string | connectionId | Must be specified if open connections total is more than one |
Returns
Type | Description |
---|---|
Order |
GetOrdersHistory(OrdersHistoryRequestParameters, string)
Gets collection of Order
Declaration
public IList<OrderHistory> GetOrdersHistory(OrdersHistoryRequestParameters parameters, string connectionId = null)
Parameters
Type | Name | Description |
---|---|---|
Orders |
parameters | |
string | connectionId |
Returns
Type | Description |
---|---|
IList<Order |
GetPositionById(string, string)
Gets Position instance by given Id string. Otherwise returns null
Declaration
public Position GetPositionById(string positionId, string connectionId = null)
Parameters
Type | Name | Description |
---|---|---|
string | positionId | |
string | connectionId | Must be specified if open connections total is more than one |
Returns
Type | Description |
---|---|
Position |
GetReport(ReportRequestParameters)
Returns Report with given request parameters from open connection
Declaration
public Report GetReport(ReportRequestParameters requestParameters)
Parameters
Type | Name | Description |
---|---|---|
Report |
requestParameters |
Returns
Type | Description |
---|---|
Report |
GetSymbol(BusinessObjectInfo)
Gets an instance of exist symbol or creates a new one with given info parameter
Declaration
public Symbol GetSymbol(BusinessObjectInfo symbolInfo)
Parameters
Type | Name | Description |
---|---|---|
Business |
symbolInfo |
Returns
Type | Description |
---|---|
Symbol |
GetSymbol(GetSymbolRequestParameters, string, NonFixedListDownload)
Retrieves any Symbol by given request parameters. Otherwise returns null
Declaration
public Symbol GetSymbol(GetSymbolRequestParameters requestParameters, string connectionId = null, NonFixedListDownload downloadSymbol = NonFixedListDownload.Download)
Parameters
Type | Name | Description |
---|---|---|
Get |
requestParameters | |
string | connectionId | Must be specified if open connections total is more than one. Will search only in Synthetic symbols list if id is equal to SYNTHETIC_CONNECTION_ID |
Non |
downloadSymbol |
Returns
Type | Description |
---|---|
Symbol |
GetTrades(TradesHistoryRequestParameters, string)
Gets collection of Trade by given parameters
Declaration
public IList<Trade> GetTrades(TradesHistoryRequestParameters parameters, string connectionId = null)
Parameters
Type | Name | Description |
---|---|---|
Trades |
parameters | |
string | connectionId |
Returns
GetTrades(TradesHistoryRequestParameters, AccountTradesLoadingCallback, string)
Gets collection of Trade by given parameters and callback
Declaration
public void GetTrades(TradesHistoryRequestParameters parameters, AccountTradesLoadingCallback callback, string connectionId = null)
Parameters
Type | Name | Description |
---|---|---|
Trades |
parameters | |
Account |
callback | |
string | connectionId |
Exceptions
Type | Condition |
---|---|
Argument |
InitializeBrandingInformation()
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public void InitializeBrandingInformation()
ModifyOrder(ModifyOrderRequestParameters)
Modifies Order by given request parameters
Declaration
public TradingOperationResult ModifyOrder(ModifyOrderRequestParameters request)
Parameters
Type | Name | Description |
---|---|---|
Modify |
request |
Returns
Type | Description |
---|---|
Trading |
ModifyOrder(Order, TimeInForce, double, double, double, double)
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public TradingOperationResult ModifyOrder(Order order, TimeInForce timeInForce = TimeInForce.Default, double quantity = 1, double price = -1, double triggerPrice = -1, double trailOffset = -1)
Parameters
Type | Name | Description |
---|---|---|
Order | order | |
Time |
timeInForce | |
double | quantity | |
double | price | |
double | triggerPrice | |
double | trailOffset |
Returns
Type | Description |
---|---|
Trading |
PlaceOrder(PlaceOrderRequestParameters)
Places Order with given request parameters
Declaration
public TradingOperationResult PlaceOrder(PlaceOrderRequestParameters request)
Parameters
Type | Name | Description |
---|---|---|
Place |
request |
Returns
Type | Description |
---|---|
Trading |
PlaceOrder(Symbol, Account, Side, TimeInForce, double, double, double, double)
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public TradingOperationResult PlaceOrder(Symbol symbol, Account account, Side side, TimeInForce timeInForce = TimeInForce.Day, double quantity = 1, double price = -1, double triggerPrice = -1, double trailOffset = -1)
Parameters
Type | Name | Description |
---|---|---|
Symbol | symbol | |
Account | account | |
Side | side | |
Time |
timeInForce | |
double | quantity | |
double | price | |
double | triggerPrice | |
double | trailOffset |
Returns
Type | Description |
---|---|
Trading |
PlaceOrders(ICollection<PlaceOrderRequestParameters>, GroupOrderType)
Places multiple Orders with given request parameters
Declaration
public void PlaceOrders(ICollection<PlaceOrderRequestParameters> requests, GroupOrderType groupOrderType = GroupOrderType.None)
Parameters
Type | Name | Description |
---|---|---|
ICollection<Place |
requests | |
Group |
groupOrderType |
RequestOTP(OTPHolder, string, string)
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public void RequestOTP(OTPHolder otpHolder, string title, string text)
Parameters
SendCustomRequest(string, RequestParameters)
Sends custom request if connection with given Id is open
Declaration
public void SendCustomRequest(string connectionId, RequestParameters parameters)
Parameters
Type | Name | Description |
---|---|---|
string | connectionId | |
Request |
parameters |
SubscribeToCustomMessages(Action<CustomMessage>, params int[])
Subscribe on custom messages
Declaration
public void SubscribeToCustomMessages(Action<CustomMessage> handler, params int[] messagesTypes)
Parameters
Type | Name | Description |
---|---|---|
Action<Custom |
handler | custom message handler |
int[] | messagesTypes | custom messages Id |
UnsubscribeFromCustomMessages(Action<CustomMessage>, params int[])
Unsubscribe from custom messages
Declaration
public void UnsubscribeFromCustomMessages(Action<CustomMessage> handler, params int[] messagesTypes)
Parameters
Type | Name | Description |
---|---|---|
Action<Custom |
handler | custom message handler |
int[] | messagesTypes | custom messages Id |
Events
AccountAdded
Will be triggered when new Account added to the core
Declaration
public event Action<Account> AccountAdded
Event Type
ClosedPositionAdded
Will be triggered when new Closed
Declaration
public event Action<ClosedPosition> ClosedPositionAdded
Event Type
Type | Description |
---|---|
Action<Closed |
ClosedPositionRemoved
Will be triggered when Closed
Declaration
public event Action<ClosedPosition> ClosedPositionRemoved
Event Type
Type | Description |
---|---|
Action<Closed |
CorporateActionAdded
Will be triggered when new Corporate
Declaration
public event Action<CorporateAction> CorporateActionAdded
Event Type
Type | Description |
---|---|
Action<Corporate |
DealTicketReceived
Will be triggered when new Deal
Declaration
public event Action<DealTicket> DealTicketReceived
Event Type
Type | Description |
---|---|
Action<Deal |
DeliveredAssetAdded
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public event Action<DeliveredAsset> DeliveredAssetAdded
Event Type
Type | Description |
---|---|
Action<Delivered |
DeliveredAssetRemoved
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public event Action<DeliveredAsset> DeliveredAssetRemoved
Event Type
Type | Description |
---|---|
Action<Delivered |
OnAlert
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public event Action<Alert> OnAlert
Event Type
OnAskUserConfirmationForTradingWithRunningEmulator
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public event Func<string, string, bool> OnAskUserConfirmationForTradingWithRunningEmulator
Event Type
OnRequestOTP
The main entry point in the API. Core keeps access to all business logic entities and their properties: connections, accounts, symbols, positions, orders, etc. Some of them can be reached through using managers or directly via specified collections. You can always access the Core object via static Core.Instance property.
Declaration
public event Action<OTPHolder, string, string> OnRequestOTP
Event Type
OnTradingStatusChanged
Will be triggered when Trading
Declaration
public event Action<TradingStatus> OnTradingStatusChanged
Event Type
Type | Description |
---|---|
Action<Trading |
OrderAdded
Will be triggered when new Order placed
Declaration
public event Action<Order> OrderAdded
Event Type
OrderRemoved
Will be triggered when Order canceled
Declaration
public event Action<Order> OrderRemoved
Event Type
OrdersHistoryAdded
Will be triggered when new Order
Declaration
public event Action<OrderHistory> OrdersHistoryAdded
Event Type
Type | Description |
---|---|
Action<Order |
PositionAdded
Will be triggered when new Position opened
Declaration
public event Action<Position> PositionAdded
Event Type
PositionRemoved
Will be triggered when Position closed
Declaration
public event Action<Position> PositionRemoved
Event Type
SymbolAdded
Will be triggered when new Symbol added to the core
Declaration
public event Action<Symbol> SymbolAdded
Event Type
TradeAdded
Will be triggered when new Trade occured
Declaration
public event Action<Trade> TradeAdded