Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 12 additions & 11 deletions 01 Cloud Platform/10 Live Trading/02 Brokerages/00.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@
"04" : "US Equities, Equity Options, Futures, Future Options, Index, & Index Options",
"05" : "US Equities, Equity Options, & Crypto",
"07" : "US Equities, Equity Options, Index, & Index Options",
"08" : "Crypto & Crypto Futures",
"09" : "Crypto & Crypto Futures",
"10" : "US Equities & Equity Options",
"11" : "Crypto",
"12" : "Crypto",
"13" : "Crypto",
"14" : "Crypto Futures",
"15" : "US Equities, Equity Options, Futures, & Index Options",
"16" : "US Equities, Equity Options, Futures, Future Options, Index, & Index Options",
"17" : "Futures",
"18" : "US Equities",
"08" : "US Equities, Equity Options, Index, & Index Options",
"09" : "Crypto & Crypto Futures",
"10" : "Crypto & Crypto Futures",
"11" : "US Equities & Equity Options",
"12" : "Crypto",
"13" : "Crypto",
"14" : "Crypto",
"15" : "Crypto Futures",
"16" : "US Equities, Equity Options, Futures, & Index Options",
"17" : "US Equities, Equity Options, Futures, Future Options, Index, & Index Options",
"18" : "Futures",
"19" : "US Equities",
"97" : "Financial Information eXchange",
"98" : "CFD & FOREX",
"99" : "Request New Additions"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<? include(DOCS_RESOURCES."/landing-page-introductions/individual-brokerages.php"); ?>
<? include(DOCS_RESOURCES."/brokerages/introduction-by-brokerage/webull.html"); ?>
<!--p>To view the implementation of the Webull brokerage integration, see the <a href='https://github.com/QuantConnect/Lean.Brokerages.WeBull' rel='nofollow' target="_blank">Lean.Brokerages.WeBull repository</a>.</p-->
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<p>Webull supports cash and margin accounts. To set the account type in an algorithm, see the <a href="/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/webull">Webull brokerage model documentation</a>.</p>

<h4>Create an Account</h4>
<p>Follow the <a rel="nofollow" target="_blank" href="https://www.webull.com/">account creation wizard</a> on the Webull website to create a Webull account.</p>

<h4>Create API Credentials</h4>
<p>To trade with the Webull API, you need an App Key, App Secret, and account ID. Follow these steps to create them:</p>
<ol>
<li>Log in to the <a rel="nofollow" target="_blank" href="https://developer.webull.com/">Webull Developer Portal</a> with your Webull account.</li>
<li>Create an application to generate an <span class='field-name'>App Key</span> and <span class='field-name'>App Secret</span>.</li>
<li>Enable the application for trading and note the <span class='field-name'>account ID</span> of the Webull account you want to trade.</li>
</ol>

<h4>Paper Trading</h4>

<p>The Webull API doesn't support paper trading, but you can follow these steps to simulate it with QuantConnect:</p>

<ol>
<li>In the <code class="csharp">Initialize</code><code class="python">initialize</code> method of your algorithm, <a href='/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/webull'>set the Webull brokerage model and your account type</a>.</li>
<li><a href="/docs/v2/cloud-platform/live-trading/brokerages/quantconnect-paper-trading#15-Deploy-Live-Algorithms">Deploy your algorithm with the QuantConnect Paper Trading brokerage</a>.</li>
</ol>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?
include(DOCS_RESOURCES."/brokerages/webull/asset-classes.php");

