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 @@ + + + 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.

+ +

Create an Account

+

Follow the account creation wizard on the Public website to create a Public account.

+ +

Create API Credentials

+

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.

+
    +
  1. Apply for API access on the Public API page. Fill out and submit the form, and then wait for the Public concierge team to approve your application.
  2. +
  3. After approval, log in to Public.com, open the Settings menu, click Security on the far right side of the menu, and then click API in the left panel.
  4. +
  5. Generate your secret key. You can keep up to two keys at once and remove a key at any time. Keys inherit your account's permissions and allow read and write access, and LEAN exchanges the secret key for short-lived access tokens automatically.
  6. +
  7. Note the account number of the Public account you want to trade. Public lets you have more than one account, so the account number picks which one to trade.
  8. +
+ +

Paper Trading

+ +

The Public API doesn't support paper trading, but you can follow these steps to simulate it with QuantConnect:

+ +
    +
  1. In the Initializeinitialize method of your algorithm, set the Public brokerage model and your account type.
  2. +
  3. Deploy your algorithm with the QuantConnect Paper Trading brokerage.
  4. +
diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/04 Asset Classes.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/04 Asset Classes.php new file mode 100644 index 0000000000..8e49393d23 --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/04 Asset Classes.php @@ -0,0 +1,6 @@ + diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/05 Data Providers.html b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/05 Data Providers.html new file mode 100644 index 0000000000..36b8d20294 --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/05 Data Providers.html @@ -0,0 +1 @@ +

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.

+ diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/07 Rate Limit.html b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/07 Rate Limit.html new file mode 100644 index 0000000000..be4b5569ff --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/07 Rate Limit.html @@ -0,0 +1,3 @@ +

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.

diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/10 Slippage.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/10 Slippage.php new file mode 100644 index 0000000000..3b2bed4911 --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/10 Slippage.php @@ -0,0 +1,7 @@ + + +

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 @@ + +

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 @@ + + +

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 @@ + 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 @@ + 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()
+
diff --git a/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/16 Deploy Live Algorithms.php b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/16 Deploy Live Algorithms.php new file mode 100644 index 0000000000..c7aac5ee36 --- /dev/null +++ b/01 Cloud Platform/10 Live Trading/02 Brokerages/05 Public/16 Deploy Live Algorithms.php @@ -0,0 +1,10 @@ +Enter your Public secret key and account number." . file_get_contents(DOCS_RESOURCES."/brokerages/create-credentials/public.html"); +$postDeploy = ""; +$dataProviderDetails = "

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 @@ + 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
required

Id of the module. Options : ['PublicBrokerage']
public-secret-key string
required

Your Public secret key.
public-account-number string
required

The number of the Public account you want to trade.
Example +
+{
+  "id": "PublicBrokerage",
+  "public-secret-key": "string",
+  "public-account-number": "string"
+}
+
+
+ + diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/15 Public Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/15 Public Model.html new file mode 100644 index 0000000000..7dfe2732cd --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/15 Public Model.html @@ -0,0 +1,29 @@ +

The PublicFeeModel models the fees of Public at the regular member tier.

+ +
+
security.SetFeeModel(new PublicFeeModel());
+
security.set_fee_model(PublicFeeModel())
+
+ +

The PublicFeeModel charges $0 USD for Equity trades during regular market hours and $2.99 USD per trade during extended hours. Options on stocks and ETFs are free, and Index Options cost $0.50 USD per contract. For Crypto trades, it charges a fee that depends on the order amount in USD:

+ +
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 $5001.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.

\ No newline at end of file +

The TradeStationBrokersBrokerageModel uses the TradeStationFeeModel with the default argument values. We model current TradeStation fees on all assets.

\ No newline at end of file diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Tastytrade/06 Fees.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Tastytrade/06 Fees.html index a1dc38fc4e..004fe22c8c 100644 --- a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Tastytrade/06 Fees.html +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Tastytrade/06 Fees.html @@ -1 +1 @@ -

The TastytradeBrokersBrokerageModel uses the TastytradeFeeModel with the default argument values. We model current Tastytrade fees on all assets.

\ No newline at end of file +

The TastytradeBrokersBrokerageModel uses the TastytradeFeeModel with the default argument values. We model current Tastytrade fees on all assets.

\ No newline at end of file diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/01 Introduction.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/01 Introduction.html new file mode 100644 index 0000000000..8e3a6b314e --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/01 Introduction.html @@ -0,0 +1,11 @@ +

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 @@ + 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.

+ + diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/04 Fills.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/04 Fills.html new file mode 100644 index 0000000000..05faf97069 --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/04 Fills.html @@ -0,0 +1 @@ +

