Back

Can't add Forex for Crypto with four-letter currency code.

I am unable to add a forex pair for crypto pairs that require it. I believe this issue is linked to this issue.

Here's the code:

class UncoupledCalibratedAntennaArray(QCAlgorithm):

def Initialize(self):
self.SetStartDate(2020, 1, 1) # Set Start Date
self.SetEndDate(2020,1,7)
self.SetCash(100000) # Set Strategy Cash

self.get_tradeable_symbols_manually()


def get_tradeable_symbols_manually(self):
'''Get some pairs

'''
self.AddForex('BATUSD', Resolution.Minute)
# self.AddForex('USDUSDC', Resolution.Minute) # throws Exception
self.AddForex('USDCUSD', Resolution.Minute) # throws exception
self.AddCrypto('BATUSDC', Resolution.Minute, Market.GDAX)

Here's the output:

Algorithm.Initialize() Error: In order to maintain cash in CUSD you are required to add a subscription for Forex pair CUSDUSD or USDCUSD Stack Trace: System.ArgumentException: In order to maintain cash in CUSD you are required to add a subscription for Forex pair CUSDUSD or USDCUSD
at QuantConnect.Securities.Cash.EnsureCurrencyDataFeed (QuantConnect.Securities.SecurityManager securities, QuantConnect.Data.SubscriptionManager subscriptions, System.Collections.Generic.IReadOnlyDictionary`2[TKey,TValue] marketMap, QuantConnect.Data.UniverseSelection.SecurityChanges changes, QuantConnect.Interfaces.ISecurityService securityService, System.String accountCurrency) [0x00401] in :0
at QuantConnect.Securities.CashBook.EnsureCurrencyDataFeeds (QuantConnect.Securities.SecurityManager securities, QuantConnect.Data.SubscriptionManager subscriptions, System.Collections.Generic.IReadOnlyDictionary`2[TKey,TValue] marketMap, QuantConnect.Data.UniverseSelection.SecurityChanges changes, QuantConnect.Interfaces.ISecurityService securityService) [0x0002f] in :0
at QuantConnect.Lean.Engine.DataFeeds.CurrencySubscriptionDataConfigManager.EnsureCurrencySubscriptionDataConfigs (QuantConnect.Data.UniverseSelection.SecurityChanges securityChanges, QuantConnect.Brokerages.IBrokerageModel brokerageModel) [0x00044] in <66597da26e9342f89a69ea5d680b49ec>:0
at QuantConnect.Lean.Engine.DataFeeds.UniverseSelection.EnsureCurrencyDataFeeds (QuantConnect.Data.UniverseSelection.SecurityChanges securityChanges) [0x00012] in <66597da26e9342f89a69ea5d680b49ec>:0
at QuantConnect.Lean.Engine.Setup.BaseSetupHandler.SetupCurrencyConversions (QuantConnect.Interfaces.IAlgorithm algorithm, QuantConnect.Lean.Engine.DataFeeds.UniverseSelection universeSelection) [0x00006] in <66597da26e9342f89a69ea5d680b49ec>:0
at QuantConnect.Lean.Engine.Setup.BacktestingSetupHandler.Setup (QuantConnect.Lean.Engine.Setup.SetupHandlerParameters parameters) [0x0023e] in <66597da26e9342f89a69ea5d680b49ec>:0
at QuantConnect.Lean.Engine.Engine.Run (QuantConnect.Packets.AlgorithmNodePacket job, QuantConnect.Lean.Engine.AlgorithmManager manager, System.String assemblyPath, QuantConnect.Util.WorkerThread workerThread) [0x0051d] in <66597da26e9342f89a69ea5d680b49ec>:0

I believe the problem is the four letter currency code for USDC. Or I could just be doing this wrong. Thoughts anyone? Note I am in the US, so I can't just use Bitfinex.

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.


Any chance that you figured it out? I have the same issue.

0

Hello Dean, it is not an issue but not a supported pair. Please see Derek's reply and the right way to add the pair. 

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.


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