From a052ffef983d9ee17b4b5eee937cffa45e68ba6d Mon Sep 17 00:00:00 2001 From: Alexandre Catarino Date: Tue, 16 Jul 2024 19:32:18 +0100 Subject: [PATCH] Adds Alpaca Brokerage and Fee Models --- .../01 Key Concepts/03 Default Behavior.html | 2 +- .../02 Supported Models/03 Alpaca Model.html | 20 ++++ ...nance Model.html => 04 Binance Model.html} | 0 ...del.html => 05 Binance Futures Model.html} | 0 ...tml => 06 Binance Coin Futures Model.html} | 0 ...inex Model.html => 07 Bitfinex Model.html} | 0 ...9 Bybit Model.html => 08 Bybit Model.html} | 0 ...Model.html => 09 Bybit Futures Model.html} | 0 ...base Model.html => 10 Coinbase Model.html} | 0 ...html => 11 Interactive Brokers Model.html} | 0 .../05 Brokerages/02 Supported Models/00.json | 1 + .../06 Fees.html | 2 +- .../02 Alpaca/01 Introduction.html | 11 ++ .../02 Alpaca/02 Asset Classes.php | 1 + .../02 Alpaca/03 Orders.php | 3 + .../02 Alpaca/04 Fills.html | 1 + .../02 Alpaca/05 Slippage.html | 6 + .../02 Alpaca/06 Fees.html | 1 + .../02 Alpaca/07 Buying Power.html | 3 + .../02 Alpaca/08 Settlement.html | 21 ++++ .../02 Alpaca/09 Margin Interest Rate.html | 1 + .../02 Alpaca/17 Default Markets.html | 1 + .../02 Alpaca/metadata.json | 12 ++ .../01 Introduction.html | 0 .../02 Asset Classes.php | 0 .../{02 Binance => 03 Binance}/03 Orders.php | 0 .../{02 Binance => 03 Binance}/04 Fills.html | 0 .../05 Slippage.html | 0 .../{02 Binance => 03 Binance}/06 Fees.html | 8 +- .../07 Buying Power.html | 0 .../08 Settlement.html | 0 .../09 Margin Interest Rate.html | 0 .../17 Default Markets.html | 0 .../{02 Binance => 03 Binance}/metadata.json | 0 .../01 Introduction.html | 0 .../02 Asset Classes.php | 0 .../03 Orders.php | 0 .../04 Fills.html | 0 .../05 Slippage.html | 0 .../{03 Bitfinex => 04 Bitfinex}/06 Fees.html | 2 +- .../07 Buying Power.html | 0 .../08 Settlement.html | 0 .../09 Margin Interest Rate.html | 0 .../17 Default Markets.html | 0 .../metadata.json | 0 .../01 Introduction.html | 0 .../02 Asset Classes.php | 0 .../{04 Bybit => 05 Bybit}/03 Orders.php | 0 .../{04 Bybit => 05 Bybit}/04 Fills.html | 0 .../{04 Bybit => 05 Bybit}/05 Slippage.html | 0 .../{04 Bybit => 05 Bybit}/06 Fees.html | 2 +- .../07 Buying Power.html | 0 .../{04 Bybit => 05 Bybit}/08 Settlement.html | 0 .../09 Margin Interest Rate.html | 0 .../17 Default Markets.html | 0 .../{04 Bybit => 05 Bybit}/metadata.json | 0 .../01 Introduction.html | 0 .../02 Asset Classes.php | 0 .../03 Orders.php | 0 .../04 Fills.html | 0 .../05 Slippage.html | 0 .../{05 Coinbase => 06 Coinbase}/06 Fees.html | 2 +- .../07 Buying Power.html | 0 .../08 Settlement.html | 0 .../09 Margin Interest Rate.html | 0 .../17 Default Markets.html | 0 .../metadata.json | 0 .../07 Interactive Brokers/06 Fees.html | 2 +- Resources/brokerages/alpaca/asset-classes.php | 7 ++ Resources/brokerages/alpaca/orders.php | 110 ++++++++++++++++++ 70 files changed, 209 insertions(+), 10 deletions(-) create mode 100644 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/03 Alpaca Model.html rename 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/{05 Binance Model.html => 04 Binance Model.html} (100%) rename 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/{06 Binance Futures Model.html => 05 Binance Futures Model.html} (100%) rename 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/{07 Binance Coin Futures Model.html => 06 Binance Coin Futures Model.html} (100%) rename 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/{08 Bitfinex Model.html => 07 Bitfinex Model.html} (100%) rename 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/{09 Bybit Model.html => 08 Bybit Model.html} (100%) rename 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/{10 Bybit Futures Model.html => 09 Bybit Futures Model.html} (100%) rename 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/{11 Coinbase Model.html => 10 Coinbase Model.html} (100%) rename 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/{03 Interactive Brokers Model.html => 11 Interactive Brokers Model.html} (100%) create mode 100644 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/01 Introduction.html create mode 100644 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/02 Asset Classes.php create mode 100644 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/03 Orders.php create mode 100644 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/04 Fills.html create mode 100644 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/05 Slippage.html create mode 100644 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/06 Fees.html create mode 100644 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/07 Buying Power.html create mode 100644 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/08 Settlement.html create mode 100644 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/09 Margin Interest Rate.html create mode 100644 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/17 Default Markets.html create mode 100644 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/metadata.json rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{02 Binance => 03 Binance}/01 Introduction.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{02 Binance => 03 Binance}/02 Asset Classes.php (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{02 Binance => 03 Binance}/03 Orders.php (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{02 Binance => 03 Binance}/04 Fills.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{02 Binance => 03 Binance}/05 Slippage.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{02 Binance => 03 Binance}/06 Fees.html (81%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{02 Binance => 03 Binance}/07 Buying Power.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{02 Binance => 03 Binance}/08 Settlement.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{02 Binance => 03 Binance}/09 Margin Interest Rate.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{02 Binance => 03 Binance}/17 Default Markets.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{02 Binance => 03 Binance}/metadata.json (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{03 Bitfinex => 04 Bitfinex}/01 Introduction.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{03 Bitfinex => 04 Bitfinex}/02 Asset Classes.php (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{03 Bitfinex => 04 Bitfinex}/03 Orders.php (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{03 Bitfinex => 04 Bitfinex}/04 Fills.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{03 Bitfinex => 04 Bitfinex}/05 Slippage.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{03 Bitfinex => 04 Bitfinex}/06 Fees.html (75%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{03 Bitfinex => 04 Bitfinex}/07 Buying Power.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{03 Bitfinex => 04 Bitfinex}/08 Settlement.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{03 Bitfinex => 04 Bitfinex}/09 Margin Interest Rate.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{03 Bitfinex => 04 Bitfinex}/17 Default Markets.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{03 Bitfinex => 04 Bitfinex}/metadata.json (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{04 Bybit => 05 Bybit}/01 Introduction.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{04 Bybit => 05 Bybit}/02 Asset Classes.php (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{04 Bybit => 05 Bybit}/03 Orders.php (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{04 Bybit => 05 Bybit}/04 Fills.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{04 Bybit => 05 Bybit}/05 Slippage.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{04 Bybit => 05 Bybit}/06 Fees.html (73%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{04 Bybit => 05 Bybit}/07 Buying Power.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{04 Bybit => 05 Bybit}/08 Settlement.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{04 Bybit => 05 Bybit}/09 Margin Interest Rate.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{04 Bybit => 05 Bybit}/17 Default Markets.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{04 Bybit => 05 Bybit}/metadata.json (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{05 Coinbase => 06 Coinbase}/01 Introduction.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{05 Coinbase => 06 Coinbase}/02 Asset Classes.php (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{05 Coinbase => 06 Coinbase}/03 Orders.php (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{05 Coinbase => 06 Coinbase}/04 Fills.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{05 Coinbase => 06 Coinbase}/05 Slippage.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{05 Coinbase => 06 Coinbase}/06 Fees.html (69%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{05 Coinbase => 06 Coinbase}/07 Buying Power.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{05 Coinbase => 06 Coinbase}/08 Settlement.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{05 Coinbase => 06 Coinbase}/09 Margin Interest Rate.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{05 Coinbase => 06 Coinbase}/17 Default Markets.html (100%) rename 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/{05 Coinbase => 06 Coinbase}/metadata.json (100%) create mode 100644 Resources/brokerages/alpaca/asset-classes.php create mode 100644 Resources/brokerages/alpaca/orders.php diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/01 Key Concepts/03 Default Behavior.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/01 Key Concepts/03 Default Behavior.html index e57d942f97..972adb56e7 100644 --- a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/01 Key Concepts/03 Default Behavior.html +++ b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/01 Key Concepts/03 Default Behavior.html @@ -1 +1 @@ -

The brokerage model of your algorithm automatically sets the fill model for each security. The default brokerage model is the DefaultBrokerageModel, which set the ConstantFeeModel with no fees for Forex, CFD, and Crypto assets and sets the InteractiveBrokersFeeModel for the remaining asset classes.

+

The brokerage model of your algorithm automatically sets the fill model for each security. The default brokerage model is the DefaultBrokerageModel, which set the ConstantFeeModel with no fees for Forex, CFD, and Crypto assets and sets the InteractiveBrokersFeeModel for the remaining asset classes.

diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/03 Alpaca Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/03 Alpaca Model.html new file mode 100644 index 0000000000..e9362889db --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/03 Alpaca Model.html @@ -0,0 +1,20 @@ +

The AlpacaFeeModel models the fees of Alpaca.

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

The AlpacaFeeModel charges zero fees for Equity and Equity Options trading. It charges order fees of Alpaca for crypto trading which is a 0.15% maker and 0.25% taker fee. If you add liquidity to the order book by placing a limit order that doesn't cross the spread, you pay maker fees. If you remove liquidity from the order book by placing an order that crosses the spread, you pay taker fees. Alpaca adjusts your fees based on your 30-day trading volume, but we don't currently model these metrics to adjust fees.

+ +

The AlpacaFeeModel charges fees in the currency you receive from a trade. For example, if you buy ETHBTC, you pay fees in ETH. If you sell ETHBTC, you pay fees in BTC.

+ +

To view the implementation of this model, see the LEAN GitHub repository.

+ + \ No newline at end of file diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/05 Binance Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/04 Binance Model.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/05 Binance Model.html rename to 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/04 Binance Model.html diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/06 Binance Futures Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/05 Binance Futures Model.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/06 Binance Futures Model.html rename to 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/05 Binance Futures Model.html diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/07 Binance Coin Futures Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/06 Binance Coin Futures Model.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/07 Binance Coin Futures Model.html rename to 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/06 Binance Coin Futures Model.html diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/08 Bitfinex Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/07 Bitfinex Model.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/08 Bitfinex Model.html rename to 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/07 Bitfinex Model.html diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/09 Bybit Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/08 Bybit Model.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/09 Bybit Model.html rename to 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/08 Bybit Model.html diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/10 Bybit Futures Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/09 Bybit Futures Model.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/10 Bybit Futures Model.html rename to 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/09 Bybit Futures Model.html diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/11 Coinbase Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/10 Coinbase Model.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/11 Coinbase Model.html rename to 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/10 Coinbase Model.html diff --git a/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/03 Interactive Brokers Model.html b/03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/11 Interactive Brokers Model.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/03 Interactive Brokers Model.html rename to 03 Writing Algorithms/24 Reality Modeling/04 Transaction Fees/02 Supported Models/11 Interactive Brokers Model.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/00.json b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/00.json index 331b4697a9..75ab221691 100644 --- a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/00.json +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/00.json @@ -13,6 +13,7 @@ "03": "", "04": "", "05": "", + "06": "", "07": "", "08": "", "09": "", diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/01 QuantConnect Paper Trading/06 Fees.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/01 QuantConnect Paper Trading/06 Fees.html index 12b2e69882..739bbc6d8c 100644 --- a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/01 QuantConnect Paper Trading/06 Fees.html +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/01 QuantConnect Paper Trading/06 Fees.html @@ -1,4 +1,4 @@ -

The DefaultBrokerageModel uses the ConstantFeeModel with no fees for Forex, CFD, Crypto, and Crypto Future assets and the InteractiveBrokersFeeModel for the remaining asset classes.

+

The DefaultBrokerageModel uses the ConstantFeeModel with no fees for Forex, CFD, Crypto, and Crypto Future assets and the InteractiveBrokersFeeModel for the remaining asset classes.

// For Forex, CFD, Crypto, and Crypto Future assets:
diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/01 Introduction.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/01 Introduction.html
new file mode 100644
index 0000000000..63994688cc
--- /dev/null
+++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/01 Introduction.html	
@@ -0,0 +1,11 @@
+

This page explains the AlpacaBrokerageModel, including the asset classes it supports, its default security-level models, and it's default markets.

+ + +
+
SetBrokerageModel(BrokerageName.Alpaca, AccountType.Cash);
+SetBrokerageModel(BrokerageName.Alpaca, AccountType.Margin);
+
self.set_brokerage_model(BrokerageName.ALPACA, AccountType.CASH)
+self.set_brokerage_model(BrokerageName.ALPACA, AccountType.MARGIN)
+
+ +

To view the implementation of this model, see the LEAN GitHub repository.

diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/02 Asset Classes.php b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/02 Asset Classes.php new file mode 100644 index 0000000000..1e272b2a7a --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/02 Asset Classes.php @@ -0,0 +1 @@ + diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/03 Orders.php b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/03 Orders.php new file mode 100644 index 0000000000..890577649c --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/03 Orders.php @@ -0,0 +1,3 @@ +

The AlpacaBrokerageModel supports several order types, order properties, and most order updates.

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

The AlpacaBrokerageModel uses the EquityFillModel for Equity trades and the ImmediateFillModel for Option and Crypto trades.

\ No newline at end of file diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/05 Slippage.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/05 Slippage.html new file mode 100644 index 0000000000..b55e78cb23 --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/05 Slippage.html @@ -0,0 +1,6 @@ +

The AlpacaBrokerageModel uses the NullSlippageModel.

+ +
+
security.set_slippage_model(NullSlippageModel.instance);
+
security.set_slippage_model(NullSlippageModel.instance)
+
diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/06 Fees.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/06 Fees.html new file mode 100644 index 0000000000..d336c48e7d --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/06 Fees.html @@ -0,0 +1 @@ +

The AlpacaBrokerageModel uses the AlpacaFeeModel with the default argument values. We model current Alpaca fees on all assets.

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

The AlpacaBrokerageModel uses the CashBuyingPowerModel for cash accounts, the SecurityMarginModel for margin accounts, and OptionMarginModel for Option trades.

+ +

If you have a margin account, the AlpacaBrokerageModel allows 2x leverage for Equities, and 3x leverage for Crypto.

\ No newline at end of file diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/08 Settlement.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/08 Settlement.html new file mode 100644 index 0000000000..1ece1005bc --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/08 Settlement.html @@ -0,0 +1,21 @@ +

The AlpacaBrokerageModel 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())
+
\ No newline at end of file diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/09 Margin Interest Rate.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/09 Margin Interest Rate.html new file mode 100644 index 0000000000..201a5548bd --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/09 Margin Interest Rate.html @@ -0,0 +1 @@ +

The AlpacaBrokerageModel uses the NullMarginInterestRateModel.

\ No newline at end of file diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/17 Default Markets.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/17 Default Markets.html new file mode 100644 index 0000000000..d488494812 --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/17 Default Markets.html @@ -0,0 +1 @@ +

The default market of the AlpacaBrokerageModel is Market.USA for Equity and Equity Options, and Market.CoinbaseMarket.COINBASE for Crypto.

\ No newline at end of file diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/metadata.json b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/metadata.json new file mode 100644 index 0000000000..7af6a1f729 --- /dev/null +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Alpaca/metadata.json @@ -0,0 +1,12 @@ +{ + "type": "metadata", + "values": { + "description": "This page explains the default security-level models and markets of the AlpacaBrokerageModel.", + "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 AlpacaBrokerageModel.", + "og:title": "Alpaca - Documentation QuantConnect.com", + "og:type": "website", + "og:site_name": "Alpaca - QuantConnect.com", + "og:image": "https://cdn.quantconnect.com/docs/i/writing-algorithms/reality-modeling/brokerages/supported-models/alpaca.png" + } +} diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/01 Introduction.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/01 Introduction.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/01 Introduction.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/01 Introduction.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/02 Asset Classes.php b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/02 Asset Classes.php similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/02 Asset Classes.php rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/02 Asset Classes.php diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/03 Orders.php b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/03 Orders.php similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/03 Orders.php rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/03 Orders.php diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/04 Fills.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/04 Fills.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/04 Fills.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/04 Fills.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/05 Slippage.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/05 Slippage.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/05 Slippage.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/05 Slippage.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/06 Fees.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/06 Fees.html similarity index 81% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/06 Fees.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/06 Fees.html index 72d72ccc6e..3713aa944d 100644 --- a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/06 Fees.html +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/06 Fees.html @@ -10,19 +10,19 @@ BinanceBrokerageModel - BinanceFeeModel + BinanceFeeModel BinanceFuturesBrokerageModel - BinanceFuturesFeeModel + BinanceFuturesFeeModel BinanceCoinFuturesBrokerageModel - BinanceCoinFuturesFeeModel + BinanceCoinFuturesFeeModel BinanceUSBrokerageModel - BinanceFeeModel + BinanceFeeModel diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/07 Buying Power.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/07 Buying Power.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/07 Buying Power.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/07 Buying Power.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/08 Settlement.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/08 Settlement.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/08 Settlement.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/08 Settlement.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/09 Margin Interest Rate.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/09 Margin Interest Rate.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/09 Margin Interest Rate.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/09 Margin Interest Rate.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/17 Default Markets.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/17 Default Markets.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/17 Default Markets.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/17 Default Markets.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/metadata.json b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/metadata.json similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/02 Binance/metadata.json rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Binance/metadata.json diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/01 Introduction.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/01 Introduction.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/01 Introduction.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/01 Introduction.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/02 Asset Classes.php b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/02 Asset Classes.php similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/02 Asset Classes.php rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/02 Asset Classes.php diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/03 Orders.php b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/03 Orders.php similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/03 Orders.php rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/03 Orders.php diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/04 Fills.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/04 Fills.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/04 Fills.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/04 Fills.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/05 Slippage.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/05 Slippage.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/05 Slippage.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/05 Slippage.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/06 Fees.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/06 Fees.html similarity index 75% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/06 Fees.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/06 Fees.html index c8777a9385..afda8af2eb 100644 --- a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/06 Fees.html +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/06 Fees.html @@ -1 +1 @@ -

The BitfinexBrokerageModel uses the BitfinexFeeModel with the default argument values that models the current Bitfinex fee schedule.

+

The BitfinexBrokerageModel uses the BitfinexFeeModel with the default argument values that models the current Bitfinex fee schedule.

diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/07 Buying Power.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/07 Buying Power.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/07 Buying Power.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/07 Buying Power.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/08 Settlement.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/08 Settlement.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/08 Settlement.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/08 Settlement.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/09 Margin Interest Rate.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/09 Margin Interest Rate.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/09 Margin Interest Rate.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/09 Margin Interest Rate.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/17 Default Markets.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/17 Default Markets.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/17 Default Markets.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/17 Default Markets.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/metadata.json b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/metadata.json similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/03 Bitfinex/metadata.json rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bitfinex/metadata.json diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/01 Introduction.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/01 Introduction.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/01 Introduction.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/01 Introduction.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/02 Asset Classes.php b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/02 Asset Classes.php similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/02 Asset Classes.php rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/02 Asset Classes.php diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/03 Orders.php b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/03 Orders.php similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/03 Orders.php rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/03 Orders.php diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/04 Fills.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/04 Fills.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/04 Fills.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/04 Fills.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/05 Slippage.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/05 Slippage.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/05 Slippage.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/05 Slippage.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/06 Fees.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/06 Fees.html similarity index 73% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/06 Fees.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/06 Fees.html index 684dceff26..6a9aa977ca 100644 --- a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/06 Fees.html +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/06 Fees.html @@ -1 +1 @@ -

The BybitBrokerageModel uses the BybitFeeModel for Crypto trades and the BybitFuturesFeeModel for Crypto Future trades. In both cases, the brokerage model uses the default argument values that models the Bybit fee schedule for VIP Level 0.

+

The BybitBrokerageModel uses the BybitFeeModel for Crypto trades and the BybitFuturesFeeModel for Crypto Future trades. In both cases, the brokerage model uses the default argument values that models the Bybit fee schedule for VIP Level 0.

diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/07 Buying Power.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/07 Buying Power.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/07 Buying Power.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/07 Buying Power.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/08 Settlement.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/08 Settlement.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/08 Settlement.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/08 Settlement.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/09 Margin Interest Rate.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/09 Margin Interest Rate.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/09 Margin Interest Rate.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/09 Margin Interest Rate.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/17 Default Markets.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/17 Default Markets.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/17 Default Markets.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/17 Default Markets.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/metadata.json b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/metadata.json similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/04 Bybit/metadata.json rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Bybit/metadata.json diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/01 Introduction.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/01 Introduction.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/01 Introduction.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/01 Introduction.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/02 Asset Classes.php b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/02 Asset Classes.php similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/02 Asset Classes.php rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/02 Asset Classes.php diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/03 Orders.php b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/03 Orders.php similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/03 Orders.php rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/03 Orders.php diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/04 Fills.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/04 Fills.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/04 Fills.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/04 Fills.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/05 Slippage.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/05 Slippage.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/05 Slippage.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/05 Slippage.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/06 Fees.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/06 Fees.html similarity index 69% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/06 Fees.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/06 Fees.html index 6891ee93ac..b360151f1c 100644 --- a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/06 Fees.html +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/06 Fees.html @@ -1 +1 @@ -

The CoinbaseBrokerageModel uses the CoinbaseFeeModel.

\ No newline at end of file +

The CoinbaseBrokerageModel uses the CoinbaseFeeModel.

\ No newline at end of file diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/07 Buying Power.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/07 Buying Power.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/07 Buying Power.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/07 Buying Power.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/08 Settlement.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/08 Settlement.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/08 Settlement.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/08 Settlement.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/09 Margin Interest Rate.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/09 Margin Interest Rate.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/09 Margin Interest Rate.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/09 Margin Interest Rate.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/17 Default Markets.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/17 Default Markets.html similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/17 Default Markets.html rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/17 Default Markets.html diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/metadata.json b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/metadata.json similarity index 100% rename from 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/05 Coinbase/metadata.json rename to 03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/06 Coinbase/metadata.json diff --git a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/07 Interactive Brokers/06 Fees.html b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/07 Interactive Brokers/06 Fees.html index 7a1b86304c..75648eff75 100644 --- a/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/07 Interactive Brokers/06 Fees.html +++ b/03 Writing Algorithms/24 Reality Modeling/05 Brokerages/02 Supported Models/07 Interactive Brokers/06 Fees.html @@ -1 +1 @@ -

The InteractiveBrokersBrokerageModel uses the InteractiveBrokersFeeModel with the default argument values. We model current Interactive Brokers fees on all assets.

+

The InteractiveBrokersBrokerageModel uses the InteractiveBrokersFeeModel with the default argument values. We model current Interactive Brokers fees on all assets.

diff --git a/Resources/brokerages/alpaca/asset-classes.php b/Resources/brokerages/alpaca/asset-classes.php new file mode 100644 index 0000000000..f2bba26ae4 --- /dev/null +++ b/Resources/brokerages/alpaca/asset-classes.php @@ -0,0 +1,7 @@ +

AlpacaBrokerageModel" : "Our Alpaca integration" ?> supports the following asset classes:

+ + \ No newline at end of file diff --git a/Resources/brokerages/alpaca/orders.php b/Resources/brokerages/alpaca/orders.php new file mode 100644 index 0000000000..59c44a6680 --- /dev/null +++ b/Resources/brokerages/alpaca/orders.php @@ -0,0 +1,110 @@ +

Order Types

+ +

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

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Order TypeEquityEquity OptionsCrypto
Marketgreen checkgreen checkgreen check
Limitgreen checkgreen checkgreen check
Stop marketgreen checkgreen check
Stop limitgreen checkgreen checkgreen check
Trailing stopgreen checkgreen check
+ + + +

Time In Force

+

AlpacaBrokerageModel supports" : "We model the Alpaca API by supporting" ?> the following TimeInForce instructions:

+ +
    +
  • DayDAY
  • +
  • GoodTilCanceledGOOD_TIL_CANCELED
  • +
  • GoodTilDategood_til_date
  • +
+ + +
+
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 TradeStationOrderProperties
+               { 
+                   TimeInForce = TimeInForce.Day
+               });
+    LimitOrder(_symbol, quantity, limitPrice, 
+               orderProperties: new TradeStationOrderProperties
+               { 
+                   TimeInForce = TimeInForce.GoodTilDate(new DateTime(year, month, day))
+               });
+}
+
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 = TradeStationOrderProperties()
+    order_properties.time_in_force = TimeInForce.DAY
+    self.limit_order(self._symbol, quantity, limit_price, order_properties=order_properties)
+
+    order_properties.time_in_force = TimeInForce.good_til_date(datetime(year, month, day))
+    self.limit_order(self._symbol, quantity, limit_price, order_properties=order_properties)
+
+ + +

Updates

+

AlpacaBrokerageModel supports" : "We model the Alpaca API by supporting" ?> order updates.

+ + \ No newline at end of file