Skip to main content

Subscribe

Interface Description

caution

The subscription interface can only be used after establishing a long MQTT link. persistent connection building can refer to Market Push Quotes.

  • Function description:

    • Real-time quotes unsubscribe interface is subscribed to real-time quotes pushes according to symbol and data type.

    • Each AppId has a maximum of 1 push connection. The number of subscription topics is limited to 100, and a sub_type of a symbol is 1 topic.

      • The following parameters initiate a subscription, then 4 topics are generated:

        • symbol: AAPL,TSLA

        • sub_types: QUOTE,SNAPSHOT,TICK

  • Request URL: /market-data/streaming/subscribe

  • 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

ParameterTypeRequired fieldsDescription
tokenStringYesSubscribe to the token returned by the pre-request, and the token needs to be a token that has already created a connection, for example: 2d29ea02-8a35-11ec-8356-020017000b7b
symbols[]StringYesSecurities code, for example: [00700,00981], up to 50 symbols at a time
categoryStringYesSecurity Type, Enumeration, Reference: Category
sub_types[]StringYesIf there are multiple Subscription Data Types, please separate them by commas",", enumeration, reference: SubType, such as: [SNAPSHOT]

Request Example

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.create_subscription_rel(token, symbols, category, sub_types)
if response.status_code == 200:
print('subscribe successful')

Response Example

No return value