Back

Alpaca Paper Trading query

Hi I am getting familiar with the Lean framework and am trying to test one of the out of the box startegies specifically the "MovingAverageCrossAlgorithm.py". 

In the config.json file I have changed the following.

"environment": "live-alpaca",

"alpaca-key-id": "My-ID",
"alpaca-secret-key": "My-Secret Key",
"alpaca-trading-mode": "paper",

In the MovingAverageCross.py I have set the broker Model to Alpaca.

self.SetBrokerageModel(BrokerageName.Alpaca, AccountType.Cash)

I am not sure if I need to adjust any other settings , when I run the code it doesnt seem to be getting a live data feed. I have tried printing the data to the console using the self.Debug but doesnt show an output.(Below is my output).

Any help is appreciated.

20200727 20:43:14.188 ERROR:: LiveTradingResultHandler.Update(): Algorithm not yet initialized.
20200727 20:43:14.598 Trace:: PythonInitializer.Initialize(): start...
PythonEngine.Initialize(): Runtime.Initialize()...
Runtime.Initialize(): Py_Initialize...
Runtime.Initialize(): PyEval_InitThreads...
Runtime.Initialize(): Initialize types...
Runtime.Initialize(): Initialize types end.
Runtime.Initialize(): AssemblyManager.Initialize()...
Runtime.Initialize(): AssemblyManager.UpdatePath()...
PythonEngine.Initialize(): register atexit callback...
PythonEngine.Initialize(): GetCLRModule()...
PythonEngine.Initialize(): clr GetManifestResourceStream...
20200727 20:43:15.678 Trace:: PythonInitializer.Initialize(): ended
20200727 20:43:15.683 Trace:: AlgorithmPythonWrapper(): Python version 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:25:33)
[GCC 7.3.0]: Importing python module MovingAverageCrossAlgorithm
20200727 20:43:16.489 Trace:: AlgorithmPythonWrapper(): Creating IAlgorithm instance.
20200727 20:43:17.565 Trace:: Config.GetValue(): mute-python-library-logging - Using default value: True
20200727 20:43:17.623 Trace:: Config.Get(): Configuration key not found. Key: results-destination-folder - Using default value: /root/Lean/Launcher/bin/Debug
20200727 20:43:17.624 Trace:: Config.Get(): Configuration key not found. Key: object-store-root - Using default value: ./storage
20200727 20:43:17.625 Trace:: LocalObjectStore.Initialize(): Storage Root: /root/Lean/Launcher/bin/Debug/storage/QCAlgorithm
20200727 20:43:17.626 Trace:: LiveTradingDataFeed.GetDataChannelProvider(): will use DataChannelProvider
20200727 20:43:17.752 Trace:: Config.GetValue(): websocket-log-trace - Using default value: False
20200727 20:43:17.769 Trace:: LiveTradingDataFeed.GetDataQueueHandler(): will use AlpacaBrokerage
20200727 20:43:17.772 Trace:: BaseDataExchange(DataQueueExchange) Starting...
20200727 20:43:17.775 Trace:: BaseDataExchange(CustomDataExchange) Starting...

 

 

 

Update Backtest







0

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.


Hi Georgio Laz ,

At the moment, local Lean users need to use IQFeed data (see credentials section in config.json) and use 
"data-queue-handler": "QuantConnect.ToolBox.IQFeed.IQFeedDataQueueHandler",
instead of
"data-queue-handler": "AlpacaBrokerage",
in the live-alpaca environment. You may want to create e new environment, e.g.: "live-alpaca-iqfeed".

We will be able to use IEX data instead as soon as this PR is merged:
IEX DataQueueHandler updates #4586
or Polygon data in the future.

1

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.


Update Backtest





0

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.


Loading...

This discussion is closed