Here is what I am trying to do.

I create an insight

  • Symbol: IEF, Direction: Up, Duration: 100000 days, Magnitude: 1.

This means I want to hold 100% of IEF. In the portfolio, I overrid the function DetermineTargetPercent().

  • The percentage returned is 100% for IEF. I then use ImmediateExecutionModel().

The result of orders I get are:

  • IEF, Buy Market on Open, ......, Quantity: 1906, Filled
  • IEF, Buy Market on Open, ......, Quantity: 15, Filled

Question:

My question is that I have 1 insight, but there are 2 orders executed. Why is it? and how to reduce it?

-------------------------------------------------------------------------------------------------------------

After the first insight, here comes my second insight

  • Symbol: IEF, Direction: Flat, Duration: 100000 days, Magnitude: 0.5.

This means I want to hold 50% of IEF. From the portfolio, function DetermineTargetPercent().

  • I assign 50% for IEF

The result of orders I get are:

  • IEF, Sell Market on Open, ......, Quantity: -1921, Filled
  • IEF, Buy Market, ......, Quantity: 962, Filled

Question:

Again there are 2 orders.

-------------------------------------------------------------------------------------------------------------For the rest of the backtest, there are many orders like this:

  • 2003-05-14 14:00, IEF, Sell Market, ......, Quantity: -1, Filled
  • 2003-05-14 16:00, IEF, Sell Market, ......, Quantity: -1, Filled
  • ......

Seems that the portfolio and execution module will be called when data is updated. I have data updated in every hour. 

Question:

If I want to call portfolio and execution for the rebalance process only when I have insights updated, what can I do? Thank you very much.

Author