Esempio n. 1
0
    def __parse_data(self, book):
        '''
        Parses the incoming data from gox,
        converts money values to our internal
        money format
        '''
        data_in = self._get_data_from_book(book)
        data_out = []

        total = 0
        count = 1
        vwap = 0
        vsize = 0
        for x in data_in:

            price = x.price
            size = x.volume

            vsize += size
            vwap += price * size

            total += size
            if vsize > utilities.float2internal(self.GROUP_ORDERS):
                vwap = utilities.gox2internal(vwap / vsize, 'USD')
                vsize = utilities.gox2internal(vsize, 'BTC')
                total = utilities.gox2internal(total, 'BTC')
                data_out.append([vwap, vsize, total])
                count = 1
                vwap = 0
                vsize = 0
            else:
                count += 1

        return data_out
Esempio n. 2
0
    def __parse_data(self, book):
        '''
        Parses the incoming data from gox,
        converts money values to our internal money format.
        '''
        data_out = []
        count = 1
        total = 0
        vwap = 0
        vsize = 0
        group_size = utilities.float2internal(self.preferences.GROUP_ORDERS)
        for x in book:

            vsize += x.volume
            vwap += x.price * x.volume
            total += x.volume
            
            if vsize > group_size:
                vwap = vwap / vsize
                data_out.append([vwap, vsize, total])
                count = 1
                vwap = 0
                vsize = 0
            else:
                count += 1

        return data_out
Esempio n. 3
0
    def __parse_data(self, book):
        '''
        Parses the incoming data from gox,
        converts money values to our internal money format.
        '''
        data_in = self._get_data_from_book(book)
        data_out = []

        total = 0
        count = 1
        vwap = 0
        vsize = 0
        for x in data_in:

            price = x.price
            size = x.volume

            vsize += size
            vwap += price * size

            total += size
            if vsize > utilities.float2internal(self.GROUP_ORDERS):
                vwap = utilities.gox2internal(vwap / vsize, 'USD')
                vsize = utilities.gox2internal(vsize, 'BTC')
                total = utilities.gox2internal(total, 'BTC')
                data_out.append([vwap, vsize, total])
                count = 1
                vwap = 0
                vsize = 0
            else:
                count += 1

        return data_out
Esempio n. 4
0
 def get_trade_total(self):
     value = self.mainWindow.doubleSpinBoxTotal.value()
     return utilities.float2internal(value)
Esempio n. 5
0
 def get_trade_price(self):
     value = self.mainWindow.doubleSpinBoxPrice.value()
     return utilities.float2internal(value)
Esempio n. 6
0
File: view.py Progetto: benz1/goxgui
 def get_trade_size(self):
     value = self.ui.doubleSpinBoxBtc.value()
     return utilities.float2internal(value)
Esempio n. 7
0
 def get_trade_total(self):
     value = self.mainWindow.doubleSpinBoxTotal.value()
     return utilities.float2internal(value)
Esempio n. 8
0
 def get_trade_price(self):
     value = self.mainWindow.doubleSpinBoxPrice.value()
     return utilities.float2internal(value)