$brokerageName = "Webull";
include(DOCS_RESOURCES."/brokerages/us-etfs.php");
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>Webull doesn't provide a live data feed. The <a href='/docs/v2/cloud-platform/datasets/quantconnect'>QuantConnect data provider</a> supplies US Equity, Equity Option, Index, and Index Option data during live trading. For more information about live data providers, see <a href='/docs/v2/cloud-platform/datasets'>Datasets</a>.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<p>We model the Webull API by supporting several order types, the <code>TimeInForce</code> order property, and order updates. When you deploy live algorithms, you can <a href='/docs/v2/cloud-platform/live-trading/algorithm-control#03-Place-Manual-Trades'>place manual orders</a> through the IDE.</p>
<? include(DOCS_RESOURCES."/brokerages/webull/orders.php"); ?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<p>Webull enforces the following rate limits on its trading API:</p>

<ul>
<li>Order requests (place, replace, and cancel): 600 requests per 60 seconds.</li>
<li>Account and order queries (balance, positions, open orders, and order history): 2 requests per 2 seconds.</li>
</ul>

<p>To avoid hitting these limits, design your algorithm to issue orders sparingly.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>Webull trading for Equity and Equity Options is commission-free. Index Options incur per-contract exchange fees. To view the Webull trading fees, see the <a rel="nofollow" target="_blank" href="https://www.webull.com/pricing">Pricing</a> page on the Webull website. To view how we model their fees, see <a href='/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/webull#06-Fees'>Fees</a>.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>We model <a href='/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/webull#07-Buying-Power'>buying power</a> and <a href='/docs/v2/writing-algorithms/reality-modeling/margin-calls'>margin calls</a> to ensure your algorithm stays within the margin requirements. If you have more than $25,000 in your brokerage account, you can use the <code>PatternDayTradingMarginModel</code> to make use of the 4x intraday leverage and 2x overnight leverage available on most brokerages from the <a href='/docs/v2/writing-algorithms/reality-modeling/buying-power#12-PDT-Rule'>PDT rule</a>.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?
$brokerageName = "Webull";
$paperTradingSupported = false;
include(DOCS_RESOURCES."/brokerages/slippage.php");
?>

<p>To view how we model Webull slippage, see <a href="/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/webull#05-Slippage">Slippage</a>.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?
$brokerageName = "Webull";
$paperTradingSupported = false;
include(DOCS_RESOURCES."/brokerages/fills.php");
?>
<p>To view how we model Webull order fills, see <a href="/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/webull#04-Fills">Fills</a>.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?
$usBrokerage=true;
$cashAccount=true;
$marginAccount=true;
$equities=true;
$options=true;
include(DOCS_RESOURCES."/brokerages/settlements.php");
?>

<p>To view how we model settlement for Webull trades, see <a href="/docs/v2/writing-algorithms/reality-modeling/brokerages/supported-models/webull#08-Settlement">Settlement</a>.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?
$brokerageName = "Webull";
$statusPageURL = null;
include(DOCS_RESOURCES."/brokerages/security-and-stability.php");
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<? include(DOCS_RESOURCES."/brokerages/deposits-and-withdrawals.html");?>
<p>Funds are available for API trading 24 hours after the deposit.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<p>The following algorithm demonstrates the functionality of the Webull brokerage:</p>

<div class="section-example-container testable">
<pre class="csharp">// Demonstrate Webull brokerage functionality with an EMA crossover strategy on SPY.
public class WebullDemoAlgorithm : QCAlgorithm
{
private ExponentialMovingAverage _fast;
private ExponentialMovingAverage _slow;

public override void Initialize()
{
SetStartDate(2024, 9, 1);
SetEndDate(2024, 12, 31);
SetCash(100000);
SetBrokerageModel(BrokerageName.Webull, AccountType.Margin);
var symbol = AddEquity("SPY", Resolution.Daily).Symbol;
_fast = EMA(symbol, 10, Resolution.Daily);
_slow = EMA(symbol, 50, Resolution.Daily);
}

public override void OnData(Slice slice)
{
if (!_slow.IsReady) return;
if (_fast &gt; _slow &amp;&amp; !Portfolio.Invested)
SetHoldings("SPY", 1);
else if (_fast &lt; _slow &amp;&amp; Portfolio.Invested)
Liquidate();
}
}</pre>
<pre class="python"># Demonstrate Webull brokerage functionality with an EMA crossover strategy on SPY.
class WebullDemoAlgorithm(QCAlgorithm):
def initialize(self) -&gt; None:
self.set_start_date(2024, 9, 1)
self.set_end_date(2024, 12, 31)
self.set_cash(100000)
self.set_brokerage_model(BrokerageName.WEBULL, AccountType.MARGIN)
symbol = self.add_equity("SPY", Resolution.DAILY).symbol
self._fast = self.ema(symbol, 10, Resolution.DAILY)
self._slow = self.ema(symbol, 50, Resolution.DAILY)

