OpenClient

StockSharp.cTrader.Native

Herda de: Disposable

Construtores

OpenClient(string, uint)

Creates an instance of OpenClient which is not connected yet

host
The host name of API endpoint
port
The host port number

Propriedades

Host : string

The API endpoint host that the current client is connected to

IsCompleted : bool

If client stream is completed without any error then it will return True, otherwise False

IsTerminated : bool

If there was any error (exception) on client stream then this will return True, otherwise False

Port : uint

The API host port that current client is connected to

Métodos

Connect(CancellationToken) : Task

Connects to the API based on you specified method

Retorna: Task

ConnectTcp(CancellationToken) : Task

Connects to API by using a TCP client

Retorna: Task

DisposeManaged()

Disposes the client, releases all used resources, and stops all running operations

GetLength(byte[]) : int

Returns the length of a received message without causing extra allocation

lengthBytes
The byte array of received length data

Retorna: int

OnCompleted()

Completes each observer by calling their OnCompleted method

OnError(Exception)

Disposes the client and then calls each observer OnError after an exception thrown

exception
Exception
ReadTcp(CancellationToken) : Task

This method will read the TCP stream for incoming messages

cancellationToken
The cancellation token that will be used on ReadAsync calls

Retorna: Task

SendMessage(ProtoMessage, CancellationToken) : Task

This method will insert your message on messages queue, it will not send the message instantly

message
Message
cancellationToken

Retorna: Task

SendMessage``1(T, ProtoOAPayloadType, string, CancellationToken)

This method will insert your message on messages queue, it will not send the message instantly

message
Message
payloadType
Message Payload Type (ProtoOAPayloadType)
clientMsgId
The client message ID (optional)
cancellationToken

Retorna: Task

SendMessage``1(T, string, CancellationToken)

This method will insert your message on messages queue, it will not send the message instantly By using this overload of SendMessage method you avoid passing the message payload type and it gets the payload from message itself

message
Message
clientMsgId
The client message ID (optional)
cancellationToken

Retorna: Task

SendMessage``1(T, ProtoPayloadType, string, CancellationToken)

This method will insert your message on messages queue, it will not send the message instantly

message
Message
payloadType
Message Payload Type (ProtoPayloadType)
clientMsgId
The client message ID (optional)
cancellationToken

Retorna: Task

ThrowObjectDisposedExceptionIfDisposed()

Throws ObjectDisposedException if the client was disposed

WriteTcp(byte[], CancellationToken) : Task

Writes the message bytes to TCP stream

messageByte
cancellationToken
The cancellation token that will be used on calling stream methods

Retorna: Task

Eventos

MessageReceived : Action<ProtoMessage>

This event will be triggered when a message is received from the API