Repository navigation
Conversation
6 of 11 tasks
Romazes
force-pushed
the
feature-brokerage-etoro
branch
from
October 19, 2026 16:03
9e93415 to
f7312a1
Compare
- BrokerageName.Etoro as the last enum member - EtoroOrderProperties with StopLossRate, the absolute price at which eToro closes a short position
- crypto pays 1% of the trade value on every buy and sell, from the eToro US fees page - stocks and ETFs are commission free on the eToro US fees page, so the equity fee is zero
- Equity and Crypto with Market orders only, no contingent orders - a short sale needs a positive StopLossRate in EtoroOrderProperties - a market sell beyond the long holdings is refused as a cross-zero order - CanUpdateOrder returns false, eToro has no order update - Messages.EtoroBrokerageModel for the two model texts - BrokerageName.Etoro wired in the brokerage model factory
- etoro-api-url, etoro-api-key, etoro-user-key and etoro-demo-environment - live-etoro environment with EtoroBrokerage as brokerage and data queue handler
- CanSubmitOrder: supported and unsupported security and order types, short sale stop loss rate, cross-zero sell - CanUpdateOrder returns false and GetFeeModel returns EtoroFeeModel - EtoroFeeModel: zero for equity, 1% of the trade value for crypto including the live 85.75 USD BTC buy
- CanUpdateOrder answers Messages.DefaultBrokerageModel.OrderUpdateNotSupported - the custom update message and the short-sale comment are removed
PlaceOrderWaitForStatus keeps the Invalid order events and, when the expected status does not come within the timeout, fails with each order's expected and actual status plus its Invalid message. The status handler is unhooked in a finally block, so every failure path removes it.
- why: the etoro plugin advertises Forex (etoro.json assets, symbol mapper on Market.Oanda) and streams and downloads it, but this model refused every Forex order as an unsupported security type, so a Forex algorithm could read prices and never trade - Forex joins Equity and Crypto in the supported security types; the market order, short sale stop loss and cross-zero rules apply the same - the fee stays zero for Forex: eToro charges currencies the spread only, no commission - the Forex test case moves from the unsupported list to the market order accepted list
- why: eToro opens every position at leverage 1, since no leverage is sent with an order and the account eligibility lists only "real long [1]" for every instrument; the model inherited the margin defaults (equity 2, forex 50), so Lean counted buying power eToro does not give - GetLeverage returns 1, as the Coinbase model does - a test checks equity, crypto and forex
- why: the eToro order now carries the leverage of the security; a margin account gives equities 2 and forex 50 by default, so a plain order would open a leveraged position, and eToro refuses a leverage above 1 without a stop loss - the model defaults to AccountType.Cash and uses the base GetLeverage, 1 for a cash account; an algorithm sets more with SetLeverage - CanSubmitOrder refuses an opening order at a leverage above 1 without a StopLossRate, for a buy and for a short sale - tests: the leverage by account type and security type, the cash default, and the stop loss rule
Romazes
force-pushed
the
feature-brokerage-etoro
branch
from
November 3, 2026 21:11
b945d01 to
2e3430b
Compare
- why: the fee was 1% of the trade value but always labelled USD, while the trade value of a pair is in its quote currency, so a BTCEUR trade got its EUR fee booked as USD - the fee uses security.QuoteCurrency.Symbol, as the Coinbase, Binance, Bitfinex and Bybit fee models do; Lean converts it to the account currency - a test checks BTCUSD (fee in USD) and BTCEUR (fee in EUR)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Registers the eToro brokerage in Lean core for the plugin Lean.Brokerages.Etoro.
BrokerageName.Etoro, wired inBrokerageModel.Createand the reverse lookup.EtoroBrokerageModel: equity (US stocks and ETFs), crypto and forex; market orders only; contingent orders refused;CanUpdateOrderfalse, because eToro has no order update.AccountType.Cash, so every security starts at leverage 1. An algorithm sets more withSetLeverage, and the plugin sends that leverage with the order.EtoroOrderProperties.StopLossRatewhen it is a short sale or its leverage is above 1. eToro answers 400 without it: "StopLossRate must be provided when Leverage is greater than 1 or for SellShort transactions".EtoroOrderProperties.StopLossRate: the absolute price at which eToro closes the position.EtoroFeeModel: crypto pays 1% of the trade value on every buy and sell (eToro US fees page; a live 85.75 USD BTC buy paid 0.86 USD). Stocks, ETFs and forex pay nothing (eToro US: "We charge zero commissions when you buy or sell a stock"; live EURUSD fills paid no fee).Messages.EtoroBrokerageModel: the short sale and the leverage texts.Launcher/config.json:etoro-api-url,etoro-api-key,etoro-user-key,etoro-demo-environmentand thelive-etoroenvironment.BrokerageTests.PlaceOrderWaitForStatus: on a timeout, the failure names each order's expected and actual status and its Invalid message.Related Issue
N/A. Plugin: https://github.com/QuantConnect/Lean.Brokerages.Etoro/pull/5 and https://github.com/QuantConnect/Lean.Brokerages.Etoro/pull/9
Motivation and Context
The eToro plugin needs its brokerage name, model, order properties and fee model in Lean core, so Lean routes orders to it, refuses what eToro cannot execute before the order leaves the algorithm, and prices fees in backtests. The stop loss rate for a short sale or a leveraged position is the one eToro rule an algorithm has to satisfy itself.
Requires Documentation Change
Yes: an eToro brokerage page (supported assets and order types, the demo environment flag, the cash account default and
SetLeverage,StopLossRatefor short sales and leverage above 1).How Has This Been Tested?
EtoroBrokerageModelTests(33 cases): supported and unsupported security and order types, the stop loss rate for a short sale and for leverage above 1, a cross-zero sell,CanUpdateOrder,GetFeeModel, the leverage by account type and security type, the cash default.EtoroFeeModelTests(6 cases): zero for equity, 1% of the trade value for crypto, including the live 85.75 USD BTC buy.Types of changes
Checklist:
bug-<issue#>-<description>orfeature-<issue#>-<description>