def on_data(self, slice: Slice) -&gt; None:
if not self._slow.is_ready:
return
if self._fast.current.value &gt; self._slow.current.value and not self.portfolio.invested:
self.set_holdings("SPY", 1)
elif self._fast.current.value &lt; self._slow.current.value and self.portfolio.invested:
self.liquidate()</pre>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?
$brokerageName = "Webull";
$cashState = false;
$holdingsState = false;
$secondBullet = "";
$authentication = "<li>Enter your Webull App Key, App Secret, and account ID.</li>" . file_get_contents(DOCS_RESOURCES."/brokerages/create-credentials/webull.html");
$postDeploy = "";
$dataProviderDetails = "<p>Webull doesn't provide a live data feed, so use the <a href='/docs/v2/cloud-platform/datasets'>QuantConnect data provider</a> or another data provider for the securities you trade.</p>";
include(DOCS_RESOURCES."/live-trading/deploy-live-algorithm.php");
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<? include(DOCS_RESOURCES."/brokerages/webull/troubleshooting.html"); ?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "metadata",
"values": {
"description": "Our Webull integration lets you deploy live trading algorithms on our co-located servers that trade the capital you have in your Webull account.",
"keywords": "Webull, live trading, brokerage integration, deploy co-located algorithms",
"og:description": "Our Webull integration lets you deploy live trading algorithms on our co-located servers that trade the capital you have in your Webull account.",
"og:title": "Webull - Documentation QuantConnect.com",
"og:type": "website",
"og:site_name": "Webull - QuantConnect.com",
"og:image": "https://cdn.quantconnect.com/docs/i/cloud-platform/live-trading/brokerages/webull.png"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@
"TradeStationSettings": object,
"TastytradeSettings": object,
"AlpacaBrokerageSettings": object,
"WebullBrokerageSettings": object,
},
"dataProviders":
"dataProviders":
}</pre>
</div>
</td>
Expand Down Expand Up @@ -828,6 +829,37 @@
</table><table class="table qc-table">
<thead>
<tr>
<th colspan="2"><code>WebullBrokerageSettings</code> Model - Settings for using Webull as the brokerage for a live algorithm.</th>
</tr>
</thead>
<tr>
<td width="20%">id</td> <td> <code>string Enum<br/><i><sub>required</sub></i></code> <br/> Id of the module. Options : ['WebullBrokerage']</td>
</tr>
<tr>
<td width="20%">webull-app-key</td> <td> <code>string<br/><i><sub>required</sub></i></code> <br/> Your Webull App Key.</td>
</tr>
<tr>
<td width="20%">webull-app-secret</td> <td> <code>string<br/><i><sub>required</sub></i></code> <br/> Your Webull App Secret.</td>
</tr>
<tr>
<td width="20%">webull-account-id</td> <td> <code>string<br/><i><sub>required</sub></i></code> <br/> Your Webull account ID.</td>
</tr>
<tr>
<td width="20%">Example</td>
<td>
<div class="cli section-example-container"><pre>
{
"id": "WebullBrokerage",
"webull-app-key": "string",
"webull-app-secret": "string",
"webull-account-id": "string"
}</pre>
</div>
</td>
</tr>
</table><table class="table qc-table">
<thead>
<tr>
<th colspan="2"><code>BrokerageHolding</code> Model - Holding object class for creating a live algorithm.</th>
</tr>
</thead>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<p>The <code>WebullFeeModel</code> models <a rel="nofollow" target="_blank" href="https://www.webull.com/pricing">the fees of Webull</a>.</p>

