Exemplo n.º 1
0
 def loadNewTradeData(self, exchange, market):
     self.ed_exchange.setText(exchange.title())
     self.ed_market.setText(market.upper())
     self.m = Markets.get_symbol_by_exchange(self.ed_market.text(),
                                             self.ed_exchange.text())
     self.spin_price.setValue(self.m.last_price)
     self.spin_price.setSingleStep(self.m.last_price * 0.01)
Exemplo n.º 2
0
 def checkTablesExists(self):
     """ Returns True if all tables exists """
     if not Markets.table_exists():
         return False
     if not Trades.table_exists():
         return False
     return True
Exemplo n.º 3
0
 def onSelectInitialExchange(self):
     """ Load initial markets of selected initial exchange """
     self.combo_initial_market.clear()
     for it in Markets.get_all_by_exchange(
             self.combo_initial_exchange.currentText().lower()):
         self.combo_initial_market.addItem(it.symbol)
     index = self.combo_initial_market.findText(
         self.config['initial_market'])
     self.combo_initial_market.setCurrentIndex(index)
Exemplo n.º 4
0
 def _one_exchange(self):
     markets = self._get_markets_by_exchange()
     prices = self._get_tickers_by_exchange()
     for symbol in markets:
         item, created = Markets.get_or_create(exchange=self.exchange,
                                               symbol=symbol)
         if created:
             item.save()
         item.update_data(markets[symbol])
         item.update_prices(prices[symbol])
         item.save()
Exemplo n.º 5
0
 def run(self):
     logging.info(f"Updating markets of {self.exchange.title()}")
     markets = self._get_markets_by_exchange()
     # tickers = self._get_tickers_by_exchange()
     for symbol in markets:
         item, created = Markets.get_or_create(exchange=self.exchange,
                                               symbol=symbol)
         if created:
             item.save()
         item.update_data(markets[symbol])
     self.onFinished.emit()
Exemplo n.º 6
0
 def _load_markets(self):
     self.combo_exchange.setDisabled(True)
     filtro = self.edit_filtro.text()
     self.list_markets.clear()
     for i, item in enumerate(
             Markets.get_all_by_exchange(self.selected_exchange)):
         if i % 20 == 0:
             QtCore.QCoreApplication.processEvents()
         nuevo = CustomItem(self.list_markets)
         nuevo.configurar(item.symbol, self.selected_exchange)
         nuevo.mostrar(self.lista_mode, filtro)
     self.combo_exchange.setEnabled(True)
Exemplo n.º 7
0
 def is_margin(self):
     return Markets.check_symbol_is_margin(self.symbol, self.exchange)
Exemplo n.º 8
0
 def is_favorite(self):
     return Markets.check_symbol_is_fav(self.symbol, self.exchange)
Exemplo n.º 9
0
 def toggle_favorite(self):
     item = Markets.get_symbol_by_exchange(self.text(), self.exchange)
     item.toggle_fav()
     self.setIcon(self._get_icon())