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

  1. 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);
  1. Create the WebSocket client.
private static ClientConfig clientConfig = TigerOpenClientConfig.getDefaultClientConfig();
private static WebSocketClient client =
    WebSocketClient.getInstance().clientConfig(clientConfig).apiComposeCallback(new DefaultApiComposeCallback());

Did this page help you?