def _load_markets(self): filtro = self.edit_filtro.text() self.list_markets.clear() for it in Markets.get_all_by_exchange(self.selected_exchange): nuevo = CustomItem(self.list_markets) nuevo.configurar(it.symbol, self.selected_exchange) nuevo.mostrar(self.lista_mode, filtro)
def onSelectInitialExchange(self): 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)
def _update_exchange(self): 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]) if symbol in tickers: item.update_prices(tickers[symbol]) item.save()
def toggle_favorite(self): item = Markets.get_symbol_by_exchange(self.text(), self.exchange) item.toggle_fav() self.setIcon(self._get_icon())
def is_margin(self): return Markets.check_symbol_is_margin(self.symbol, self.exchange)
def is_favorite(self): return Markets.check_symbol_is_fav(self.symbol, self.exchange)
def new_alarm(self, exchange, market): self.setWindowTitle(qapp.tr("Nueva alarma")) itemdb = Markets.get_symbol_by_exchange(market, exchange) self.alarm = Alarms(market=itemdb, description=market) self._load_info() self.spin_price.setValue(float(self.ed_currentPrice.text()))