Fix starting capital for non usd cash

- Moving `UniverseSelection.EnsureCurrencyDataFeeds` call into the
`IResultHandler` implementation through usage of the new `SetupHandlerHelper`
class, that will also set an initial conversion rate if none present.
- Adding regression test, that reproduces original issue
This commit is contained in:
Martin Molinero
2018-12-11 18:48:10 -03:00
parent 541b4e3a00
commit af8e6bf85c
18 changed files with 270 additions and 51 deletions
@@ -45,16 +45,13 @@ class BasicTemplateCryptoAlgorithm(QCAlgorithm):
# Set Strategy Cash (EUR)
# EUR/USD conversion rate will be updated dynamically
self.SetCash("EUR", 10000, 1.23)
self.SetCash("EUR", 10000)
# Add some coins as initial holdings
# When connected to a real brokerage, the amount specified in SetCash
# will be replaced with the amount in your actual account.
self.SetCash("BTC", 1, 7300)
self.SetCash("ETH", 5, 400)
# Note: the conversion rates above are required in backtesting (for now) because of this issue:
# https://github.com/QuantConnect/Lean/issues/1859
self.SetCash("BTC", 1)
self.SetCash("ETH", 5)
self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)