TT Setup SDK (Developer Preview)  0.1
Documentation
Getting data from TT Setup

In addition to subscribing for update events, you can also use TT Setup SDK to get data from TT Setup. The DataFetcher class provides several static methods that call the corresponding TT REST API GET requests to return TT Setup data as JSON. The naming convention used for these methods mimics the names of the GET request. For example, the Get_Commondata member function calls the TT REST API /commondata endpoint GET request, while the Get_User_UserId member function calls the TT REST API /user/{userId} endpoint GET request.

The following code snippet shows how to use the Get_Accounts member function in the DataFetcher class to request the accounts defined in TT Setup. The function wraps the TT REST API /accounts endpoint GET request, returning JSON with the same data returned by the GET request.

public void GetAllAccounts()
{
// Example to show how to call the GET methods
int numberOfAccounts = 0;
string accts = DataFetcher.Get_Accounts();
try
{
dynamic json = JsonConvert.DeserializeObject(accts);
if (json["lastPage"] != null)
{
while (json["lastPage"] == false)
{
string accounts = DataFetcher.Get_Accounts(json["nextPageKey"].ToString());
json = JsonConvert.DeserializeObject(accounts);
numberOfAccounts += json["accounts"].Count;
//Code to process the accounts
}
Console.WriteLine("The number of accounts for the user " + m_sdk.UserName + " are : "
+ numberOfAccounts);
}
}
catch (Exception ex)
{
Console.WriteLine("Error parsing the json" + ex.Message.ToString());
}
}
Copyright © 2019 Trading Technologies International, Inc