a89aaff3cdcfb2c992ce18e8a0bdc6d95c6bd2e6,bt/core.py,StrategyBase,positions,#StrategyBase#,405

Before Change


        if self.root.stale:
            self.root.update(self.root.now, None)

        vals = pd.DataFrame({x.name: x.positions for x in self.members
                             if isinstance(x, SecurityBase)})
        self._positions = vals
        return vals

    def setup(self, universe):

After Change


            self.root.update(self.root.now, None)

        vals = pd.DataFrame()
        for x in self.members:
            if isinstance(x, SecurityBase):
                vals[x.name] = x.positions + (vals[x.name] if x.name in vals.columns else 0)

        self._positions = vals
        return vals

    def setup(self, universe):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 12

Instances


Project Name: pmorissette/bt
Commit Name: a89aaff3cdcfb2c992ce18e8a0bdc6d95c6bd2e6
Time: 2019-11-11
Author: extedmail@gmail.com
File Name: bt/core.py
Class Name: StrategyBase
Method Name: positions


Project Name: pmorissette/bt
Commit Name: 01cd6dab06e42a63a4240cd57eef9331179cf091
Time: 2014-05-06
Author: pm@rdacap.com
File Name: bt/backtest.py
Class Name: Backtest
Method Name: security_weights


Project Name: has2k1/plotnine
Commit Name: 329dfcea129f72eb3ea741dfc343d4c28c513c69
Time: 2014-02-06
Author: jasc@gmx.net
File Name: ggplot/ggplot.py
Class Name: ggplot
Method Name: _get_layers