This documentation is no longer maintained. Please visit the new documentation to get the latest information.
Skip to main content

Quick Start

Requirements​

  • Please first generate the app key and app secret on the OpenAPI登録.
  • Requirements for Programming language version:

Requires Python 3.7 and above.

SDK Description​

Package Dependency Description​

Packages that must be installed regardless of which product's development kit is used.

  • webull-python-sdk-core

Packages that must be installed when subscribing to products using trade events.

  • webull-python-sdk-trade-events-core

Packages that need to be installed by default for the complete use of quotes SDK.

  • webull-python-sdk-core
  • webull-python-sdk-mdata

Packages that need to be installed by default for the complete use of the trading SDK.

  • webull-python-sdk-core
  • webull-python-sdk-trade-events-core
  • webull-python-sdk-trade

SDK Installation​

Install via pip

pip3 install --upgrade webull-python-sdk-core
pip3 install --upgrade webull-python-sdk-quotes-core
pip3 install --upgrade webull-python-sdk-mdata
pip3 install --upgrade webull-python-sdk-trade-events-core
pip3 install --upgrade webull-python-sdk-trade

API Host​

tip

The Http API address is used for normal Http requests.

The trading alerts is used for real-time pushes such as order status changes.

Production Environment

HTTP API: api.webull.co.jp
Trading news push: events-api.webull.co.jp

Examples of API calls​

caution

The following interfaces are listed, and the default connection address is the production environment.

Http interface list​

import uuid

from webullsdkcore.client import ApiClient
from webullsdktrade.api import API
from webullsdkcore.common.region import Region

optional_api_endpoint = "jp-openapi-alb.uat.webullbroker.com"
your_app_key = "<your_app_key>"
your_app_secret = "<your_app_secret>"
api_client = ApiClient(your_app_key, your_app_secret, Region.JP.value)
api_client.add_endpoint(Region.JP.value, optional_api_endpoint)


class TestOrder(object):
def __init__(self):
self.api = API(api_client)

def order(self):
res = self.api.account.get_app_subscriptions()
account_id = None
if res.status_code == 200:
print('app subscriptions:', res.json())
result = res.json()
account_id = result[0]['account_id']
print("account id:", account_id)

if account_id is None:
print("account id is null")
return

client_order_id = uuid.uuid4().hex
print('client order id:', client_order_id)
stock_order = {
"client_order_id": "2343512312312312",
"instrument_id": "913255598",
"side": "SELL",
"tif": "DAY",
"order_type": "LIMIT",
"limit_price": "485.100",
"extended_hours_trading": False,
"trade_currency": "USD",
"account_tax_type": "GENERAL",
"margin_type": "ONE_DAY",
"close_contracts": [
{
"contract_id": "MCH6VT35A9OFA4DVNOBGEE98JA",
"qty": "2"
}
]
}

res = self.api.order.place_order_v2(account_id, stock_order)
if res.status_code == 200:
print('place order res:', res.json())


if __name__ == '__main__':
openapi = TestOrder()
openapi.order()

Examples of trading pushes​

import logging

from webullsdktradeeventscore.events_client import EventsClient
from webullsdkcore.common.region import Region

your_app_key = "<your_app_key>"
your_app_secret = "<your_app_secret>"
account_id = "<your_account_id>"


def _on_log(level, log_content):
print(logging.getLevelName(level), log_content)


if __name__ == '__main__':
client = EventsClient(your_app_key, your_app_secret, Region.JP.value)
client.on_log = _on_log
print("subscribe account", [account_id])
client.do_subscribe([account_id])