Exemplo 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
Exemplo n.º 2
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
Exemplo n.º 3
0
    def display_userorder(self, price, size, order_type, oid, status):

        size = utilities.gox2internal(size, 'BTC')
        price = utilities.gox2internal(price, 'USD')

        size = utilities.internal2str(size)
        price = utilities.internal2str(price)

        if order_type == '':
            self.status_message("Order <a href=\"{0}\">{0}</a> {1}.".format(
                oid, status))
            if status == 'removed' and self.get_order_id() == oid:
                self.set_order_id('')
        else:
            self.status_message("{0} size: {1}, price: {2}, oid: <a href=\"{3}\">{3}</a> - {4}".format(# @IgnorePep8
                str.upper(str(order_type)), size, price, oid, status))
            if status == 'post-pending':
                self.set_order_id(oid)
Exemplo n.º 4
0
    def display_userorder(self, price, size, order_type, oid, status):

        size = utilities.gox2internal(size, 'BTC')
        price = utilities.gox2internal(price, 'USD')

        size = utilities.internal2str(size)
        price = utilities.internal2str(price)

        if order_type == '':
            self.status_message("Order <a href=\"{0}\">{0}</a> {1}.".format(
                oid, status))
            if status == 'removed' and self.get_order_id() == oid:
                self.set_order_id('')
        else:
            self.status_message(
                "{0} size: {1}, price: {2}, oid: <a href=\"{3}\">{3}</a> - {4}"
                .format(  # @IgnorePep8
                    str.upper(str(order_type)), size, price, oid, status))
            if status == 'post-pending':
                self.set_order_id(oid)
Exemplo n.º 5
0
 def set_trade_total_from_wallet(self):
     self.set_trade_total(
         utilities.gox2internal(self.gox.wallet['USD'], 'USD'))
     self.set_selected_trade_type('BUY')
Exemplo n.º 6
0
 def set_trade_size_from_wallet(self):
     self.set_trade_size(
         utilities.gox2internal(self.gox.wallet['BTC'], 'BTC'))
     self.set_selected_trade_type('SELL')
Exemplo n.º 7
0
 def display_wallet(self):
     self.set_wallet_usd(
         utilities.gox2internal(self.gox.wallet['USD'], 'USD'))
     self.set_wallet_btc(
         utilities.gox2internal(self.gox.wallet['BTC'], 'BTC'))
Exemplo n.º 8
0
Arquivo: view.py Projeto: benz1/goxgui
 def set_trade_total_from_wallet(self):
     self.set_trade_total(
         utilities.gox2internal(self.market.get_balance('USD'), 'USD'))
     self.set_selected_trade_type('BUY')
Exemplo n.º 9
0
Arquivo: view.py Projeto: benz1/goxgui
 def set_trade_size_from_wallet(self):
     self.set_trade_size(
         utilities.gox2internal(self.market.get_balance('BTC'), 'BTC'))
     self.set_selected_trade_type('SELL')
Exemplo n.º 10
0
Arquivo: view.py Projeto: benz1/goxgui
    def display_wallet(self):

        self.set_wallet_usd(
            utilities.gox2internal(self.market.get_balance('USD'), 'USD'))
        self.set_wallet_btc(
            utilities.gox2internal(self.market.get_balance('BTC'), 'BTC'))
Exemplo n.º 11
0
 def set_trade_total_from_wallet(self):
     self.set_trade_total(
         utilities.gox2internal(self.gox.wallet['USD'], 'USD'))
     self.set_selected_trade_type('BUY')
Exemplo n.º 12
0
 def set_trade_size_from_wallet(self):
     self.set_trade_size(
         utilities.gox2internal(self.gox.wallet['BTC'], 'BTC'))
     self.set_selected_trade_type('SELL')
Exemplo n.º 13
0
 def display_wallet(self):
     self.set_wallet_usd(
         utilities.gox2internal(self.gox.wallet['USD'], 'USD'))
     self.set_wallet_btc(
         utilities.gox2internal(self.gox.wallet['BTC'], 'BTC'))