The PublicBrokerageModel uses the EquityFillModel for Equity trades and the ImmediateFillModel for Equity Options, Index Options, and Crypto trades.

diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/05 Slippage.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/05 Slippage.html new file mode 100644 index 0000000000..f26a2a562d --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/05 Slippage.html @@ -0,0 +1 @@ +

The PublicBrokerageModel uses the NullSlippageModel.

diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/06 Fees.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/06 Fees.html new file mode 100644 index 0000000000..dbf7d5bfdb --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/06 Fees.html @@ -0,0 +1 @@ +

The PublicBrokerageModel uses the PublicFeeModel.

diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/07 Buying Power.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/07 Buying Power.html new file mode 100644 index 0000000000..3c6f9557af --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/07 Buying Power.html @@ -0,0 +1,3 @@ +

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.

diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/08 Settlement.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/08 Settlement.html new file mode 100644 index 0000000000..cf7f3e3199 --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/08 Settlement.html @@ -0,0 +1,20 @@ +

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())
+
diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/09 Margin Interest Rate.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/09 Margin Interest Rate.html new file mode 100644 index 0000000000..d689ed5055 --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/09 Margin Interest Rate.html @@ -0,0 +1 @@ +

The PublicBrokerageModel uses the NullMarginInterestRateModel.

diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/17 Default Markets.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/17 Default Markets.html new file mode 100644 index 0000000000..b51cf8ae15 --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/17 Default Markets.html @@ -0,0 +1 @@ +

The default market of the PublicBrokerageModel is Market.USA for Equity, Equity Options, and Index Options. It's Market.CoinbaseMarket.COINBASE for Crypto.

diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/18 Account Currency.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/18 Account Currency.html new file mode 100644 index 0000000000..c78c22a5d7 --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/18 Account Currency.html @@ -0,0 +1,4 @@ +

+ The PublicBrokerageModel doesn't set a default currency. + To change the algorithm's currency from USD to a different currency, see Set Account Currency. +

diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/metadata.json b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/metadata.json new file mode 100644 index 0000000000..35165b9801 --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Public/metadata.json @@ -0,0 +1,12 @@ +{ + "type": "metadata", + "values": { + "description": "This page explains the default security-level models and markets of the PublicBrokerageModel.", + "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 PublicBrokerageModel.", + "og:title": "Public - Documentation QuantConnect.com", + "og:type": "website", + "og:site_name": "Public - QuantConnect.com", + "og:image": "https://cdn.quantconnect.com/docs/i/writing-algorithms/reality-modeling/brokerages/supported-models/public.png" + } +} diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/01 Introduction.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/01 Introduction.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/01 Introduction.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/01 Introduction.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/02 Asset Classes.php b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/02 Asset Classes.php similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/02 Asset Classes.php rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/02 Asset Classes.php diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/03 Orders.php b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/03 Orders.php similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/03 Orders.php rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/03 Orders.php diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/04 Fills.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/04 Fills.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/04 Fills.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/04 Fills.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/05 Slippage.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/05 Slippage.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/05 Slippage.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/05 Slippage.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/06 Fees.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/06 Fees.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/06 Fees.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/06 Fees.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/07 Buying Power.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/07 Buying Power.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/07 Buying Power.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/07 Buying Power.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/08 Settlement.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/08 Settlement.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/08 Settlement.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/08 Settlement.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/09 Margin Interest Rate.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/09 Margin Interest Rate.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/09 Margin Interest Rate.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/09 Margin Interest Rate.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/17 Default Markets.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/17 Default Markets.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/17 Default Markets.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/17 Default Markets.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/18 Account Currency.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/18 Account Currency.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/18 Account Currency.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/18 Account Currency.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/metadata.json b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/metadata.json similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Alpaca/metadata.json rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Alpaca/metadata.json diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/08 Webull/06 Fees.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/08 Webull/06 Fees.html index 76d3ca9c1f..a3e82fb04a 100644 --- a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/08 Webull/06 Fees.html +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/08 Webull/06 Fees.html @@ -1 +1 @@ -

The WebullBrokerageModel uses the WebullFeeModel.

+

The WebullBrokerageModel uses the WebullFeeModel.

diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/19 Wolverine/06 Fees.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/19 Wolverine/06 Fees.html index 274912d858..24aeefec18 100644 --- a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/19 Wolverine/06 Fees.html +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/19 Wolverine/06 Fees.html @@ -1 +1 @@ -

The WolverineBrokerageModel uses the WolverineFeeModel.

\ No newline at end of file +

The WolverineBrokerageModel uses the WolverineFeeModel.

