google 金融 python 套餐不适用于某些股票

google finance python package not working for some stocks

这是检索股票价格的功能代码。

from googlefinance import getQuotes
import json
import re


def get_last_trade_price(TICKER):
    Asset = json.dumps(getQuotes(TICKER))
    raw = (json.loads(Asset)[0]["LastTradePrice"])
    raw = re.sub(',','',raw)        
    return float(raw)

此函数检索股票的最后交易价格。

get_last_trade_price('AAPL')

但它不适用于在美国以外的其他交易所上市的部分股票。

get_last_trade_price('C52')

这个link显示了公司的详细信息。我怎样才能让这段代码起作用?

首先尝试使用具有指定索引的代码SGX:C52

get_last_trade_price('SGX:C52')