Fetch company info
    >>> lookup_symbol("Apple Inc.")
          {u'exch': u'NMS',
           u'market': u'NASDAQ',
           u'name': u'Apple Inc.',
           u'symbol': u'AAPL',
           u'type': u'Equity'}
964730
def lookup_symbol(company):
    ''' 
    '''
    request = requests.get(FINANCE_URLS['info_lookup'].format(company))
    return json.loads(request.text[39:-1])["ResultSet"]["Result"] \
        if request.ok else {'error': request.reason}
1331636
def get_company_info(self):
        

        method, url = get_URL('company_get')

        payload = {
            'apikey': self.config.get('apikey'),
            'logintoken': self.session.cookies.get('logintoken')
            }

        res = getattr(self.session, method)(url, params=payload)

        if res.status_code == 200:
            return res.json()['company']

        hellraiser(res)
1367875
def get_currencysymbol(self, code):
        """"""
        if not self._symbols:
            symbolpath = os.path.join(self._dir, 'currencies.json')
            with open(symbolpath, encoding='utf8') as df:
                self._symbols = json.load(df)
        return self._symbols.get(code)
119238
def get_sector(symbol):
    '''
    
    '''
    url = 'http://finance.yahoo.com/q/pr?s=%s+Profile' % symbol
    soup = BeautifulSoup(urlopen(url).read())
    try:
        sector = soup.find('td', text='Sector:').\
            find_next_sibling().string.encode('utf-8')
    except:
        sector = ''
    return sector
576243
def check_registered_trademark_symbol(text):
    """"""
    err = "typography.symbols.trademark"
    msg = u"(R) is a goofy alphabetic approximation, use the symbol ®."
    regex = "\([rR]\)"

    return existence_check(
        text, [regex], err, msg, max_errors=3, require_padding=False)
1277126
def parseDEI(self,
                 xbrl,
                 ignore_errors=0):
        
        dei_obj = DEI()

        if ignore_errors == 2:
            logging.basicConfig(filename='/tmp/xbrl.log',
                level=logging.ERROR,
                format='%(asctime)s %(levelname)s %(name)s %(message)s')
            logger = logging.getLogger(__name__)
        else:
            logger = None

        trading_symbol = xbrl.find_all(name=re.compile("(dei:tradingsymbol)",
            re.IGNORECASE | re.MULTILINE))
        dei_obj.trading_symbol = \
            self.data_processing(trading_symbol, xbrl,
                                 ignore_errors, logger,
                                 options={'type': 'String',
                                          'no_context': True})

        company_name = xbrl.find_all(name=re.compile("(dei:entityregistrantname)",
            re.IGNORECASE | re.MULTILINE))
        dei_obj.company_name = \
            self.data_processing(company_name, xbrl,
                                 ignore_errors, logger,
                                 options={'type': 'String',
                                          'no_context': True})

        shares_outstanding = xbrl.find_all(name=re.compile("(dei:entitycommonstocksharesoutstanding)",
            re.IGNORECASE | re.MULTILINE))
        dei_obj.shares_outstanding = \
            self.data_processing(shares_outstanding, xbrl,
                                 ignore_errors, logger,
                                 options={'type': 'Number',
                                          'no_context': True})

        public_float = xbrl.find_all(name=re.compile("(dei:entitypublicfloat)",
            re.IGNORECASE | re.MULTILINE))
        dei_obj.public_float = \
            self.data_processing(public_float, xbrl,
                                 ignore_errors, logger,
                                 options={'type': 'Number',
                                          'no_context': True})

        return dei_obj
58950
def get_options_info(self, symbol, items=None, expiration=''):
        
        response = self.select('yahoo.finance.options',items).where(['symbol','=',symbol],[] if not expiration else ['expiration','=',expiration])
        return response
