All of my moonshot dev tells me there are 16 signals, weights, positions.
But, when I debug order_stubs_to_orders
it says there are only 10 orders.
prices_to_signals()
- 16
print("Number of signals in signals df:")
signals.tail(1).sum(axis=1)
>> 2021-06-02 16
signals_to_target_weights()
- 16
target_weights = self.allocate_equal_weights(signals)
print("Number of of nonzero cols in target_weights df:")
print(target_weights.tail(1).astype(bool).sum(axis=1))
>> 2021-06-02 16
target_weights_to_positions()
- 16
print("Number of of nonzero cols in positions df:")
print(positions.tail(1).astype(bool).sum(axis=1))
>> 2021-06-02 16
order_stubs_to_orders()
- 10
from codeload.moonshot.MyStrategy import MyStrategy
self = MyStrategy()
prices = self.get_prices(start_date='2021-01-01', end_date='2021-06-02')
allocations = {XXXX: 1.0}
orders = self.trade(allocations, review_date='2021-06-02')
print(orders.shape)
>> (10, 9)
Seems like something is off inside self.trade() in base.py because if I use my global scope target_weights in the same notebook and run:
print(self._weights_to_today_weights(target_weights, prices))
I get a list of 16 positions with 0.0625/position.