Back to Community
Assigning Max-Notional to value of Total Cash in portfolio?

Is there any way we can assign the max notional to the total amount of cash in the portfolio so if we were to gain
for example 2K from 10K, the algorithm would use all 12K as opposed to the same 10K
I have attempted to do this but it does not seem to work:
''' context.max_notional = context.portfolio.cash-1001 ''' Theres must be a proper way to do this, Thanks

4 responses

The max_notional variable is used to track your stock positions + cash. If you only want to use the available cash to buy securities, then you can do a check in your ordering logic.

For example, before ordering, you can see if your portfolio cash is greater than the value of stock you're planning to buy.

Disclaimer

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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.

Isn't max notional a threshold for how much money the program is allowed to spend? I want the threshold to equal the cash in the portfolio.

There can be several different ways to implement this trading guard, but it would depend on your algo strategy. Can you want to invite me to your algo via collab and I can help you code it up?

You can press the "collaborate" button in the top right-hand corner of the IDE and my email is [email protected]. Then I'll take a look!

Hey Alisa thanks! I added you as a collaborator. All im trying to do is get the total cash included in the max notional, so the program knows to use all the money it made thus far.