diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/00.json b/01 Cloud Platform/10 Live Trading/02 Brokerages/00.json index cb2af9b375..0cc378d2c3 100644 --- a/01 Cloud Platform/10 Live Trading/02 Brokerages/00.json +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/00.json @@ -12,7 +12,8 @@ "02" : "US Equities, Equity Options, FOREX, Futures, Future Options, Index, Index Options, & CFD", "03" : "US Equities, Equity Options, Futures, Index, & Index Options", "04" : "US Equities, Equity Options, Futures, Future Options, Index, & Index Options", - "05" : "US Equities, Equity Options, & Crypto", + "05" : "US Equities, Equity Options, Index Options, & Crypto", + "06" : "US Equities, Equity Options, & Crypto", "07" : "US Equities, Equity Options, Index, & Index Options", "08" : "US Equities, Equity Options, Index, & Index Options", "09" : "Crypto & Crypto Futures", diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/01 Introduction.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/01 Introduction.php new file mode 100644 index 0000000000..818081d20c --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/01 Introduction.php @@ -0,0 +1,3 @@ + include(DOCS_RESOURCES."/landing-page-introductions/individual-brokerages.php"); ?> + include(DOCS_RESOURCES."/brokerages/introduction-by-brokerage/public.html"); ?> + diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/02 Account Types.html b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/02 Account Types.html new file mode 100644 index 0000000000..63e3d50208 --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/02 Account Types.html @@ -0,0 +1,22 @@ +
Public supports cash and margin accounts. To set the account type in an algorithm, see the Public brokerage model documentation.
+ +Follow the account creation wizard on the Public website to create a Public account.
+ +To trade with the Public API, you need a secret key and the account number of the Public account you want to trade. The following steps summarize how to get them. For a video walkthrough, see The Public API: How to Program Your Trading of Stocks, Options, and More on the Public YouTube channel.
+The Public API doesn't support paper trading, but you can follow these steps to simulate it with QuantConnect:
+ +Initializeinitialize method of your algorithm, set the Public brokerage model and your account type.Public doesn't provide a live data feed. The QuantConnect data provider supplies US Equity and Crypto data during live trading. For Equity Options, Index, and Index Options data, use the Polygon data provider or a data feed from another brokerage, such as Tastytrade or Charles Schwab. For more information about live data providers, see Datasets.
diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/06 Orders.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/06 Orders.php new file mode 100644 index 0000000000..73b33b2e45 --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/06 Orders.php @@ -0,0 +1,2 @@ +We model the Public API by supporting several order types, the TimeInForce order property, and order updates. When you deploy live algorithms, you can place manual orders through the IDE.
The Public API limits the rate of requests, so our Public integration throttles its requests to 10 requests per second. Public also allows up to 10 pending orders that open new positions on the same underlying.
+ +To avoid hitting these limits, design your algorithm to issue orders sparingly.
diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/08 Fees.html b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/08 Fees.html new file mode 100644 index 0000000000..1e846fa887 --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/08 Fees.html @@ -0,0 +1 @@ +Public trading for Equity, Equity Options, and Options on ETFs is commission-free during regular market hours. Equity trades during extended hours cost $2.99 per trade, Index Options cost $0.50 per contract, and Crypto trades carry a fee that depends on the order amount. To view the Public trading fees, see the Fee Schedule page on the Public website. To view how we model their fees, see Fees.
diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/09 Margin.html b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/09 Margin.html new file mode 100644 index 0000000000..3de2a1413b --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/09 Margin.html @@ -0,0 +1,3 @@ +We model buying power and margin calls to ensure your algorithm stays within the margin requirements.
+ +Trading on margin with Public, which includes short selling and buying for more than your settled cash, requires your account to hold at least $2,000 of cash, equities, and bonds. The UseMarginuse_margin order property selects the buying power each order uses.
To view how we model Public slippage, see Slippage.
diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/11 Fills.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/11 Fills.php new file mode 100644 index 0000000000..6cf85aafb5 --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/11 Fills.php @@ -0,0 +1,6 @@ + +$brokerageName = "Public"; +$paperTradingSupported = false; +include(DOCS_RESOURCES."/brokerages/fills.php"); +?> +To view how we model Public order fills, see Fills.
diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/12 Settlements.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/12 Settlements.php new file mode 100644 index 0000000000..ef227eef6d --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/12 Settlements.php @@ -0,0 +1,10 @@ + +$usBrokerage=true; +$cashAccount=true; +$marginAccount=true; +$equities=true; +$options=true; +include(DOCS_RESOURCES."/brokerages/settlements.php"); +?> + +To view how we model settlement for Public trades, see Settlement.
diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/13 Security and Stability.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/13 Security and Stability.php new file mode 100644 index 0000000000..13c0d93bce --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/13 Security and Stability.php @@ -0,0 +1,5 @@ + +$brokerageName = "Public"; +$statusPageURL = null; +include(DOCS_RESOURCES."/brokerages/security-and-stability.php"); +?> diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/14 Deposits and Withdrawals.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/14 Deposits and Withdrawals.php new file mode 100644 index 0000000000..2661661eae --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/14 Deposits and Withdrawals.php @@ -0,0 +1 @@ + include(DOCS_RESOURCES."/brokerages/deposits-and-withdrawals.html");?> diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/15 Demo Algorithm.html b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/15 Demo Algorithm.html new file mode 100644 index 0000000000..3cf84b775b --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/15 Demo Algorithm.html @@ -0,0 +1,48 @@ +The following algorithm demonstrates the functionality of the Public brokerage:
+ +// Demonstrate Public brokerage functionality with an EMA crossover strategy on SPY.
+public class PublicDemoAlgorithm : QCAlgorithm
+{
+ private ExponentialMovingAverage _fast;
+ private ExponentialMovingAverage _slow;
+
+ public override void Initialize()
+ {
+ SetStartDate(2024, 9, 1);
+ SetEndDate(2024, 12, 31);
+ SetCash(100000);
+ SetBrokerageModel(BrokerageName.Public, 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 > _slow && !Portfolio.Invested)
+ SetHoldings("SPY", 1);
+ else if (_fast < _slow && Portfolio.Invested)
+ Liquidate();
+ }
+}
+ # Demonstrate Public brokerage functionality with an EMA crossover strategy on SPY.
+class PublicDemoAlgorithm(QCAlgorithm):
+ def initialize(self) -> None:
+ self.set_start_date(2024, 9, 1)
+ self.set_end_date(2024, 12, 31)
+ self.set_cash(100000)
+ self.set_brokerage_model(BrokerageName.PUBLIC, 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) -> None:
+ if not self._slow.is_ready:
+ return
+ if self._fast.current.value > self._slow.current.value and not self.portfolio.invested:
+ self.set_holdings("SPY", 1)
+ elif self._fast.current.value < self._slow.current.value and self.portfolio.invested:
+ self.liquidate()
+Public doesn't provide a live data feed, so use a data provider for the securities you trade. The QuantConnect data provider supplies US Equity and Crypto data. For Equity Options, Index, and Index Options data, use the Polygon data provider or a data feed from another brokerage.
"; +include(DOCS_RESOURCES."/live-trading/deploy-live-algorithm.php"); +?> diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/17 Troubleshooting.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/17 Troubleshooting.php new file mode 100644 index 0000000000..28e3483ef9 --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/17 Troubleshooting.php @@ -0,0 +1 @@ + include(DOCS_RESOURCES."/brokerages/public/troubleshooting.html"); ?> diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/metadata.json b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/metadata.json new file mode 100644 index 0000000000..4f669a32ad --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/metadata.json @@ -0,0 +1,12 @@ +{ + "type": "metadata", + "values": { + "description": "Our Public integration lets you deploy live trading algorithms on our co-located servers that trade the capital you have in your Public account.", + "keywords": "Public, live trading, brokerage integration, deploy co-located algorithms", + "og:description": "Our Public integration lets you deploy live trading algorithms on our co-located servers that trade the capital you have in your Public account.", + "og:title": "Public - Documentation QuantConnect.com", + "og:type": "website", + "og:site_name": "Public - QuantConnect.com", + "og:image": "https://cdn.quantconnect.com/docs/i/cloud-platform/live-trading/brokerages/public.png" + } +} diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/01 Introduction.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/01 Introduction.php similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/01 Introduction.php rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/01 Introduction.php diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/02 Account Types.html b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/02 Account Types.html similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/02 Account Types.html rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/02 Account Types.html diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/04 Asset Classes.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/04 Asset Classes.php similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/04 Asset Classes.php rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/04 Asset Classes.php diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/05 Data Providers.html b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/05 Data Providers.html similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/05 Data Providers.html rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/05 Data Providers.html diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/06 Orders.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/06 Orders.php similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/06 Orders.php rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/06 Orders.php diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/07 Fees.html b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/07 Fees.html similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/07 Fees.html rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/07 Fees.html diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/08 Margin.html b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/08 Margin.html similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/08 Margin.html rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/08 Margin.html diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/09 Slippage.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/09 Slippage.php similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/09 Slippage.php rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/09 Slippage.php diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/10 Fills.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/10 Fills.php similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/10 Fills.php rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/10 Fills.php diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/11 Settlements.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/11 Settlements.php similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/11 Settlements.php rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/11 Settlements.php diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/12 Security and Stability.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/12 Security and Stability.php similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/12 Security and Stability.php rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/12 Security and Stability.php diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/13 Deposits and Withdrawals.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/13 Deposits and Withdrawals.php similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/13 Deposits and Withdrawals.php rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/13 Deposits and Withdrawals.php diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/14 Demo Algorithm.html b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/14 Demo Algorithm.html similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/14 Demo Algorithm.html rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/14 Demo Algorithm.html diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/15 Deploy Live Algorithms.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/15 Deploy Live Algorithms.php similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/15 Deploy Live Algorithms.php rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/15 Deploy Live Algorithms.php diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/metadata.json b/01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/metadata.json similarity index 100% rename from 01 Cloud Platform/10 Live Trading/02 Brokerages/05 Alpaca/metadata.json rename to 01 Cloud Platform/10 Live Trading/02 Brokerages/06 Alpaca/metadata.json diff --git a/01 Cloud Platform/99 API Reference/07 Live Management/01 Create Live Algorithm/02 Request.html b/01 Cloud Platform/99 API Reference/07 Live Management/01 Create Live Algorithm/02 Request.html index 9c89382556..b1057e5113 100644 --- a/01 Cloud Platform/99 API Reference/07 Live Management/01 Create Live Algorithm/02 Request.html +++ b/01 Cloud Platform/99 API Reference/07 Live Management/01 Create Live Algorithm/02 Request.html @@ -99,6 +99,7 @@ "TastytradeSettings": object, "AlpacaBrokerageSettings": object, "WebullBrokerageSettings": object, + "PublicBrokerageSettings": object, }, "dataProviders": } @@ -860,6 +861,33 @@PublicBrokerageSettings Model - Settings for using Public as the brokerage for a live algorithm. |
+|
|---|---|
| id | string Enum Id of the module. Options : ['PublicBrokerage'] |
+
| public-secret-key | string Your Public secret key. |
+
| public-account-number | string The number of the Public account you want to trade. |
+
| Example | +
+
+{
+ "id": "PublicBrokerage",
+ "public-secret-key": "string",
+ "public-account-number": "string"
+}
+ |
+
BrokerageHolding Model - Holding object class for creating a live algorithm. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Order Amount (USD) | +Fee (USD) | +
|---|---|
| $10 or less | $0.49 |
| $10.01 - $25 | $0.69 |
| $25.01 - $50 | $1.19 |
| $50.01 - $100 | $1.69 |
| $100.01 - $250 | $3.29 |
| $250.01 - $500 | $6.29 |
| More than $500 | 1.25% of the order amount |
For more information about this model, see the class reference and implementation.
+For more information about this model, see the class reference and implementation.
diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/15 Samco Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/16 Samco Model.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/15 Samco Model.html rename to 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/16 Samco Model.html diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/16 Tastytrade Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/17 Tastytrade Model.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/16 Tastytrade Model.html rename to 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/17 Tastytrade Model.html diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/17 TradeStation Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/18 TradeStation Model.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/17 TradeStation Model.html rename to 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/18 TradeStation Model.html diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/18 Webull Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/19 Webull Model.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/18 Webull Model.html rename to 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/19 Webull Model.html diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/19 Wolverine Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/20 Wolverine Model.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/19 Wolverine Model.html rename to 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/20 Wolverine Model.html diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/20 Zerodha Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/21 Zerodha Model.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/20 Zerodha Model.html rename to 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/21 Zerodha Model.html diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/metadata.json b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/metadata.json index f07db29542..43ee7a3962 100644 --- a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/metadata.json +++ b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/metadata.json @@ -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 Webull, 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 Public, 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", diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 TradeStation/06 Fees.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 TradeStation/06 Fees.html index 418156e360..482b21598d 100644 --- a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 TradeStation/06 Fees.html +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 TradeStation/06 Fees.html @@ -1 +1 @@ -The TradeStationBrokersBrokerageModel uses the TradeStationFeeModel with the default argument values. We model current TradeStation fees on all assets.
The TradeStationBrokersBrokerageModel uses the TradeStationFeeModel with the default argument values. We model current TradeStation fees on all assets.
The TastytradeBrokersBrokerageModel uses the TastytradeFeeModel with the default argument values. We model current Tastytrade fees on all assets.
The TastytradeBrokersBrokerageModel uses the TastytradeFeeModel with the default argument values. We model current Tastytrade fees on all assets.
This page explains the PublicBrokerageModel, including the asset classes it supports, its default security-level models, and its default markets.
SetBrokerageModel(BrokerageName.Public, AccountType.Cash); +SetBrokerageModel(BrokerageName.Public, AccountType.Margin);+
self.set_brokerage_model(BrokerageName.PUBLIC, AccountType.CASH) +self.set_brokerage_model(BrokerageName.PUBLIC, AccountType.MARGIN)+
For more information about this model, see the class reference and implementation.
+For more information about this model, see the class reference and implementation.
diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/02 Asset Classes.php b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/02 Asset Classes.php new file mode 100644 index 0000000000..978e0281f3 --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/02 Asset Classes.php @@ -0,0 +1 @@ + include(DOCS_RESOURCES."/brokerages/public/asset-classes.php"); ?> diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/03 Orders.php b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/03 Orders.php new file mode 100644 index 0000000000..bad6be9dce --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/03 Orders.php @@ -0,0 +1,3 @@ +The PublicBrokerageModel supports several order types, order properties, and order updates.
The PublicBrokerageModel uses the EquityFillModel for Equity trades and the ImmediateFillModel for Equity Options, Index Options, and Crypto trades.
The PublicBrokerageModel uses the NullSlippageModel.
The PublicBrokerageModel uses the PublicFeeModel.
The PublicBrokerageModel uses the SecurityMarginModel for Equity trades and the OptionMarginModel for Equity Option and Index Option trades. For Crypto trades, it uses the CashBuyingPowerModel for cash accounts and the SecurityMarginModel for margin accounts.
If you have a margin account, the PublicBrokerageModel allows up to 2x leverage for Equity trades. The UseMarginuse_margin order property selects the buying power each order uses at the brokerage.
The PublicBrokerageModel uses the ImmediateSettlementModel for margin accounts and the DelayedSettlementModel with the default settlement rules for cash accounts with Equity and Equity Options.
// For US Equities with a cash account: +security.SetSettlementModel(new DelayedSettlementModel(Equity.DefaultSettlementDays, Equity.DefaultSettlementTime)); + +// For Equity Options with a cash account: +security.SetSettlementModel(new DelayedSettlementModel(Option.DefaultSettlementDays, Option.DefaultSettlementTime)); + +// For remaining cases: +security.SetSettlementModel(new ImmediateSettlementModel());+
# For US Equities with a cash account: +security.set_settlement_model(DelayedSettlementModel(Equity.DEFAULT_SETTLEMENT_DAYS, Equity.DEFAULT_SETTLEMENT_TIME)) + +# For Equity Options with a cash account: +security.set_settlement_model(DelayedSettlementModel(Option.DEFAULT_SETTLEMENT_DAYS, Option.DEFAULT_SETTLEMENT_TIME)) + +# For remaining cases: +security.set_settlement_model(ImmediateSettlementModel())+
The PublicBrokerageModel uses the NullMarginInterestRateModel.
The default market of the PublicBrokerageModel is Market.USA for Equity, Equity Options, and Index Options. It's Market.CoinbaseMarket.COINBASE for Crypto.
+ The PublicBrokerageModel doesn't set a default currency.
+ To change the algorithm's currency from USD to a different currency, see Set Account Currency.
+
The WebullBrokerageModel uses the WebullFeeModel.
The WebullBrokerageModel uses the WebullFeeModel.
The WolverineBrokerageModel uses the WolverineFeeModel.
The WolverineBrokerageModel uses the WolverineFeeModel.
The following table shows the supported brokerages and the options required to configure each one. Most of these brokerages also provide live (--data-provider-live) and historical (--data-provider-historical) data for research, backtesting, and optimization. Webull provides brokerage connectivity only, so pair it with a separate data provider such as Polygon:
The following table shows the supported brokerages and the options required to configure each one. Most of these brokerages also provide live (--data-provider-live) and historical (--data-provider-historical) data for research, backtesting, and optimization. Webull provides brokerage connectivity only, so pair it with a separate data provider such as Polygon. Public provides brokerage connectivity and historical data, but no live data feed:
--webull-app-secret | |
--webull-account-id | |
Public |
+ --public-secret-key |
+
--public-account-number |
Public authenticates with a secret key and an account number. Public lets you have more than one account, so the account number picks which one to trade.
+ + +To use the CLI, you must be a member in an organization on a paid tier.
diff --git a/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/02 Deploy Cloud Algorithms.php b/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/02 Deploy Cloud Algorithms.php new file mode 100644 index 0000000000..1d98e7b3d2 --- /dev/null +++ b/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/02 Deploy Cloud Algorithms.php @@ -0,0 +1,17 @@ + +$brokerageDetails = " +$ lean cloud live \"My Project\" --push --open +Secret key: ******************************** +Account number: 5PY12345+
$ lean live \"My Project\" +Secret key: ******************************** +Account number: 5PY12345+
Public doesn't provide a live data feed, but it serves historical data for the US Equities, Equity Options, Index Options, and Crypto it supports. To use Public as the historical data provider of local backtests, optimizations, and research, pass --data-provider-historical Public to the lean backtest, lean optimize, or lean research commands, or download data with lean data download.
The Public API serves trade data with the following limits:
+ +The Public data provider serves raw data. To get adjusted Equity data in local deployments, download the US Equity Security Master.
diff --git a/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/metadata.json b/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/metadata.json new file mode 100644 index 0000000000..53f0698fe6 --- /dev/null +++ b/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/metadata.json @@ -0,0 +1,12 @@ +{ + "type": "metadata", + "values": { + "description": "Learn how to model and connect a live algorithm to Public Brokerage in Lean CLI.", + "keywords": "lean cli, live trading, brokerages, public", + "og:description": "Learn how to model and connect a live algorithm to Public Brokerage in Lean CLI.", + "og:title": "Public - Documentation QuantConnect.com", + "og:type": "website", + "og:site_name": "Public - QuantConnect.com", + "og:image": "https://cdn.quantconnect.com/docs/i/lean-cli/live-trading/brokerages/public.png" + } +} diff --git a/05 Lean CLI/09 Live Trading/01 Brokerages/05 Alpaca/01 Introduction.php b/05 Lean CLI/09 Live Trading/01 Brokerages/06 Alpaca/01 Introduction.php similarity index 100% rename from 05 Lean CLI/09 Live Trading/01 Brokerages/05 Alpaca/01 Introduction.php rename to 05 Lean CLI/09 Live Trading/01 Brokerages/06 Alpaca/01 Introduction.php diff --git a/05 Lean CLI/09 Live Trading/01 Brokerages/05 Alpaca/02 Deploy Cloud Algorithms.php b/05 Lean CLI/09 Live Trading/01 Brokerages/06 Alpaca/02 Deploy Cloud Algorithms.php similarity index 100% rename from 05 Lean CLI/09 Live Trading/01 Brokerages/05 Alpaca/02 Deploy Cloud Algorithms.php rename to 05 Lean CLI/09 Live Trading/01 Brokerages/06 Alpaca/02 Deploy Cloud Algorithms.php diff --git a/05 Lean CLI/09 Live Trading/01 Brokerages/05 Alpaca/03 Deploy Local Algorithms.php b/05 Lean CLI/09 Live Trading/01 Brokerages/06 Alpaca/03 Deploy Local Algorithms.php similarity index 100% rename from 05 Lean CLI/09 Live Trading/01 Brokerages/05 Alpaca/03 Deploy Local Algorithms.php rename to 05 Lean CLI/09 Live Trading/01 Brokerages/06 Alpaca/03 Deploy Local Algorithms.php diff --git a/05 Lean CLI/09 Live Trading/01 Brokerages/05 Alpaca/04 Data Provider.html b/05 Lean CLI/09 Live Trading/01 Brokerages/06 Alpaca/04 Data Provider.html similarity index 100% rename from 05 Lean CLI/09 Live Trading/01 Brokerages/05 Alpaca/04 Data Provider.html rename to 05 Lean CLI/09 Live Trading/01 Brokerages/06 Alpaca/04 Data Provider.html diff --git a/05 Lean CLI/09 Live Trading/01 Brokerages/05 Alpaca/metadata.json b/05 Lean CLI/09 Live Trading/01 Brokerages/06 Alpaca/metadata.json similarity index 100% rename from 05 Lean CLI/09 Live Trading/01 Brokerages/05 Alpaca/metadata.json rename to 05 Lean CLI/09 Live Trading/01 Brokerages/06 Alpaca/metadata.json diff --git a/05 Lean CLI/99 API Reference/01 lean backtest/04 Options.html b/05 Lean CLI/99 API Reference/01 lean backtest/04 Options.html index e73f50a1c8..0658ee9635 100644 --- a/05 Lean CLI/99 API Reference/01 lean backtest/04 Options.html +++ b/05 Lean CLI/99 API Reference/01 lean backtest/04 Options.html @@ -20,7 +20,7 @@--data-provider-historical <enum: Interactive Brokers
Oanda
Bitfinex
Coinbase Advanced Trade
Binance
Kraken
CharlesSchwab
IQFeed
Polygon
FactSet
AlphaVantage
CoinApi
ThetaData
QuantConnect
Local
Terminal Link
Bybit
TradeStation
Alpaca
Tastytrade
Eze
dYdX
Databento
Webull>--data-provider-historical <enum: Interactive Brokers
Oanda
Bitfinex
Coinbase Advanced Trade
Binance
Kraken
CharlesSchwab
IQFeed
Polygon
FactSet
AlphaVantage
CoinApi
ThetaData
QuantConnect
Local
Terminal Link
Bybit
TradeStation
Alpaca
Tastytrade
Eze
dYdX
Databento
Webull
Public>--webull-account-id <string>--webull-use-2fa <boolean>--public-secret-key <string>--public-account-number <string>--download-data--brokerage <enum: Paper Trading
Interactive Brokers
Tradier
Oanda
Bitfinex
Coinbase Advanced Trade
Binance
Zerodha
Samco
Terminal Link
Trading Technologies
Kraken
CharlesSchwab
Bybit
TradeStation
Alpaca
Tastytrade
Eze
dYdX
Webull>--brokerage <enum: Paper Trading
Interactive Brokers
Tradier
Oanda
Bitfinex
Coinbase Advanced Trade
Binance
Zerodha
Samco
Terminal Link
Trading Technologies
Kraken
CharlesSchwab
Bybit
TradeStation
Alpaca
Tastytrade
Eze
dYdX
Webull
Public>--webull-account-id <string>--webull-use-2fa <boolean>--public-secret-key <string>--public-account-number <string>--polygon-api-key <string>--data-provider-historical <enum: Interactive Brokers
Oanda
Bitfinex
Coinbase Advanced Trade
Binance
Kraken
CharlesSchwab
IQFeed
Polygon
FactSet
AlphaVantage
CoinApi
ThetaData
QuantConnect
Local
Terminal Link
Bybit
TradeStation
Alpaca
Tastytrade
Eze
dYdX
Databento
Webull>--data-provider-historical <enum: Interactive Brokers
Oanda
Bitfinex
Coinbase Advanced Trade
Binance
Kraken
CharlesSchwab
IQFeed
Polygon
FactSet
AlphaVantage
CoinApi
ThetaData
QuantConnect
Local
Terminal Link
Bybit
TradeStation
Alpaca
Tastytrade
Eze
dYdX
Databento
Webull
Public>--webull-account-id <string>--webull-use-2fa <boolean>--public-secret-key <string>--public-account-number <string>--dataset <string>--brokerage <enum: Paper Trading
Interactive Brokers
Tradier
Oanda
Bitfinex
Coinbase Advanced Trade
Binance
Zerodha
Samco
Terminal Link
Trading Technologies
Kraken
CharlesSchwab
Bybit
TradeStation
Alpaca
Tastytrade
Eze
dYdX
Webull>--brokerage <enum: Paper Trading
Interactive Brokers
Tradier
Oanda
Bitfinex
Coinbase Advanced Trade
Binance
Zerodha
Samco
Terminal Link
Trading Technologies
Kraken
CharlesSchwab
Bybit
TradeStation
Alpaca
Tastytrade
Eze
dYdX
Webull
Public>--data-provider-historical <enum: Interactive Brokers
Oanda
Bitfinex
Coinbase Advanced Trade
Binance
Kraken
CharlesSchwab
IQFeed
Polygon
FactSet
AlphaVantage
CoinApi
ThetaData
QuantConnect
Local
Bybit
TradeStation
Alpaca
Tastytrade
Eze
dYdX
Databento
Webull>--data-provider-historical <enum: Interactive Brokers
Oanda
Bitfinex
Coinbase Advanced Trade
Binance
Kraken
CharlesSchwab
IQFeed
Polygon
FactSet
AlphaVantage
CoinApi
ThetaData
QuantConnect
Local
Bybit
TradeStation
Alpaca
Tastytrade
Eze
dYdX
Databento
Webull
Public>--webull-account-id <string>--webull-use-2fa <boolean>--public-secret-key <string>--public-account-number <string>--ib-enable-delayed-streaming-data <boolean>--data-provider-historical <enum: Interactive Brokers
Oanda
Bitfinex
Coinbase Advanced Trade
Binance
Kraken
CharlesSchwab
IQFeed
Polygon
FactSet
AlphaVantage
CoinApi
ThetaData
QuantConnect
Local
Terminal Link
Bybit
TradeStation
Alpaca
Tastytrade
Eze
dYdX
Databento
Webull>--data-provider-historical <enum: Interactive Brokers
Oanda
Bitfinex
Coinbase Advanced Trade
Binance
Kraken
CharlesSchwab
IQFeed
Polygon
FactSet
AlphaVantage
CoinApi
ThetaData
QuantConnect
Local
Terminal Link
Bybit
TradeStation
Alpaca
Tastytrade
Eze
dYdX
Databento
Webull
Public>--webull-account-id <string>--webull-use-2fa <boolean>--public-secret-key <string>--public-account-number <string>--lean-config <file>--data-provider-historical <enum: Interactive Brokers
Oanda
Bitfinex
Coinbase Advanced Trade
Binance
Kraken
CharlesSchwab
IQFeed
Polygon
FactSet
AlphaVantage
CoinApi
ThetaData
QuantConnect
Local
Terminal Link
Bybit
TradeStation
Alpaca
Tastytrade
Eze
dYdX
Databento
Webull>--data-provider-historical <enum: Interactive Brokers
Oanda
Bitfinex
Coinbase Advanced Trade
Binance
Kraken
CharlesSchwab
IQFeed
Polygon
FactSet
AlphaVantage
CoinApi
ThetaData
QuantConnect
Local
Terminal Link
Bybit
TradeStation
Alpaca
Tastytrade
Eze
dYdX
Databento
Webull
Public>--webull-account-id <string>--webull-use-2fa <boolean>--public-secret-key <string>--public-account-number <string>--download-dataTo generate your API credentials, see Account Types. Your account details are not saved on QuantConnect.
diff --git a/Resources/brokerages/introduction-by-brokerage/public.html b/Resources/brokerages/introduction-by-brokerage/public.html new file mode 100644 index 0000000000..f0544111fa --- /dev/null +++ b/Resources/brokerages/introduction-by-brokerage/public.html @@ -0,0 +1 @@ +Public is a commission-free investing platform founded in 2019 and operated in the United States by Public Holdings, Inc. Its brokerage services are provided by Open to the Public Investing, Inc., a registered broker-dealer and member of FINRA and SIPC. Public provides access to trading Equities, Equity Options, Index Options, and Crypto through its Trading API, with no commissions on US-listed stocks and options during regular market hours.
diff --git a/Resources/brokerages/public/asset-classes.php b/Resources/brokerages/public/asset-classes.php new file mode 100644 index 0000000000..5f737ffa3b --- /dev/null +++ b/Resources/brokerages/public/asset-classes.php @@ -0,0 +1,8 @@ += $writingAlgorithms ? "The PublicBrokerageModel" : "Our Public integration" ?> supports the following asset classes:
The following table describes the available order types for each asset class that = $cloudPlatform ? "our Public integration" : "the PublicBrokerageModel" ?> supports:
| Order Type | +Equity | +Equity Options | +Index Options | +Crypto | +
|---|---|---|---|---|
| Market | +![]() |
+ ![]() |
+ ![]() |
+ ![]() |
+
| Limit | +![]() |
+ ![]() |
+ ![]() |
+ ![]() |
+
| Stop market | +![]() |
+ ![]() |
+ ![]() |
+ ![]() |
+
| Stop limit | +![]() |
+ ![]() |
+ ![]() |
+ ![]() |
+
| Combo limit | ++ | ![]() |
+ ![]() |
+ + |
=$writingAlgorithms ? "The PublicBrokerageModel supports custom order properties." : "We model custom order properties from the Public API." ?> The following table describes the members of the PublicOrderProperties object that you can set to customize order execution.
| Property | +Data Type | +Description | +Default Value | +
|---|---|---|---|
TimeInForcetime_in_force |
+ TimeInForce |
+ A TimeInForce instruction to apply to the order. The following instructions are supported:
+
|
+ TimeInForce.GoodTilCanceledTimeInForce.GOOD_TIL_CANCELED |
+
OutsideRegularTradingHoursoutside_regular_trading_hours |
+ bool |
+ If set to true, allows the order to trigger or fill outside of regular trading hours. This property applies to Equity limit orders with a day time-in-force only, since Public only accepts limit orders in the extended session. | +falseFalse |
+
UseMarginuse_margin |
+ bool? |
+ Controls the buying power the order uses. If set to true, the order uses margin buying power when the account allows it. If set to false, the order uses cash-only (settled cash) buying power. If you don't set it, orders on margin accounts use margin buying power and orders on cash accounts always use cash-only buying power. | +nullNone |
+
public override void Initialize()
+{
+ // Set the default order properties
+ DefaultOrderProperties.TimeInForce = TimeInForce.GoodTilCanceled;
+}
+
+public override void OnData(Slice slice)
+{
+ // Use default order order properties
+ LimitOrder(_symbol, quantity, limitPrice);
+
+ // Override the default order properties
+ LimitOrder(_symbol, quantity, limitPrice,
+ orderProperties: new PublicOrderProperties
+ {
+ TimeInForce = TimeInForce.Day,
+ OutsideRegularTradingHours = true,
+ UseMargin = false
+ });
+}
+ def initialize(self) -> None: + # Set the default order properties + self.default_order_properties.time_in_force = TimeInForce.GOOD_TIL_CANCELED + +def on_data(self, slice: Slice) -> None: + # Use default order order properties + self.limit_order(self._symbol, quantity, limit_price) + + # Override the default order properties + order_properties = PublicOrderProperties() + order_properties.time_in_force = TimeInForce.DAY + order_properties.outside_regular_trading_hours = True + order_properties.use_margin = False + self.limit_order(self._symbol, quantity, limit_price, order_properties=order_properties)+
= $writingAlgorithms ? "The PublicBrokerageModel supports" : "We model the Public API by supporting" ?> order updates for single-leg orders. Public doesn't support updating combo (multi-leg) orders.
The following table describes errors you may see when deploying to Public:
+ +| Error Message(s) | +Possible Cause and Fix | +
|---|---|
| + + | +
+ The order costs more than the buying power available for it, so Public rejects it at submission and LEAN reports an invalid order event. The deposit amount in the message is the shortfall. Size the order within your available buying power, or set the UseMarginuse_margin order property to trueTrue on a margin account to use margin buying power.
+ |
+
| + + | ++ Public allows up to 10 pending orders that open new positions per underlying. Cancel one or more pending orders on the underlying before placing a new trade. + | +
| + + | ++ Trading on margin, which includes short selling and buying for more than your settled cash, requires at least $2,000 of cash, equities, and bonds in your account. Deposit funds to meet the minimum or avoid orders that need margin. + | +
If you need further support, open a new support ticket and add the live deployment with the error.