<div class="section-example-container">
<pre class="csharp">security.SetFeeModel(new WebullFeeModel());</pre>
<pre class="python">security.set_fee_model(WebullFeeModel())</pre>
</div>

<p>The <code>WebullFeeModel</code> charges $0 USD for Equity and Equity Option trades. For Index Options, it charges a $0.50 USD Webull fee per contract plus a per-contract exchange fee that depends on the underlying Index (for example, SPX, SPXW, VIX, VIXW, XSP, DJX, NDX, and NDXP).</p>

<p class='csharp'>For more information about this model, see the <a target="_blank" rel="nofollow" href="https://www.lean.io/docs/v2/lean-engine/class-reference/cs/classQuantConnect_1_1Orders_1_1Fees_1_1WebullFeeModel.html">class reference</a> and <a target="_blank" rel="nofollow" href="https://github.com/QuantConnect/Lean/blob/master/Common/Orders/Fees/WebullFeeModel.cs">implementation</a>.</p>
<p class='python'>For more information about this model, see the <a target="_blank" rel="nofollow" href="https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Orders/Fees/WebullFeeModel/">class reference</a> and <a target="_blank" rel="nofollow" href="https://github.com/QuantConnect/Lean/blob/master/Common/Orders/Fees/WebullFeeModel.cs">implementation</a>.</p>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "metadata",
"values": {
"description": "This page describes some of the pre-built fee models in LEAN. If none of these models perform exactly how you want, create a custom fee model.",
"keywords": "pre-built fee models, custom fee model, fees of Interactive Brokers, fees of Binance and Binance US, fees of Bitfinex, fees of Coinbase, fees of Kraken, fees of Samco, fees of Charles Schwab, fees of Wolverine Execution Services, fees of Zerodha",
"keywords": "pre-built fee models, custom fee model, fees of Interactive Brokers, fees of Binance and Binance US, fees of Bitfinex, fees of Coinbase, fees of Kraken, fees of Samco, fees of Charles Schwab, fees of Webull, fees of Wolverine Execution Services, fees of Zerodha",
"og:description": "This page describes some of the pre-built fee models in LEAN. If none of these models perform exactly how you want, create a custom fee model.",
"og:title": "Supported Models - Documentation QuantConnect.com",
"og:type": "website",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"16": "",
"17": "",
"18": "",
"19": ""
"19": "",
"20": ""
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<p>This page explains the <code>WebullBrokerageModel</code>, including the asset classes it supports, its default <a href='/docs/v2/writing-algorithms/reality-modeling/key-concepts#02-Security-Level-Models'>security-level models</a>, and its default markets.</p>

<div class="section-example-container">
<pre class="csharp">SetBrokerageModel(BrokerageName.Webull, AccountType.Cash);
SetBrokerageModel(BrokerageName.Webull, AccountType.Margin);</pre>
<pre class="python">self.set_brokerage_model(BrokerageName.WEBULL, AccountType.CASH)
self.set_brokerage_model(BrokerageName.WEBULL, AccountType.MARGIN)</pre>
</div>

<p class='csharp'>For more information about this model, see the <a target="_blank" rel="nofollow" href="https://www.lean.io/docs/v2/lean-engine/class-reference/cs/classQuantConnect_1_1Brokerages_1_1WebullBrokerageModel.html">class reference</a> and <a target="_blank" rel="nofollow" href="https://github.com/QuantConnect/Lean/blob/master/Common/Brokerages/WebullBrokerageModel.cs">implementation</a>.</p>
<p class='python'>For more information about this model, see the <a target="_blank" rel="nofollow" href="https://www.lean.io/docs/v2/lean-engine/class-reference/py/QuantConnect/Brokerages/WebullBrokerageModel/">class reference</a> and <a target="_blank" rel="nofollow" href="https://github.com/QuantConnect/Lean/blob/master/Common/Brokerages/WebullBrokerageModel.cs">implementation</a>.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<? include(DOCS_RESOURCES."/brokerages/webull/asset-classes.php"); ?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>The <code>WebullBrokerageModel</code> supports several order types, order properties, and order updates.</p>

<?php include(DOCS_RESOURCES."/brokerages/webull/orders.php"); ?>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>The <code>WebullBrokerageModel</code> uses the <a href='/docs/v2/writing-algorithms/reality-modeling/trade-fills/supported-models/equity-model'>EquityFillModel</a> for Equity trades and the <a href='/docs/v2/writing-algorithms/reality-modeling/trade-fills/supported-models/immediate-model'>ImmediateFillModel</a> for Equity Options and Index Options trades.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>The <code>WebullBrokerageModel</code> uses the <a href='/docs/v2/writing-algorithms/reality-modeling/slippage/supported-models#02-Null-Model'>NullSlippageModel</a>.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>The <code>WebullBrokerageModel</code> uses the <a href='/docs/v2/writing-algorithms/reality-modeling/transaction-fees/supported-models#18-Webull-Model'>WebullFeeModel</a>.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>The <code>WebullBrokerageModel</code> uses the <code>SecurityMarginModel</code>. If you have a margin account, the <code>WebullBrokerageModel</code> allows up to 2x leverage.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<p>The <code>WebullBrokerageModel</code> uses the <a href='/docs/v2/writing-algorithms/reality-modeling/settlement/supported-models#02-Immediate-Model'>ImmediateSettlementModel</a> for margin accounts and the <a href='/docs/v2/writing-algorithms/reality-modeling/settlement/supported-models#03-Delayed-Model'>DelayedSettlementModel</a> with the <a href='/docs/v2/writing-algorithms/reality-modeling/settlement/key-concepts#03-Default-Behavior'>default settlement rules</a> for cash accounts.</p>

<div class="section-example-container">
<pre class="csharp">// For cash accounts:
security.SetSettlementModel(new DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime));