\ No newline at end of file diff --git a/05 Lean CLI/05 Datasets/06 Brokerages/12 Supported Brokerages.html b/05 Lean CLI/05 Datasets/06 Brokerages/12 Supported Brokerages.html index 619992ed7e..b5a1ab2ff1 100644 --- a/05 Lean CLI/05 Datasets/06 Brokerages/12 Supported Brokerages.html +++ b/05 Lean CLI/05 Datasets/06 Brokerages/12 Supported Brokerages.html @@ -1,4 +1,4 @@ -

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:

@@ -68,6 +68,11 @@ + + + + +
--webull-app-secret
--webull-account-id
Public--public-secret-key
--public-account-number
diff --git a/05 Lean CLI/09 Live Trading/01 Brokerages/00.json b/05 Lean CLI/09 Live Trading/01 Brokerages/00.json index 8b74ad338b..5678efc7c6 100644 --- a/05 Lean CLI/09 Live Trading/01 Brokerages/00.json +++ b/05 Lean CLI/09 Live Trading/01 Brokerages/00.json @@ -13,7 +13,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/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/01 Introduction.php b/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/01 Introduction.php new file mode 100644 index 0000000000..e523800a02 --- /dev/null +++ b/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/01 Introduction.php @@ -0,0 +1,9 @@ + + +

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 @@ +Enter your Public secret key and account number. +
+
$ lean cloud live \"My Project\" --push --open
+Secret key: ********************************
+Account number: 5PY12345
+
+" . file_get_contents(DOCS_RESOURCES."/brokerages/create-credentials/public.html") . " +"; +$dataProviderDetails = ""; +$brokerageName="Public"; +$isSupported=true; +$supportsCashHoldings=true; +$supportsPositionHoldings=true; +include(DOCS_RESOURCES."/brokerages/cli-deployment/deploy-cloud-algorithms.php"); +?> diff --git a/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/03 Deploy Local Algorithms.php b/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/03 Deploy Local Algorithms.php new file mode 100644 index 0000000000..f05726f244 --- /dev/null +++ b/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/03 Deploy Local Algorithms.php @@ -0,0 +1,19 @@ +Enter your Public secret key and account number. +
+
$ lean live \"My Project\"
+Secret key: ********************************
+Account number: 5PY12345
+
+" . file_get_contents(DOCS_RESOURCES."/brokerages/create-credentials/public.html") . " +"; +$dataFeedDetails = ""; +$supportsIQFeed = false; +$requiresSubscription = true; +$moduleName = "Public"; +include(DOCS_RESOURCES."/brokerages/cli-deployment/deploy-local-algorithms.php"); +?> diff --git a/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/04 Data Provider.html b/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/04 Data Provider.html new file mode 100644 index 0000000000..935c2248b2 --- /dev/null +++ b/05 Lean CLI/09 Live Trading/01 Brokerages/05 Public/04 Data Provider.html @@ -0,0 +1,11 @@ +

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 @@ Enable a certain debugging method (see --help for more information) - --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>
Update the Lean configuration file to retrieve data from the given historical provider @@ -263,6 +263,18 @@ --webull-account-id <string> Your Webull account id + + --webull-use-2fa <boolean> + Whether two-factor authentication (2FA) should be used (Optional) + + + --public-secret-key <string> + Your Public.com API secret key + + + --public-account-number <string> + Your Public.com account number. Public lets you have more than one account, so this picks which one to trade + --download-data Update the Lean configuration file to download data from the QuantConnect API, alias for --data-provider-historical QuantConnect diff --git a/05 Lean CLI/99 API Reference/06 lean cloud live deploy/04 Options.html b/05 Lean CLI/99 API Reference/06 lean cloud live deploy/04 Options.html index c4351e198b..b0ef7cbcdd 100644 --- a/05 Lean CLI/99 API Reference/06 lean cloud live deploy/04 Options.html +++ b/05 Lean CLI/99 API Reference/06 lean cloud live deploy/04 Options.html @@ -8,7 +8,7 @@ - --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>
The brokerage to use @@ -303,6 +303,18 @@ --webull-account-id <string> Your Webull account id + + --webull-use-2fa <boolean> + Whether two-factor authentication (2FA) should be used (Optional) + + + --public-secret-key <string> + Your Public.com API secret key + + + --public-account-number <string> + Your Public.com account number. Public lets you have more than one account, so this picks which one to trade + --polygon-api-key <string> Your Polygon.io API Key diff --git a/05 Lean CLI/99 API Reference/24 lean data download/04 Options.html b/05 Lean CLI/99 API Reference/24 lean data download/04 Options.html index 8445562e1e..7bbdfd1439 100644 --- a/05 Lean CLI/99 API Reference/24 lean data download/04 Options.html +++ b/05 Lean CLI/99 API Reference/24 lean data download/04 Options.html @@ -8,7 +8,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>
The name of the downloader data provider @@ -251,6 +251,18 @@ --webull-account-id <string> Your Webull account id + + --webull-use-2fa <boolean> + Whether two-factor authentication (2FA) should be used (Optional) + + + --public-secret-key <string> + Your Public.com API secret key + + + --public-account-number <string> + Your Public.com account number. Public lets you have more than one account, so this picks which one to trade + --dataset <string> The name of the dataset to download non-interactively diff --git a/05 Lean CLI/99 API Reference/36 lean live deploy/04 Options.html b/05 Lean CLI/99 API Reference/36 lean live deploy/04 Options.html index 9d99c23282..26b0af1a6c 100644 --- a/05 Lean CLI/99 API Reference/36 lean live deploy/04 Options.html +++ b/05 Lean CLI/99 API Reference/36 lean live deploy/04 Options.html @@ -20,7 +20,7 @@ Run the live deployment in a detached Docker container and return immediately - --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>
The brokerage to use @@ -28,7 +28,7 @@ The live data provider to use - --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>
Update the Lean configuration file to retrieve data from the given historical provider @@ -355,6 +355,18 @@ --webull-account-id <string> Your Webull account id + + --webull-use-2fa <boolean> + Whether two-factor authentication (2FA) should be used (Optional) + + + --public-secret-key <string> + Your Public.com API secret key + + + --public-account-number <string> + Your Public.com account number. Public lets you have more than one account, so this picks which one to trade + --ib-enable-delayed-streaming-data <boolean> Whether delayed data may be used when your algorithm subscribes to a security you don't have a market data subscription for (Optional) diff --git a/05 Lean CLI/99 API Reference/50 lean optimize/04 Options.html b/05 Lean CLI/99 API Reference/50 lean optimize/04 Options.html index 45347d666d..a5f960421b 100644 --- a/05 Lean CLI/99 API Reference/50 lean optimize/04 Options.html +++ b/05 Lean CLI/99 API Reference/50 lean optimize/04 Options.html @@ -40,7 +40,7 @@ The 'statistic operator value' pairs configuring the constraints of the optimization - --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>
Update the Lean configuration file to retrieve data from the given historical provider @@ -319,6 +319,18 @@ --webull-account-id <string> Your Webull account id + + --webull-use-2fa <boolean> + Whether two-factor authentication (2FA) should be used (Optional) + + + --public-secret-key <string> + Your Public.com API secret key + + + --public-account-number <string> + Your Public.com account number. Public lets you have more than one account, so this picks which one to trade + --lean-config <file> The Lean configuration file that should be used (defaults to the nearest lean.json) diff --git a/05 Lean CLI/99 API Reference/57 lean research/04 Options.html b/05 Lean CLI/99 API Reference/57 lean research/04 Options.html index bdb18e3ea6..cd2359469e 100644 --- a/05 Lean CLI/99 API Reference/57 lean research/04 Options.html +++ b/05 Lean CLI/99 API Reference/57 lean research/04 Options.html @@ -12,7 +12,7 @@ The port to run Jupyter Lab on (defaults to 8888) - --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>
Update the Lean configuration file to retrieve data from the given historical provider @@ -255,6 +255,18 @@ --webull-account-id <string> Your Webull account id + + --webull-use-2fa <boolean> + Whether two-factor authentication (2FA) should be used (Optional) + + + --public-secret-key <string> + Your Public.com API secret key + + + --public-account-number <string> + Your Public.com account number. Public lets you have more than one account, so this picks which one to trade + --download-data Update the Lean configuration file to download data from the QuantConnect API, alias for --data-provider-historical QuantConnect diff --git a/QuantConnect-Platform-2.0.0.yaml b/QuantConnect-Platform-2.0.0.yaml index 6b8c6c32f9..b2a6c8e9a4 100644 --- a/QuantConnect-Platform-2.0.0.yaml +++ b/QuantConnect-Platform-2.0.0.yaml @@ -3312,6 +3312,7 @@ components: - $ref: '#/components/schemas/TastytradeSettings' - $ref: '#/components/schemas/AlpacaBrokerageSettings' - $ref: '#/components/schemas/WebullBrokerageSettings' + - $ref: '#/components/schemas/PublicBrokerageSettings' dataProviders: type: object description: Dictionary of data provider configurations to be used in the live algorithm. Provide at least one. The order in which you define the providers defines their order of precedence. @@ -3802,6 +3803,25 @@ components: type: string description: Your Webull account ID. description: Settings for using Webull as the brokerage for a live algorithm. + PublicBrokerageSettings: + type: object + required: + - id + - public-secret-key + - public-account-number + properties: + id: + type: string + description: Id of the module. + enum: + - PublicBrokerage + public-secret-key: + type: string + description: Your Public secret key. + public-account-number: + type: string + description: The number of the Public account you want to trade. + description: Settings for using Public as the brokerage for a live algorithm. PolygonDataProviderSettings: type: object required: diff --git a/Resources/brokerages/cli-deployment/deploy-cloud-algorithms.php b/Resources/brokerages/cli-deployment/deploy-cloud-algorithms.php index 4a5d9617ac..a45ddb2bd2 100644 --- a/Resources/brokerages/cli-deployment/deploy-cloud-algorithms.php +++ b/Resources/brokerages/cli-deployment/deploy-cloud-algorithms.php @@ -34,7 +34,8 @@ "Tastytrade", "Eze", "dYdX", - "Webull" + "Webull", + "Public" ); $brokerageNumber = array_search($brokerageName, $brokerages) + 1; @@ -90,6 +91,7 @@ 18) Eze 19) dYdX 20) Webull +21) Public Enter an option: diff --git a/Resources/brokerages/cli-deployment/deploy-local-algorithms.php b/Resources/brokerages/cli-deployment/deploy-local-algorithms.php index 37f7c64a30..4842fcf598 100644 --- a/Resources/brokerages/cli-deployment/deploy-local-algorithms.php +++ b/Resources/brokerages/cli-deployment/deploy-local-algorithms.php @@ -28,7 +28,8 @@ "Tastytrade", "Eze", "dYdX", - "Webull" + "Webull", + "Public" ); $brokerageNumber = array_search($brokerageName, $brokerages) + 1; } @@ -86,6 +87,7 @@ 18) Eze 19) dYdX 20) Webull +21) Public diff --git a/Resources/brokerages/create-credentials/public.html b/Resources/brokerages/create-credentials/public.html new file mode 100644 index 0000000000..c8050288d0 --- /dev/null +++ b/Resources/brokerages/create-credentials/public.html @@ -0,0 +1 @@ +

