Object Details

Less than 1 minute

TigerHttpClient HTTP client

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

Initialization method:

  1. Construct a user configuration object ClientConfig containing personal account and key
public class TigerOpenClientConfig {
   static {
     ClientConfig clientConfig = ClientConfig.DEFAULT_CONFIG;
     clientConfig.tigerId = "your tiger id";
     clientConfig.defaultAccount = "your account";
     clientConfig.privateKey = "you private key string";
     // clientConfig.secretKey = "xxxxxx";
     // clientConfig.setEnv(Env.SANDBOX);
   }
   public static ClientConfig getDefaultClientConfig() {
     return ClientConfig.DEFAULT_CONFIG;
   }
}
  1. Use com.tigerbrokers.stock.openapi.client.config.ClientConfig to initialize HttpClient
private static TigerHttpClient client = TigerHttpClient.getInstance().clientConfig(TigerOpenClientConfig.getDefaultClientConfig());

WebSocketClient Websockets client

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

Initialization method:

  1. Construct authentication class

Use com.tigerbrokers.stock.openapi.client.config.ClientConfig to construct the authentication class com.tigerbrokers.stock.openapi.client.socket.ApiAuthentication, and pass it in when initializing WebSocketClient for authentication

Examples are as follows:

ClientConfig clientConfig = TigerOpenClientConfig.getDefaultClientConfig();
ApiAuthentication authentication = ApiAuthentication.build(clientConfig.tigerId, clientConfig.privateKey);
  1. Construct a Websockets client
private static ClientConfig clientConfig = TigerOpenClientConfig.getDefaultClientConfig();
private static WebSocketClient client =
     WebSocketClient.getInstance().clientConfig(clientConfig).apiComposeCallback(new DefaultApiComposeCallback());
Last update: