raulikeda / Backtesting

GNU General Public License v3.0
1 stars 10 forks source link

Adiciona Order id no método fill() #22

Closed LiuSeeker closed 4 years ago

LiuSeeker commented 4 years ago

O método fill da classe Strategy recebe o Order.id como primeiro argumento

fill(self, id, instrument, price, quantity, status)

Com essa mudança, foi preciso adicionar esse argumento em todas as chamadas deste método. No caso, apenas na definição do método fill arquivo tradingsystem.py

def fill(self, id, price, quantity, status):

        if id in self.orders:

            order = self.orders[id]
            instrument = order.instrument
            owner = order.owner

            if instrument in self.position:
                if owner in self.position[instrument]:
                    self.position[instrument][owner] += quantity

            if owner in self.strategies:
                strategy = self.strategies[owner]
                strategy.fill(id, instrument, price, quantity, status) #MUDANÇA FEITA