309301
public static String getSymbol(CurrencyUnit cu) {
        try {
            return Waehrung.of(cu).getSymbol();
        } catch (IllegalArgumentException ex) {
            LOG.log(Level.WARNING, "Cannot get symbol for '" + cu + "':", ex);
            return cu.getCurrencyCode();
        }
    }
814235
public float getQuote(String stock_name) throws Exception {
        System.out.print("Getting quote for " + stock_name + ": ");
        Float retval=stocks.get(stock_name);
        if(retval == null) {
            System.out.println("not found");
            throw new Exception("Stock " + stock_name + " not found");
        }
        System.out.println(retval.floatValue());
        return retval;
    }
271736
def get_by_symbol(self, symbol: str) -> Commodity:
        
        # handle namespace. Accept GnuCash and Yahoo-style symbols.
        full_symbol = self.__parse_gc_symbol(symbol)

        query = (
            self.query
            .filter(Commodity.mnemonic == full_symbol["mnemonic"])
        )
        if full_symbol["namespace"]:
            query = query.filter(Commodity.namespace == full_symbol["namespace"])

        return query.first()
804561
def company_prefix(self):
        """"""
        offset = self.EXTRA_DIGITS
        return self._id[offset:self._ref_idx]
980414
function getSymbols() {
    const symbols = {};
    if (hasUnicode()) {
        symbols.check = '✔';
        symbols.cross = '✘';
    } else {
        symbols.check = 'v';
        symbols.cross = 'x';
    }
    return symbols;
}
432764
def __get_stock_row(self, stock: Stock, depth: int) -> str:
        
        assert isinstance(stock, Stock)

        view_model = AssetAllocationViewModel()

        view_model.depth = depth

        # Symbol
        view_model.name = stock.symbol

        # Current allocation
        view_model.curr_allocation = stock.curr_alloc

        # Value in base currency
        view_model.curr_value = stock.value_in_base_currency

        # Value in security's currency.
        view_model.curr_value_own_currency = stock.value
        view_model.own_currency = stock.currency

        return view_model
1145873
function findExistingStock(next) {
      // prepare criteria by _id or fields
      let criteria = _.merge({}, _stock);
      criteria = (
        criteria._id ?
        _.pick(criteria, '_id') :
        _.pick(criteria, 'owner', 'item')
      );
      Stock.findOne(criteria, next);
    }
789535
def find_all(lookup)
      case lookup
      when ::Module
        each_node.grep(lookup)
      when ::Symbol
        each_node.find_all { |n| n.type == lookup }
      when ::String
        each_node.find_all { |n| n.source == lookup }
      when ::Regexp
        each_node.find_all { |n| n.source =~ lookup }
      else
        raise ::TypeError, "Expected class or symbol, got #{lookup.class}: #{lookup.inspect}"
      end
    end
132619
def get_stock(self, symbol: str) -> Commodity:
        """"""

        # Check if we have the exchange name (namespace).
        if ":" in symbol:
            # We have a namespace
            symbol_parts = symbol.split(":")
            exchange = symbol_parts[0]
            symbol = symbol_parts[1]
            security = self.book.get(Commodity, namespace=exchange, mnemonic=symbol)
        else:
            #with database.Database().open_book() as book:
            security = self.book.get(Commodity, mnemonic=symbol)

        return security
1039430
def get_stock_market(symbol='', string=False):
    """'"""
    assert isinstance(symbol, str), 'stock code need str type'

    if symbol.startswith(('sh', 'sz')):
        market = symbol[:2]

    if symbol.startswith(('50', '51', '60', '90', '110', '113', '132', '204')):
        market = 'sh'

    if symbol.startswith(
        ('00',
         '13',
         '18',
         '15',
         '16',
         '18',
         '20',
         '30',
         '39',
         '115',
         '1318')):
        market = 'sz'

    if symbol.startswith(('5', '6', '9', '7')):
        market = 'sh'

    if string is False:
        return 0 if market == 'sz' else 1

    return market