Dear Community,
I hope someone can help me.
I followed the guideline below to use ApiDataProvider to download Oanda forex data:
https://www.quantconnect.com/tutorials/open-source/using-the-api-file-providerI already added the "EURUSD" data to "My Data" on the Portal.
I can manually clicked on the zip file and download them from browser.
I already got the "job user id" and "API access token" configured in my "config.json".
But when I ran the strategy, i got the ERROR below:
----------------
Pulling Docker image: quantconnect/lean:latest
latest: Pulling from quantconnect/lean
Digest: sha256:dbb2a69cd94b00bb35fc860121d46df86b51d96a18beb59b6bef5feb0ca356f3
Status: Image is up to date for quantconnect/lean:latest
docker.io/quantconnect/lean:latest
Launching LeanEngine with command:
...
20210315 16:09:45.013 TRACE:: Using /Lean/Launcher/config.json as configuration file
20210315 16:09:45.126 TRACE:: Config.GetValue(): debug-mode - Using default value: False
20210315 16:09:45.126 TRACE:: Config.Get(): Configuration key not found. Key: plugin-directory - Using default value:
20210315 16:09:45.128 TRACE:: Config.Get(): Configuration key not found. Key: composer-dll-directory - Using default value: /Lean/Launcher/bin/Debug/
20210315 16:09:45.193 TRACE:: Python for .NET Assembly: Python.Runtime, Version=2.0.1.0, Culture=neutral, PublicKeyToken=5000fea6cba702dd
20210315 16:09:45.447 TRACE:: Python for .NET Assembly: nPython, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null
20210315 16:09:45.456 TRACE:: Config.Get(): Configuration key not found. Key: data-directory - Using default value: ../../../Data/
20210315 16:09:45.475 TRACE:: Config.Get(): Configuration key not found. Key: version-id - Using default value:
20210315 16:09:45.476 TRACE:: Config.Get(): Configuration key not found. Key: cache-location - Using default value: /Data
20210315 16:09:45.477 TRACE:: Engine.Main(): LEAN ALGORITHMIC TRADING ENGINE v2.5.0.0 Mode: DEBUG (64bit)
20210315 16:09:45.488 TRACE:: Engine.Main(): Started 4:09 PM
20210315 16:09:45.495 TRACE:: Config.GetValue(): job-project-id - Using default value: 0
20210315 16:09:45.521 TRACE:: Config.GetValue(): regression-update-statistics - Using default value: False
20210315 16:09:45.536 TRACE:: Config.Get(): Configuration key not found. Key: lean-manager-type - Using default value: LocalLeanManager
20210315 16:09:46.004 TRACE:: JobQueue.NextJob(): Selected ../../../Algorithm.Python/BasicTemplateForexAlgorithm.py
20210315 16:09:46.022 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-capacity - Using default value: 120
20210315 16:09:46.023 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-time-interval-minutes - Using default value: 1440
20210315 16:09:46.025 TRACE:: Config.GetValue(): scheduled-event-leaky-bucket-refill-amount - Using default value: 18
20210315 16:09:46.032 TRACE:: Config.Get(): Configuration key not found. Key: algorithm-id - Using default value: BasicTemplateForexAlgorithm
20210315 16:09:46.037 TRACE:: Config.Get(): Configuration key not found. Key: data-permission-manager - Using default value: DataPermissionManager
20210315 16:09:46.057 TRACE:: Config.GetValue(): api-data-update-period - Using default value: 5
20210315 16:09:46.061 TRACE:: Config.Get(): Configuration key not found. Key: object-store-root - Using default value: ./storage
20210315 16:09:46.065 TRACE:: AlgorithmManager.CreateTokenBucket(): Initializing LeakyBucket: Capacity: 120 RefillAmount: 18 TimeInterval: 1440
20210315 16:09:46.068 TRACE:: Config.GetValue(): algorithm-manager-time-loop-maximum - Using default value: 20
20210315 16:09:46.089 TRACE:: TextSubscriptionDataSourceReader.SetCacheSize(): Setting cache size to 71582788 items
20210315 16:09:46.475 TRACE:: Config.GetValue(): algorithm-creation-timeout - Using default value: 90
20210315 16:09:46.486 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(): GetCLRModule()...
PythonEngine.Initialize(): clr GetManifestResourceStream...
20210315 16:09:47.610 TRACE:: PythonInitializer.Initialize(): ended
20210315 16:09:47.615 TRACE:: AlgorithmPythonWrapper(): Python version 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:25:33)
[GCC 7.3.0]: Importing python module BasicTemplateForexAlgorithm
20210315 16:09:49.645 TRACE:: AlgorithmPythonWrapper(): BasicTemplateForexAlgorithm successfully imported.
20210315 16:09:49.652 TRACE:: AlgorithmPythonWrapper(): Creating IAlgorithm instance.
20210315 16:09:50.739 TRACE:: Config.GetValue(): mute-python-library-logging - Using default value: True
20210315 16:09:50.763 TRACE:: LocalObjectStore.Initialize(): Storage Root: /Lean/Launcher/bin/Debug/storage/QCAlgorithm
20210315 16:09:50.800 TRACE:: Config.Get(): Configuration key not found. Key: security-data-feeds - Using default value:
20210315 16:09:50.941 TRACE:: Config.GetValue(): data-feed-workers-count - Using default value: 3
20210315 16:09:50.942 TRACE:: Config.GetValue(): data-feed-max-work-weight - Using default value: 400
20210315 16:09:50.944 TRACE:: Config.Get(): Configuration key not found. Key: data-feed-queue-type - Using default value: QuantConnect.Lean.Engine.DataFeeds.WorkScheduling.WorkQueue, QuantConnect.Lean.Engine
20210315 16:09:50.945 TRACE:: WeightedWorkScheduler(): will use 3 workers and MaxWorkWeight is 400. Queue type: WorkQueue
20210315 16:09:50.992 TRACE:: Config.GetValue(): show-missing-data-logs - Using default value: False
20210315 16:09:51.014 TRACE:: ApiDataProvider.Fetch(): Attempting to get data from QuantConnect.com's data library for symbol(EURUSD), resolution(Minute) and date(3/12/2021).
20210315 16:09:51.316 TRACE:: ApiDataProvider.Fetch(): Attempting to get data from QuantConnect.com's data library for symbol(EURUSD), resolution(Second) and date(3/14/2021).
20210315 16:09:52.076 ERROR:: ApiDataProvider.Fetch(): Unable to remotely retrieve data for path /Data/forex/oanda/second/eurusd/20210314_quote.zip. Please make sure you have the necessary data in your online QuantConnect data library.
20210315 16:09:52.083 TRACE:: ApiDataProvider.Fetch(): Attempting to get data from QuantConnect.com's data library for symbol(EURUSD), resolution(Second) and date(3/15/2021).
20210315 16:09:52.192 ERROR:: ApiDataProvider.Fetch(): Unable to remotely retrieve data for path /Data/forex/oanda/second/eurusd/20210315_quote.zip. Please make sure you have the necessary data in your online QuantConnect data library.
20210315 16:09:52.337 TRACE:: ApiDataProvider.Fetch(): Attempting to get data from QuantConnect.com's data library for symbol(EURUSD), resolution(Minute) and date(3/12/2021).
20210315 16:09:52.573 ERROR:: ZipDataCacheProvider.Fetch(): Inner try/catch System.UnauthorizedAccessException: Access to the path "/Data/forex/oanda/minute/eurusd/20210312_quote.zip" is denied.
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int)
at System.IO.File.Create (System.String path, System.Int32 bufferSize) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at System.IO.File.Create (System.String path) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at System.IO.File.WriteAllBytes (System.String path, System.Byte[] bytes) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at RestSharp.Extensions.MiscExtensions.SaveAs (System.Byte[] input, System.String path) [0x00000] in <d763243987454e81b285f1d75ecfc7f5>:0
at QuantConnect.Api.Api.DownloadData (QuantConnect.Symbol symbol, QuantConnect.Resolution resolution, System.DateTime date) [0x00128] in <a8b6a279e72b4eb5895f78b968df01da>:0
at QuantConnect.Lean.Engine.DataFeeds.ApiDataProvider.DownloadData (System.String filepath, QuantConnect.Symbol symbol, System.DateTime date, QuantConnect.Resolution resolution) [0x00037] in <2803f7b57e284f97ba594dcfab741c01>:0
at QuantConnect.Lean.Engine.DataFeeds.ApiDataProvider.Fetch (System.String key) [0x0002b] in <2803f7b57e284f97ba594dcfab741c01>:0
at QuantConnect.Lean.Engine.DataFeeds.ZipDataCacheProvider.CacheAndCreateStream (System.String filename, System.String entryName) [0x00003] in <2803f7b57e284f97ba594dcfab741c01>:0
at QuantConnect.Lean.Engine.DataFeeds.ZipDataCacheProvider.Fetch (System.String key) [0x00063] in <2803f7b57e284f97ba594dcfab741c01>:0
20210315 16:09:52.575 TRACE:: ApiDataProvider.Fetch(): Attempting to get data from QuantConnect.com's data library for symbol(EURUSD), resolution(Minute) and date(3/14/2021).
20210315 16:09:52.898 ERROR:: ZipDataCacheProvider.Fetch(): Inner try/catch System.UnauthorizedAccessException: Access to the path "/Data/forex/oanda/minute/eurusd/20210314_quote.zip" is denied.
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int)
at System.IO.File.Create (System.String path, System.Int32 bufferSize) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at System.IO.File.Create (System.String path) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at System.IO.File.WriteAllBytes (System.String path, System.Byte[] bytes) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at RestSharp.Extensions.MiscExtensions.SaveAs (System.Byte[] input, System.String path) [0x00000] in <d763243987454e81b285f1d75ecfc7f5>:0
at QuantConnect.Api.Api.DownloadData (QuantConnect.Symbol symbol, QuantConnect.Resolution resolution, System.DateTime date) [0x00128] in <a8b6a279e72b4eb5895f78b968df01da>:0
at QuantConnect.Lean.Engine.DataFeeds.ApiDataProvider.DownloadData (System.String filepath, QuantConnect.Symbol symbol, System.DateTime date, QuantConnect.Resolution resolution) [0x00037] in <2803f7b57e284f97ba594dcfab741c01>:0
at QuantConnect.Lean.Engine.DataFeeds.ApiDataProvider.Fetch (System.String key) [0x0002b] in <2803f7b57e284f97ba594dcfab741c01>:0
at QuantConnect.Lean.Engine.DataFeeds.ZipDataCacheProvider.CacheAndCreateStream (System.String filename, System.String entryName) [0x00003] in <2803f7b57e284f97ba594dcfab741c01>:0
at QuantConnect.Lean.Engine.DataFeeds.ZipDataCacheProvider.Fetch (System.String key) [0x00063] in <2803f7b57e284f97ba594dcfab741c01>:0
20210315 16:09:52.900 TRACE:: ApiDataProvider.Fetch(): Attempting to get data from QuantConnect.com's data library for symbol(EURUSD), resolution(Minute) and date(3/15/2021).
20210315 16:09:53.108 ERROR:: Api.DownloadData(): Failed to download zip for EURUSD Minute data for date 3/15/2021 12:00:00 AM, Api response: Not found (3nDQMU3H)
20210315 16:09:53.109 ERROR:: ApiDataProvider.Fetch(): Unable to remotely retrieve data for path /Data/forex/oanda/minute/eurusd/20210315_quote.zip. Please make sure you have the necessary data in your online QuantConnect data library.
20210315 16:09:53.140 ERROR:: ZipDataCacheProvider.Fetch(): Inner try/catch System.UnauthorizedAccessException: Access to the path "/Data/forex/oanda/minute/eurusd/20210314_quote.zip" is denied.
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int)
at System.IO.File.Create (System.String path, System.Int32 bufferSize) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at System.IO.File.Create (System.String path) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at System.IO.File.WriteAllBytes (System.String path, System.Byte[] bytes) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at RestSharp.Extensions.MiscExtensions.SaveAs (System.Byte[] input, System.String path) [0x00000] in <d763243987454e81b285f1d75ecfc7f5>:0
at QuantConnect.Api.Api.DownloadData (QuantConnect.Symbol symbol, QuantConnect.Resolution resolution, System.DateTime date) [0x00128] in <a8b6a279e72b4eb5895f78b968df01da>:0
at QuantConnect.Lean.Engine.DataFeeds.ApiDataProvider.DownloadData (System.String filepath, QuantConnect.Symbol symbol, System.DateTime date, QuantConnect.Resolution resolution) [0x00037] in <2803f7b57e284f97ba594dcfab741c01>:0
at QuantConnect.Lean.Engine.DataFeeds.ApiDataProvider.Fetch (System.String key) [0x0002b] in <2803f7b57e284f97ba594dcfab741c01>:0
at QuantConnect.Lean.Engine.DataFeeds.ZipDataCacheProvider.CacheAndCreateStream (System.String filename, System.String entryName) [0x00003] in <2803f7b57e284f97ba594dcfab741c01>:0
at QuantConnect.Lean.Engine.DataFeeds.ZipDataCacheProvider.Fetch (System.String key) [0x00063] in <2803f7b57e284f97ba594dcfab741c01>:0
20210315 16:09:53.334 ERROR:: Api.DownloadData(): Failed to download zip for EURUSD Minute data for date 3/15/2021 12:00:00 AM, Api response: Not found (3nDQMU3H)
20210315 16:09:53.335 ERROR:: ApiDataProvider.Fetch(): Unable to remotely retrieve data for path /Data/forex/oanda/minute/eurusd/20210315_quote.zip. Please make sure you have the necessary data in your online QuantConnect data library.
20210315 16:09:53.341 TRACE:: BaseSetupHandler.SetupCurrencyConversions():
Symbol Quantity Conversion = Value in USD
USD: $ 100000.00 @ 1.00 = $100000.0
EUR: € 0.00 @ 0.00 = $0
-------------------------------------------------
CashBook Total Value: $100000.0
20210315 16:09:53.346 TRACE:: BacktestingResultHandler(): Sample Period Set: 04.00
20210315 16:09:53.349 TRACE:: Time.TradeableDates(): Security Count: 1
20210315 16:09:53.353 TRACE:: Config.GetValue(): forward-console-messages - Using default value: True
20210315 16:09:53.356 TRACE:: JOB HANDLERS:
20210315 16:09:53.357 TRACE:: DataFeed: QuantConnect.Lean.Engine.DataFeeds.FileSystemDataFeed
20210315 16:09:53.358 TRACE:: Setup: QuantConnect.Lean.Engine.Setup.ConsoleSetupHandler
20210315 16:09:53.358 TRACE:: RealTime: QuantConnect.Lean.Engine.RealTime.BacktestingRealTimeHandler
20210315 16:09:53.359 TRACE:: Results: QuantConnect.Lean.Engine.Results.BacktestingResultHandler
20210315 16:09:53.360 TRACE:: Transactions: QuantConnect.Lean.Engine.TransactionHandlers.BacktestingTransactionHandler
20210315 16:09:53.361 TRACE:: Alpha: QuantConnect.Lean.Engine.Alphas.DefaultAlphaHandler
20210315 16:09:53.362 TRACE:: ObjectStore: QuantConnect.Lean.Engine.Storage.LocalObjectStore
20210315 16:09:53.363 TRACE:: History Provider: QuantConnect.Lean.Engine.HistoricalData.SubscriptionDataReaderHistoryProvider
20210315 16:09:53.398 TRACE:: AlgorithmManager.Run(): Begin DataStream - Start: 3/14/2021 12:00:00 AM Stop: 3/14/2021 11:59:59 PM
20210315 16:09:53.411 TRACE:: Debug: Launching analysis for BasicTemplateForexAlgorithm with LEAN Engine v2.5.0.0
20210315 16:09:53.444 TRACE:: ApiDataProvider.Fetch(): Attempting to get data from QuantConnect.com's data library for symbol(EURUSD), resolution(Minute) and date(3/14/2021).
20210315 16:09:53.706 ERROR:: ZipDataCacheProvider.Fetch(): Inner try/catch System.UnauthorizedAccessException: Access to the path "/Data/forex/oanda/minute/eurusd/20210314_quote.zip" is denied.
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int)
at System.IO.File.Create (System.String path, System.Int32 bufferSize) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at System.IO.File.Create (System.String path) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at System.IO.File.WriteAllBytes (System.String path, System.Byte[] bytes) [0x00000] in <b0e1ad7573a24fd5a9f2af9595e677e7>:0
at RestSharp.Extensions.MiscExtensions.SaveAs (System.Byte[] input, System.String path) [0x00000] in <d763243987454e81b285f1d75ecfc7f5>:0
at QuantConnect.Api.Api.DownloadData (QuantConnect.Symbol symbol, QuantConnect.Resolution resolution, System.DateTime date) [0x00128] in <a8b6a279e72b4eb5895f78b968df01da>:0
at QuantConnect.Lean.Engine.DataFeeds.ApiDataProvider.DownloadData (System.String filepath, QuantConnect.Symbol symbol, System.DateTime date, QuantConnect.Resolution resolution) [0x00037] in <2803f7b57e284f97ba594dcfab741c01>:0
at QuantConnect.Lean.Engine.DataFeeds.ApiDataProvider.Fetch (System.String key) [0x0002b] in <2803f7b57e284f97ba594dcfab741c01>:0
at QuantConnect.Lean.Engine.DataFeeds.ZipDataCacheProvider.CacheAndCreateStream (System.String filename, System.String entryName) [0x00003] in <2803f7b57e284f97ba594dcfab741c01>:0
at QuantConnect.Lean.Engine.DataFeeds.ZipDataCacheProvider.Fetch (System.String key) [0x00063] in <2803f7b57e284f97ba594dcfab741c01>:0
20210315 16:09:53.708 TRACE:: ApiDataProvider.Fetch(): Attempting to get data from QuantConnect.com's data library for symbol(EURUSD), resolution(Minute) and date(3/15/2021).
20210315 16:09:53.894 ERROR:: Api.DownloadData(): Failed to download zip for EURUSD Minute data for date 3/15/2021 12:00:00 AM, Api response: Not found (3nDQMU3H)
20210315 16:09:53.895 ERROR:: ApiDataProvider.Fetch(): Unable to remotely retrieve data for path /Data/forex/oanda/minute/eurusd/20210315_quote.zip. Please make sure you have the necessary data in your online QuantConnect data library.
--
Katama
The main error is: UnauthorizedAccessException
--
20210315 16:09:52.573 ERROR:: ZipDataCacheProvider.Fetch(): Inner try/catch System.UnauthorizedAccessException: Access to the path "/Data/forex/oanda/minute/eurusd/20210312_quote.zip" is denied.
--
Do I need to be on a paid plan members to be able to use ApiDataProvider? Or, is it something else.
Please help!
Katama
I'm in Quant Researcher tier and it should allow for API access.
I don't see anything wrong from the code.
Hopefully someone can help to shed some light.
Derek Melchin
Hi Katama,
We were unable to reproduce the issue. Please ensure the data downloaded from the Data Explorer was from Oanda and not FXCM. Alternatively, consider trying download the data using the CLI. Refer to the documentation here.
Best,
Derek Melchin
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.
Katama
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!