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.
Dean van Doorn
Any chance that you figured it out? I have the same issue.
Jared Broad
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.Â
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.
Ramesh Lex
This problem still persists on Coinbase Pro/GDAX. Getting the following error "During the algorithm initialization, the following exception has occurred: System.ArgumentException: In order to maintain cash in USDC you are required to add a subscription for Forex pair USDCUSD or USDUSDC".
Derek's response is a solution for Bitfinex. Even with basic pair of BTCUSD fails to deploy on GDAX. Anyone resolved this for GDAX? Thanks
Derek Melchin
Hi Ramesh,
This error is thrown because we don't have USDCUSD for Coinbase Pro in the Symbol Properties Data Base. Setting the account current to BTC may solve the problem.
self.SetAccountCurrency('BTC')
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.
Jason Parks
The
Alpha Strategy - Bitcoin Momentum and Mean Reversion Algorithm
GDAXBrokerag
does not work because of this error. Does this mean people only run this strategty at Bitfinex? If so, that should be specified in the product.
Derek Melchin
Hi Jason,
We've created a GitHub Issue to have the problem resolved. Subscribe to our progress 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.
Michael P
Hey team. Any updates on resolving this issue? I'm seeing it as well and it's preventing me from launching my algo live.Â
Thanks!!
Michael P
BTW I found a workaround. Maybe this is more specific to my sitiuation. I had a very small amount of USDC on coinbase, less that .01 coins (which is it too small to covert to USD). Qunantconnect was seeing the USDC holdings on startup and crashing. I transfered the USDC from Coinbase Pro to Coinbase. Algo now starts. Basically zeroing out the balances of coins causing issues should get your past this crash.
Derek Melchin
Hi Michael,
We don't have an update on the issue yet, but we will inform the community when we do. Thanks for providing a temporary workaround for now.
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.
Jason Parks
I had same issue, minut amount of USDC in my portfolio, I couldn't transfer it to Coinbase regular. But I made a separate portfolio and moved my USD over to that and created an API key with the second Portfolio and the Algo could run.
Michael P
Good to know. Very interesting find. Does this mean you could run multiple algos on Coinbase using seperate portfolios?Â
Derek Melchin
Hi Michael,
Yes, we can run multiple algorithms on a single Coinbase account if we have separate portfolios. Each portfolio on Coinbase has its own set of API credentials that we can provide to LEAN when deploying to live trading.
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.
BestOnionTrader123
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!