Crypto Trading
Webull’s Crypto API enables developers to trade and query over HTTP. For more details, please refer to the API Reference.
Before calling the Crypto API, you need to have an App Key and secret. For more information, please refer to the Individual Application Process.
Base URLs
- Production Environment:
https://api.webull.com/ - Test Environment:
http://us-openapi-alb.uat.webullbroker.com/
Open Crypto Account
Crypto trading requires opening a crypto account, you can refer to the following steps
- Open Webull official website to download
Webull APP - Log in to the
Webull APP,Click sequentially onMenu->More - Click
Cryptoin the trading tab - Click
Open Account,follow the App instructions to complete Crypto account opening
Supported Coins
Webull OpenAPI supports over 70 unique crypto assets, and more are on the way.
To retrieve all available crypto assets and their trading pairs, please use the API call below
- Python
- Java
from webull.data.common.category import Category
from webull.data.common.contract_type import ContractType
from webull.data.common.timespan import Timespan
from webull.core.client import ApiClient
from webull.data.data_client import DataClient
optional_api_endpoint = "<api_endpoint>"
your_app_key = "<your_app_key>"
your_app_secret = "<your_app_secret>"
region_id = "<region_id>"
api_client = ApiClient(your_app_key, your_app_secret, region_id)
api_client.add_endpoint(region_id, optional_api_endpoint)
if __name__ == '__main__':
data_client = DataClient(api_client)
res = data_client.instrument.get_crypto_instrument(status='OC')
if res.status_code == 200:
print('get_crypto_instrument:', res.json())
package com.webull.openapi;
import com.webull.openapi.core.common.Region;
import com.webull.openapi.core.common.dict.Category;
import com.webull.openapi.core.http.HttpApiConfig;
import com.webull.openapi.core.logger.Logger;
import com.webull.openapi.core.logger.LoggerFactory;
import com.webull.openapi.data.quotes.api.IDataClient;
import com.webull.openapi.data.quotes.domain.CryptoInstrumentDetail;
import com.webull.openapi.data.quotes.domain.InstrumentQueryParam;
import java.util.List;
public class DataClientDemo {
private static final Logger logger = LoggerFactory.getLogger(DataClientDemo.class);
public static void main(String[] args) {
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey("<your_app_key>") //<your_app_key>
.appSecret("<your_app_secret>") //<your_app_secret>
.regionId(Region.us.name()) //<your_region_id> @see com.webull.openapi.core.common.Region
.endpoint("<webull_api_host>") //PRD env host: api.webull.com; Test env host: us-openapi-alb.uat.webullbroker.com
.build();
IDataClient dataClient = new com.webull.openapi.data.DataClient(apiConfig);
InstrumentQueryParam param = new InstrumentQueryParam();
param.setCategory(Category.US_CRYPTO.name());
param.setStatus("OC");
List<CryptoInstrumentDetail> instruments = dataClient.getCryptoInstrument(param);
logger.info("Crypto Instrument Response: {}", instruments);
}
}
Supported Orders
When placing crypto orders via the Orders API.
MARKET, LIMIT, and STOP LOSS LIMIT orders are supported. The accepted time_in_force values are DAY,GTC and IOC.
You can submit crypto orders for any supported crypto pair via API, see the below request example.
- Python
- Java
import uuid
from time import sleep
from webull.core.client import ApiClient
from webull.trade.trade_client import TradeClient
optional_api_endpoint = "<webull_api_host>" # PRD env host: api.webull.com; Test env host: us-openapi-alb.uat.webullbroker.com
your_app_key = "<your_app_key>"
your_app_secret = "<your_app_secret>"
region_id = "us"
account_id = "<your_account_id>" # Use account_list interface to get account info
api_client = ApiClient(your_app_key, your_app_secret, region_id)
api_client.add_endpoint(region_id, optional_api_endpoint)
if __name__ == '__main__':
trade_client = TradeClient(api_client)
# normal crypto order
normal_crypto_client_order_id = uuid.uuid4().hex
print('normal crypto client order id:', normal_crypto_client_order_id)
new_normal_crypto_orders = [
{
"combo_type": "NORMAL",
"client_order_id": normal_crypto_client_order_id,
"symbol": "BTCUSD",
"instrument_type": "CRYPTO",
"market": "US",
"order_type": "LIMIT",
"limit_price": "80000",
"quantity": "0.003",
"side": "BUY",
"time_in_force": "DAY",
"entrust_type": "QTY"
}
]
res = trade_client.order_v3.place_order(account_id, new_normal_crypto_orders)
if res.status_code == 200:
print('place normal crypto order res:', res.json())
sleep(3)
res = trade_client.order_v3.cancel_order(account_id, normal_crypto_client_order_id)
if res.status_code == 200:
print('cancel normal crypto order res:', res.json())
res = trade_client.order_v3.get_order_detail(account_id, normal_crypto_client_order_id)
if res.status_code == 200:
print('get normal crypto order detail res:', res.json())
import com.webull.openapi.core.common.dict.ComboType;
import com.webull.openapi.core.common.dict.EntrustType;
import com.webull.openapi.core.common.dict.InstrumentSuperType;
import com.webull.openapi.core.common.dict.Markets;
import com.webull.openapi.core.common.dict.OrderSide;
import com.webull.openapi.core.common.dict.OrderTIF;
import com.webull.openapi.core.common.dict.OrderType;
import com.webull.openapi.core.http.HttpApiConfig;
import com.webull.openapi.core.logger.Logger;
import com.webull.openapi.core.logger.LoggerFactory;
import com.webull.openapi.core.utils.GUID;
import com.webull.openapi.trade.TradeClientV3;
import com.webull.openapi.trade.request.v3.TradeOrder;
import com.webull.openapi.trade.request.v3.TradeOrderItem;
import com.webull.openapi.trade.response.v3.OrderHistory;
import com.webull.openapi.trade.response.v3.TradeOrderResponse;
import java.util.ArrayList;
import java.util.List;
public class OrderCryptoTradeClient {
private static final Logger logger = LoggerFactory.getLogger(OrderCryptoTradeClient.class);
public static void main(String[] args) throws InterruptedException {
HttpApiConfig apiConfig = HttpApiConfig.builder()
.appKey("<your_app_key>") //<your_app_key>
.appSecret("<your_app_secret>") //<your_app_secret>
.regionId("us") //<your_region_id> @see com.webull.openapi.core.common.Region
.endpoint("<webull_api_host>") //PRD env host: api.webull.com; Test env host: us-openapi-alb.uat.webullbroker.com
.build();
TradeClientV3 apiService = new TradeClientV3(apiConfig);
// Use getAccountList interface to get account info
String accountId = "#{accountId}"; //<your_account_id> from by Account Api
String clientOrderId = GUID.get();
logger.info("normal crypto client order id : {}", clientOrderId);
// Normal Crypto Example
TradeOrder newNormalCryptoOrder = new TradeOrder();
List<TradeOrderItem> newNormalCryptoOrders = new ArrayList<>();
TradeOrderItem normalCryptoOrder = new TradeOrderItem();
newNormalCryptoOrders.add(normalCryptoOrder);
normalCryptoOrder.setClientOrderId(clientOrderId);
normalCryptoOrder.setComboType(ComboType.NORMAL.name());
normalCryptoOrder.setSymbol("BTCUSD");
normalCryptoOrder.setInstrumentType(InstrumentSuperType.CRYPTO.name());
normalCryptoOrder.setMarket(Markets.US.name());
normalCryptoOrder.setOrderType(OrderType.LIMIT.name());
normalCryptoOrder.setQuantity("0.003");
normalCryptoOrder.setLimitPrice("80000");
normalCryptoOrder.setSide(OrderSide.BUY.name());
normalCryptoOrder.setTimeInForce(OrderTIF.DAY.name());
normalCryptoOrder.setEntrustType(EntrustType.QTY.name());
newNormalCryptoOrder.setNewOrders(newNormalCryptoOrders);
TradeOrderResponse placeNormalCryptoResponse = apiService.placeOrder(accountId, newNormalCryptoOrder);
logger.info("Place normal crypto response: {}", placeNormalCryptoResponse);
Thread.sleep(3 * 1000L);
TradeOrder cancelNormalCryptoOrder = new TradeOrder();
cancelNormalCryptoOrder.setClientOrderId(clientOrderId);
TradeOrderResponse cancelNormalCryptoResponse = apiService.cancelOrder(accountId, cancelNormalCryptoOrder);
logger.info("cancel normal crypto: {}", cancelNormalCryptoResponse);
OrderHistory orderDetail = apiService.getOrderDetails(accountId, normalCryptoOrder.getClientOrderId());
logger.info("Order details: {}", orderDetail);
}
}
The above request example submits a market order via API to buy 0.0001 BTC with USD (BTC/USD pair) that is good till end of day.
Trading Hours
Crypto trading is available 24/7, and your orders will be executed at any time during the day.
Trading Limits
Trading limits vary based on your location and crypto service provider.
For customers outside of New York, Guam, and the Northern Mariana Islands:
- Maximum per trade: $100,000
- Maximum total of pending buy orders: $200,000
- Minimum order amount: $2.00
- Smallest tradable amount: 0.00000001
For customers in New York, Guam, and the Northern Mariana Islands:
- Maximum per trade: $100,000
- Maximum total of pending buy orders: $200,000
- Minimum order amount: $1.00
- Smallest tradable amount: 0.00000001
Note that when selling crypto, your position must not fall below $2 after placing the order.
Crypto Market Data
Webull's Crypto Market Data API offers free market data access over HTTP For more details, please refer to the API Reference.
Crypto Spot Trading Fees
Please refer to the Webull's fee Schedule