Juless89 / tutorials-websockets

36 stars 22 forks source link

To Enable the List Deletion #1

Open stephencostiniano opened 4 years ago

stephencostiniano commented 4 years ago

@Juless89 Hello you forgot to include [x] in your delete condition when qty is 0

# loop through orderbook side
        for x in range(0, len(self.orderbook[side])):
            if price == self.orderbook[side][x][0]:
                # when qty is 0 remove from orderbook, else
                # update values
                if qty == 0:
                    del self.orderbook[side]
                    break
                else:
                    self.orderbook[side][x] = update
                    break

I learned how to use websocket thru this tutorial thank you so much