Hello all,
I am trying to run a local LEAN engine installation on the Kraken Brokerage. I've used the default parameters in QC.Lean.Launcher config.json, set the API key, secret, and verification tier, and set the environment to “live-kraken”.
After building and running LEAN, I see:
20221031 21:54:55.506 ERROR:: JobQueue.NextJob(): Error resolving BrokerageData for live job for brokerage KrakenBrokerage System.InvalidOperationException: Sequence contains no matching element
at System.Linq.ThrowHelper.ThrowNoMatchException()
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
at QuantConnect.Util.Composer.Single[T](Func`2 predicate) in <lean install dir>\Common\Util\Composer.cs:line 176
at QuantConnect.Queues.JobQueue.NextJob(String& location) in <lean install dir>\Queues\JobQueue.cs:line 157
I also tried referencing QuantConnect.KrakenBrokerage.KrakenBrokerage instead of KrakenBrokerage in the config, and the same error is thrown.
Here is the configuration (default) for the kraken environment:
"environment": "live-kraken"
// defines the 'live-kraken' environment
"live-kraken": {
"live-mode": true,
// real brokerage implementations require the BrokerageTransactionHandler
"live-mode-brokerage": "KrakenBrokerage",
"data-queue-handler": [ "KrakenBrokerage" ],
"setup-handler": "QuantConnect.Lean.Engine.Setup.BrokerageSetupHandler",
"result-handler": "QuantConnect.Lean.Engine.Results.LiveTradingResultHandler",
"data-feed-handler": "QuantConnect.Lean.Engine.DataFeeds.LiveTradingDataFeed",
"real-time-handler": "QuantConnect.Lean.Engine.RealTime.LiveTradingRealTimeHandler",
"transaction-handler": "QuantConnect.Lean.Engine.TransactionHandlers.BrokerageTransactionHandler",
"history-provider": [ "BrokerageHistoryProvider", "SubscriptionDataReaderHistoryProvider" ]
},
And here is an example of the algorithm I am using for testing:
public class BasicTemplateAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
private Symbol _avaxbtc;
public override void Initialize()
{
SetBrokerageModel(BrokerageName.Kraken, AccountType.Cash);
SetCash("BTC", 1); //Set Strategy Cash
_avaxbtc = AddCrypto("AVAXBTC", Resolution.Minute, Market.Kraken).Symbol;
// There are other assets with similar methods. See "Selecting Options" etc for more details.
// AddFuture, AddForex, AddCfd, AddOption
}
/// <summary>
/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
/// </summary>
/// <param name="data">Slice object keyed by symbol containing the stock data</param>
public override void OnData(Slice data)
{
if (!Portfolio.Invested)
{
SetHoldings(_avaxbtc, 1);
Debug("Purchased AVAX");
}
}
Does anyone know what this error means and what I may be able to do to resolve it? I get the feeling it's something simple that I am missing, but I cannot figure out what it is.
Miles Child
Also, is it necessary to build the brokerage packages locally to make this work? If so, how do I go about doing that? I tried using the GDAX brokerage in place of the kraken brokerage (in case the issue was potentially kraken-specific) but got the same error. I tried building the GDAX brokerage repo inside of the LEAN repo and including the source code but it still didn't work.
Any help would be appreciated!
Jared Broad
Hi Miles,
To understand better, are you trying to run LEAN without the CLI wrapper? Just curious why?
Can you put a breakpoint near the error and diagnose what it's looking for?
Thanks
Jared
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Miles Child
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!