Get Token
Interface Description
Function description:
- Obtain the token required by the market subscription interface, Subscribe and UnSubscribe require the token. Request the token before initiating the establishment of a persistent connection.
Request URL: /market-data/streaming/token
Request method: Establish a gRPC through the Webull SDK to establish a persistent connection, and then call the interface to obtain it.
Frequency limit: The calling frequency of each AppId is limited to 10 times per minute.
Request Parameters
No parameters
Response Example
Field | Type | Description |
---|---|---|
token | String | token |
Request Example
- Python
- Java
from webullsdktrade.grpc_api import API
from webullsdkquotescore.grpc.grpc_client import GrpcApiClient
from webullsdkcore.common.region import Region
grpc_client = GrpcApiClient(your_app_key, your_app_secret, Region.HK.value)
api = API(grpc_client)
response = api.market_data.get_token()
if response.status_code == 200:
token = response.json()
try (QuotesApiClient quotesApiClient = QuotesApiClient.builder()
.appKey(Env.APP_KEY)
.appSecret(Env.APP_SECRET)
.regionId(Region.hk.name())
.build()) {
String token = quotesApiClient.getToken();
}