Object
TigerHttpClient
com.tigerbrokers.stock.openapi.client.https.client.TigerHttpClient
Initialization
- Configure a
ClientConfiginstance with the account and key information.
public class TigerOpenClientConfig {
static {
ClientConfig clientConfig = ClientConfig.DEFAULT_CONFIG;
clientConfig.tigerId = "your tiger id";
clientConfig.defaultAccount = "your account";
clientConfig.privateKey = "your private key string";
// clientConfig.secretKey = "xxxxxx";
}
public static ClientConfig getDefaultClientConfig() {
return ClientConfig.DEFAULT_CONFIG;
}
}- Initialize
TigerHttpClientwithcom.tigerbrokers.stock.openapi.client.config.ClientConfig.
private static TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(TigerOpenClientConfig.getDefaultClientConfig());WebSocketClient
com.tigerbrokers.stock.openapi.client.socket.WebSocketClient
Initialization
- Create the authentication object.
Use com.tigerbrokers.stock.openapi.client.config.ClientConfig to create a com.tigerbrokers.stock.openapi.client.socket.ApiAuthentication instance. Pass this instance when initializing WebSocketClient so that the client can authenticate the connection.
Example
ClientConfig clientConfig = TigerOpenClientConfig.getDefaultClientConfig();
ApiAuthentication authentication = ApiAuthentication.build(clientConfig.tigerId, clientConfig.privateKey);- Create the WebSocket client.
private static ClientConfig clientConfig = TigerOpenClientConfig.getDefaultClientConfig();
private static WebSocketClient client =
WebSocketClient.getInstance().clientConfig(clientConfig).apiComposeCallback(new DefaultApiComposeCallback());Updated 8 days ago
Did this page help you?
