Skip to main content

Domain

Endpoint refers to the network domain of the requested service, such as api.webull.co.jp corresponding to the HTTP API service.

The region_id is also related to the Endpoint. For example, the region_id corresponding to the above two domain is jp (representing Japan).

In the process of using the SDK, the Endpoint has been managed by default. Generally, the developer only needs to set the region_id correctly, and there is no need to set the Endpoint separately.

HTTP API

Different ways for users to customize Endpoint

  1. Set through ApiClient and take effect globally. The sample code is as follows.
from webullsdkcore.client import ApiClient

client = ApiClient(app_key="<your_app_key>", app_secret="<your_app_secret>", region_id="<region_id>")
client.add_endpoint("<region_id>", "<endpoint>")
  1. Set by Request, and it only takes effect for the current Request. The sample code is as follows.
from webullsdkmdata.request.get_instruments_request import GetInstrumentsRequest

request = GetInstrumentsRequest()
request.set_endpoint("<endpoint>")

Trade Events Subscription

By setting the parameters of host and port, the user can implement the endpoint of the custom gRPC protocol. The sample code is as follows.

from webullsdktradeeventscore.events_client import EventsClient

events_client = EventsClient("<your_app_key>", "<your_app_secret>",region_id="<region_id>", host="<host>", port="<port>")