Connection

View as Markdown

Definition

The Connection class can be used to monitor connection related events as well as accessing connection related information.

Static Connection Class Events and Properties

MethodDescription
CancelAllOrders()Cancels all orders
Connect()Connects to a connection
ConnectionStatusUpdateEvent handler for connection status updates

Events and Properties from Connection instances

PropertyDescription
AccountsList of accounts from the connection
Disconnect()Disconnects from the connection
OptionsThe connection’s configuration options
PriceStatusA ConnectionStatus representing the status of the price feed. Possible values are:
• ConnectionStatus.Connected
• ConnectionStatus.Connecting
• ConnectionStatus.ConnectionLost
• ConnectionStatus.Disconnecting
• ConnectionStatus.Disconnected
StatusA ConnectionStatus representing the status of the order feed. Possible values are:
• ConnectionStatus.Connected
• ConnectionStatus.Connecting
• ConnectionStatus.ConnectionLost
• ConnectionStatus.Disconnecting
• ConnectionStatus.Disconnected

Examples

1// Example of accessing information on all connected connections
2public class MyAddOnTab : NTTabPage
3{
4 public MyAddOnTab()
5 {
6 // Print information about all connected connections
7 lock (Connection.Connections)
8 foreach(Connection c in Connection.Connections)
9 NinjaTrader.Code.Output.Process(string.Format("Connection: {0} Provider: {1}", c.Options.Name, c.Options.Provider), PrintTo.OutputTab1);
10
11 // Other required NTTabPage members left out for demonstration purposes. Be sure to add them in your own code.
12 }
13}