def sell(self, price, size): ''' Places sell order ''' sizeGox = utilities.internal2gox(size, 'BTC') priceGox = utilities.internal2gox(price, 'USD') self.gox.sell(priceGox, sizeGox)
def buy(self, price, size): ''' Places buy order ''' sizeGox = utilities.internal2gox(size, 'BTC') priceGox = utilities.internal2gox(price, 'USD') self.gox.buy(priceGox, sizeGox)
def execute_trade(self): trade_type = self.get_selected_trade_type() size = self.get_trade_size() price = self.get_trade_price() total = self.get_trade_total() trade_name = 'BID' if trade_type == 'BUY' else 'ASK' self.status_message('Placing order: {0} {1} BTC at {2} USD (total {3} USD)...'.format(# @IgnorePep8 trade_name, utilities.internal2str(size), utilities.internal2str(price, 5), utilities.internal2str(total, 5))) sizeGox = utilities.internal2gox(size, 'BTC') priceGox = utilities.internal2gox(price, 'USD') if trade_type == 'BUY': self.gox.buy(priceGox, sizeGox) else: self.gox.sell(priceGox, sizeGox)
def execute_trade(self): trade_type = self.get_selected_trade_type() size = self.get_trade_size() price = self.get_trade_price() total = self.get_trade_total() trade_name = 'BID' if trade_type == 'BUY' else 'ASK' self.status_message( 'Placing order: {0} {1} BTC at {2} USD (total {3} USD)...'. format( # @IgnorePep8 trade_name, utilities.internal2str(size), utilities.internal2str(price, 5), utilities.internal2str(total, 5))) sizeGox = utilities.internal2gox(size, 'BTC') priceGox = utilities.internal2gox(price, 'USD') if trade_type == 'BUY': self.gox.buy(priceGox, sizeGox) else: self.gox.sell(priceGox, sizeGox)