QUANTCONNECT COMMUNITY
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.
Elinaldo Amorim
How to do cashier control? I want to know how much goes in and out in my algorithm.Â
In my algorithm appears an error related to purchasing power, I wanted to know how to control the cash to avoid these errors. ÂAlexandre Catarino
Hi Elinaldo Amorim ,
Could you please open a new thread with an attached algorithm (a simplified version of what you are doing)? We can give you the right directions to solve the buying power issue with that information in hands.
Elinaldo Amorim
class LiquidUniverseSelection(QCAlgorithm): changes = None filteredByPrice = None def Initialize(self): self.SetStartDate(2018, 1, 11) self.SetEndDate(2019, 11, 13) self.SetCash(100000) self.AddUniverse(self.CoarseSelectionFilter) self.UniverseSettings.Resolution = Resolution.Daily self.SetBenchmark("SPY") #self.CoarseSelectionFilter.SetDataNormalizationMode(DataNormalizationMode.Raw) def CoarseSelectionFilter(self, coarse): sortedByDollarVolume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True) filtered = [ x.Symbol for x in sortedByDollarVolume if x.Price > 0 and x.DollarVolume > 100000 ] return filtered[:500] def OnSecuritiesChanged(self, changes): self.changes = changes self.Log(f"OnSecuritiesChanged({self.Time}):: {changes}") for security in self.changes.RemovedSecurities: if security.Invested: self.Liquidate(security.Symbol) for security in self.changes.AddedSecurities: if not security.Invested: self.SetHoldings(security.Symbol, 0.1)
I want to know how much money I still have after selling or buying an asset. Which could the method use?
Alexandre Catarino
Hi Elinaldo Amorim ,
The algorithm is placing orders using SetHoldings with a target of 10% per security.
Since the algorithm is selecting 500 securities, it should have roughly a target of 1/500.
For further details, please check out the docs, under Trading and Orders.
QuantConnect Robot
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!