Buy a percentage

I'm new to this platform. I'm trying to start off with a simple strategy to hold a basket of etfs. I'd like to buy a fix percentage of the money rather than a fixed quantity of shares. Is there a way to do that? I'd like to rebalance on trading open every day/month

Comments

  • ptunneyptunney Posts: 246

    I believe this demo script does something like what you are asking. But that is classed as an advanced script so do not be too put off if you do not understand it right away. A video accompanies this demo script.

  • aq698026aq698026 Posts: 6

    Thanks. I'll take a look at it.

  • aq698026aq698026 Posts: 6

    I'm trying to figure out how to get the amount allocated for the algorithm. In the above demo script, I see this:
    cls.capital_long_sum = 0
    cls.capital_short_sum = 0

    However, when I submit the algorithm for funding, I'll have to retrieve the amount that was allocated. Also for the backtesting, I'll have to do that also. Any ideas on how I can get the amount that was allocated for funding or amount used for backtesting?

  • ptunneyptunney Posts: 246

    If you are talking about the number that you put in for Buying Power when you submit the backtest using NEW TEST then that is the variable account.buying_power.
    Otherwise I assume you are just wanting to get an output of the amount allocated, you could just print your cls.captital_long_sum and short in on_strategy_finish and it would be output to the console at the end of each day.
    When you say "submit the algorithm for funding", do you mean to us using the "FUND MY STRATEGY" button. If that is the case then do not worry too much about that, almost all of the information we need to make a decision is submitted automatically (from the scorecard of your backtest) when you press that button.

Sign In or Register to comment.