Connecting to Lime
Establish network connection
To connect to your trading account you need to have the following prerequisites:
- Established network connectivity to Lime data centers. This can be done in miltiple ways. You can either start a VPN using a desktop application from Cisco that we provide you, or for better latency we can establish a cross connect or an IPSEC VPN.
- We will tell you the IP address and port of a Lime Trading Server
- Your account name. In FIX world it would be your SenderCompId.
- Your Lime Direct username and password. These are only used for API or FIX connections to Lime Direct, this is not the same username and password used for portal access.
Configure the proxy object
The first thing to do is to create an IClient
instance passing connection parameters. The object is designed to maintain the trading session, taking care of login process, re-connecting in case of connectivity issues and exchanging heartbeat messages.
Constructor
ICallback callbackRequired. An instance of a class implementing ICallback
that will receive order updates
Required. Hostname or IP address to connect to
int portRequired. Port to connect to. Usually 7001
Required. Username provided by Lime
string passwordRequired. Password provided by Lime
ILogger loggerRequired. Microsoft.Extensions.Logging.ILogger
instance
Connect the trading session
ConnectAsync
method connects the IClient
instance to configured host and port, sends a login request and awaits for a successful response. The session status can be later queried by IsConnected
property.
Last known message id received from the server. Every event sent by our server during any given day has a unique incremental id. A client can request to re-send all events happened from this id until now. As a particular example, specifying 1
makes the server to re-send the whole day's activity. 0
means "do not send anything".
true
instructs the Lime server to immediately cancel any active orders if session is disconnected. The client does not receive any cancel events but can be sure that no orders have left open in the market.
true
will instruct the library to automatically re-connect if the session is disconnected because of failed network or missing heartbeats from trading server. The library will keep trying to establish the session every 5 seconds until cancelled by the provided CancellationToken
.
Standard dotnet pattern to cancel waiting on the asynchronous result