To 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 @@ +

PublicBrokerageModel" : "Our Public integration" ?> supports the following asset classes:

+ + diff --git a/Resources/brokerages/public/orders.php b/Resources/brokerages/public/orders.php new file mode 100644 index 0000000000..5ade3ec046 --- /dev/null +++ b/Resources/brokerages/public/orders.php @@ -0,0 +1,145 @@ +

Order Types

+ +

The following table describes the available order types for each asset class that PublicBrokerageModel" ?> supports:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Order TypeEquityEquity OptionsIndex OptionsCrypto
Marketgreen checkgreen checkgreen checkgreen check
Limitgreen checkgreen checkgreen checkgreen check
Stop marketgreen checkgreen checkgreen checkgreen check
Stop limitgreen checkgreen checkgreen checkgreen check
Combo limitgreen checkgreen check
+ + + +

Order Properties

+ +

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.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyData TypeDescriptionDefault Value
TimeInForcetime_in_forceTimeInForceA TimeInForce instruction to apply to the order. The following instructions are supported: +
    +
  • DayDAY
  • +
  • GoodTilCanceledGOOD_TIL_CANCELED
  • +
  • GoodTilDategood_til_date
  • +
+ Public natively supports only day and good-til-date orders, so LEAN sends good-til-canceled orders as good-til-date orders that expire 90 days out. +
TimeInForce.GoodTilCanceledTimeInForce.GOOD_TIL_CANCELED
OutsideRegularTradingHoursoutside_regular_trading_hoursboolIf 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_marginbool?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)
+
+ + +

Updates

+

PublicBrokerageModel supports" : "We model the Public API by supporting" ?> order updates for single-leg orders. Public doesn't support updating combo (multi-leg) orders.

+ + diff --git a/Resources/brokerages/public/troubleshooting.html b/Resources/brokerages/public/troubleshooting.html new file mode 100644 index 0000000000..28604dd290 --- /dev/null +++ b/Resources/brokerages/public/troubleshooting.html @@ -0,0 +1,38 @@ +

The following table describes errors you may see when deploying to Public:

+ + + + + + + + + + + + + + + + + + + + + + +
Error Message(s)Possible Cause and Fix
+
A deposit of $<amount> is required to place this order
+
+ 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. +
+
You can have up to 10 pending orders opening new positions on the same underlying
+
+ 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. +
+
Short selling require margin
+
+ 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.