I'm running Lean / Python.
I am attempting to use kraken data that I downloaded using the kraken downloader in the toolbox. I copied the data to Data/crypto/tick/XXBTCUSD, and the files are called: 20150924_trade.zip, etc., as saved by the toolbox downloader.
I then attempted to load a basic Framework algorithm, using the below code to try to load the downloaded data. I have verified that zip files exist for the dates I'm trying to load. When I try to run the code, I get the error message also pasted below.
I found this page: https://www.quantconnect.com/lean/documentation/topic16.html in the docs, and am trying to do the "easy" method, but have not yet been successful.
Any ideas are greatly appreciated! I am just looking for a generic way to load in custom data sources. I don't really care if Lean thinks they are crypto or not. I've also tried using just AddData(), but haven't had success there either. I can get my data into Lean's format pretty easily. I am trying to just get a basic "hello world" up and running using the "easy method" from the documentation link.
Error message:
20190226 11:06:53.450 ERROR:: During the algorithm initialization, the following exception has occurred: ArgumentException : Cash symbols must be exactly 3 characters.
at QuantConnect.Securities.Cash..ctor (System.String symbol, System.Decimal amount, System.Decimal conversionRate) [0x0002a] in <4920266245464466a15039b63fc250d3>:0
at QuantConnect.Securities.CashBook.Add (System.String symbol, System.Decimal quantity, System.Decimal conversionRate) [0x00001] in <4920266245464466a15039b63fc250d3>:0
at QuantConnect.Securities.SecurityService.CreateSecurity (QuantConnect.Symbol symbol, System.Collections.Generic.List`1[T] subscriptionDataConfigList, System.Decimal leverage, System.Boolean addToSymbolCache) [0x000ea] in <4920266245464466a15039b63fc250d3>:0
at QuantConnect.Securities.SecurityManager.CreateSecurity (QuantConnect.Symbol symbol, System.Collections.Generic.List`1[T] subscriptionDataConfigList, System.Decimal leverage, System.Boolean addToSymbolCache) [0x00001] in <4920266245464466a15039b63fc250d3>:0
at QuantConnect.Algorithm.QCAlgorithm.AddSecurity[T] (QuantConnect.SecurityType securityType, System.String ticker, QuantConnect.Resolution resolution, System.String market, System.Boolean fillDataForward, System.Decimal leverage, System.Boolean extendedMarketHours) [0x0007e] in <f62450a3825f4f73917828e0bc058624>:0
at QuantConnect.Algorithm.QCAlgorithm.AddCrypto (System.String ticker, QuantConnect.Resolution resolution, System.String market, System.Boolean fillDataForward, System.Decimal leverage) [0x00001] in <f62450a3825f4f73917828e0bc058624>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0003b] in <04750267503a43e5929c1d1ba19daf3e>:0
at Initialize in KrakenHelloWorld.py:line 64
ArgumentException : Cash symbols must be exactly 3 characters.
at QuantConnect.Securities.Cash..ctor (System.String symbol, System.Decimal amount, System.Decimal conversionRate) [0x0002a] in <4920266245464466a15039b63fc250d3>:0
at QuantConnect.Securities.CashBook.Add (System.String symbol, System.Decimal quantity, System.Decimal conversionRate) [0x00001] in <4920266245464466a15039b63fc250d3>:0
at QuantConnect.Securities.SecurityService.CreateSecurity (QuantConnect.Symbol symbol, System.Collections.Generic.List`1[T] subscriptionDataConfigList, System.Decimal leverage, System.Boolean addToSymbolCache) [0x000ea] in <4920266245464466a15039b63fc250d3>:0
at QuantConnect.Securities.SecurityManager.CreateSecurity (QuantConnect.Symbol symbol, System.Collections.Generic.List`1[T] subscriptionDataConfigList, System.Decimal leverage, System.Boolean addToSymbolCache) [0x00001] in <4920266245464466a15039b63fc250d3>:0
at QuantConnect.Algorithm.QCAlgorithm.AddSecurity[T] (QuantConnect.SecurityType securityType, System.String ticker, QuantConnect.Resolution resolution, System.String market, System.Boolean fillDataForward, System.Decimal leverage, System.Boolean extendedMarketHours) [0x0007e] in <f62450a3825f4f73917828e0bc058624>:0
at QuantConnect.Algorithm.QCAlgorithm.AddCrypto (System.String ticker, QuantConnect.Resolution resolution, System.String market, System.Boolean fillDataForward, System.Decimal leverage) [0x00001] in <f62450a3825f4f73917828e0bc058624>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0003b] in <04750267503a43e5929c1d1ba19daf3e>:0
Code:
from clr import AddReference
AddReference("System")
AddReference("QuantConnect.Algorithm")
AddReference("QuantConnect.Algorithm.Framework")
AddReference("QuantConnect.Common")
from System import *
from Alphas.ConstantAlphaModel import ConstantAlphaModel
from QuantConnect import *
from QuantConnect.Algorithm import *
from QuantConnect.Brokerages import *
from QuantConnect.Orders import *
from QuantConnect.Algorithm.Framework import *
from QuantConnect.Algorithm.Framework.Selection import *
from QuantConnect.Algorithm.Framework.Portfolio import *
from Execution.ImmediateExecutionModel import ImmediateExecutionModel
from Risk.NullRiskManagementModel import NullRiskManagementModel
from Selection.OptionUniverseSelectionModel import OptionUniverseSelectionModel
from Risk.NullRiskManagementModel import NullRiskManagementModel
from QuantConnect.Algorithm.Framework.Alphas import *
from datetime import date, timedelta
import numpy as np
class HelloWorldKraken(QCAlgorithmFramework):
'''Basic template algorithm simply initializes the date range'''
def Initialize(self):
'''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
self.SetStartDate(2019,2,10) #Set Start Date
self.SetEndDate(2019,2,15) #Set End Date
self.SetBrokerageModel(BrokerageName.Default, AccountType.Margin)
symbols = [self.AddCrypto('XXBTCUSD', Resolution.Tick).Symbol]
self.SetUniverseSelection( ManualUniverseSelectionModel(symbols) )
self.SetAlpha(RsiAlphaModel(20, Resolution.Hour))
self.SetPortfolioConstruction(NullPortfolioConstructionModel())
self.SetExecution(ImmediateExecutionModel())
def OnData(self, data):
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
Arguments:
data: Slice object keyed by symbol containing the stock data
'''
pass
Alphahunter
Bump -- I'm still stuck on this, and it's a blocker for me :/ I would really appreciate any ideas that anyone has!
Jared Broad
If you've put the data on disk like that and named /formatted it in quotebar/tradebar format you don't need to use Custom data -- LEAN can import it as full real data!
However, there are a few steps remaining before we can fully support Kraken properly. I don't think it's possible to enumerate them here but to start using the right market value when using `AddCryto(.... Market.Kraken)`
We don't support generic base currencies yet so long form tickers like that won't work. It is coming! Lots of smart people are working on it =), for now, you could probably use short pairs e.g. BTCUSD easily.
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.
Alphahunter
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!