// For margin accounts:
security.SetSettlementModel(new ImmediateSettlementModel());</pre>
<pre class="python"># For cash accounts:
security.set_settlement_model(DelayedSettlementModel(Equity.DEFAULT_SETTLEMENT_DAYS, Equity.DEFAULT_SETTLEMENT_TIME))

# For margin accounts:
security.set_settlement_model(ImmediateSettlementModel())</pre>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>The <code>WebullBrokerageModel</code> uses the <a href='/docs/v2/writing-algorithms/reality-modeling/margin-interest-rate/supported-models#02-Null-Model'>NullMarginInterestRateModel</a>.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>The default market of the <code>WebullBrokerageModel</code> is <code>Market.USA</code>.</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<p>
The <code>WebullBrokerageModel</code> doesn't set a default currency.
To change the algorithm's currency from USD to a different currency, see <a href='/docs/v2/writing-algorithms/initialization#03-Set-Account-Currency'>Set Account Currency</a>.
</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "metadata",
"values": {
"description": "This page explains the default security-level models and markets of the WebullBrokerageModel.",
"keywords": "brokerage model, fill model, slippage model, fee model, buying power model, margin model, settlement model, default markets",
"og:description": "This page explains the default security-level models and markets of the WebullBrokerageModel.",
"og:title": "Webull - Documentation QuantConnect.com",
"og:type": "website",
"og:site_name": "Webull - QuantConnect.com",
"og:image": "https://cdn.quantconnect.com/docs/i/writing-algorithms/reality-modeling/brokerages/supported-models/webull.png"
}
}
Loading