Object

TigerHttpClient

com.tigerbrokers.stock.openapi.client.https.client.TigerHttpClient

Initialization

  1. Configure a ClientConfig instance 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;
  }
}
  1. Initialize TigerHttpClient with com.tigerbrokers.stock.openapi.client.config.ClientConfig.
private static TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(TigerOpenClientConfig.getDefaultClientConfig());

WebSocketClient

com.tigerbrokers.stock.openapi.client.socket.WebSocketClient

Initialization

WebSocketClient retains its historical class name. By default it uses a persistent TCP/TLS connection with Protobuf. Calling clientConfig(...) loads the configuration and creates the connection authentication internally, so applications do not need to build ApiAuthentication separately.

private static ClientConfig clientConfig = TigerOpenClientConfig.getDefaultClientConfig();
private static WebSocketClient client =
    WebSocketClient.getInstance().clientConfig(clientConfig).apiComposeCallback(new DefaultApiComposeCallback());

Did this page help you?