English

基金

get_fund_symbols 获取基金代码列表

QuoteClient.get_fund_symbols()

说明

获取所有基金代码列表

参数

返回

list[str]

示例

from tigeropen.quote.quote_client import QuoteClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')

quote_client = QuoteClient(client_config)

result = quote_client.get_fund_symbols()
print(result)

返回示例

[
        "IE00B11XZ988.USD",
        "IE00B7SZLL34.SGD",
        "LU0790902711.USD",
        "LU0476943708.HKD",
        "LU0098860793.USD",
        "SG9999014039.USD"
]

get_fund_contracts 获取基金合约信息

QuoteClient.get_fund_contracts(symbols)

说明

批量获取基金的合约信息

参数

参数类型是否必填描述
symbolslist[str]Yes基金代码列表 如:"IE00B11XZ988.USD" / "LU0790902711.USD"

返回

pandas.DataFrame

其中数据项字段如下

名称示例说明
symbolIE00B464Q616.USD基金代码,后缀为货币
nameASIA STRATEGIC INTEREST BOND FUND "E" (USD) INC MONTHLY基金名称
company_namePIMCO Global Advisors (Ireland) Limited基金名称
marketUS市场 /US/HK/CN
sec_typeFUND合约类别
currencyUSDUSD/HKD/CNH
tradeabletrue是否可交易
sub_typeFixed Income子类别
dividend_typeINC分红类型
tiger_vaultfalse是否为老虎钱袋子

示例

from tigeropen.quote.quote_client import QuoteClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')

quote_client = QuoteClient(client_config)

result = quote_client.get_fund_contracts(symbols=['IE00B11XZ988.USD'])
print(result)

返回示例

             symbol                                name         company_name    market  \
0  IE00B11XZ988.USD             PIMCO总回报债券基金 E Acc   太平洋全球顾问有限公司        MF   \  
1  LU0476943708.HKD        邓普顿环球总收益基金A (Mdis)HKD         富兰克林邓普顿投资      MF  \   
2  SG9999017602.SGD  United Asian Bond Fund A Acc SGD-H          大华资产管理公司      MF   \       

sec_type     currency  tradeable      sub_type dividend_type  tiger_vault
    FUND          USD       True  Fixed Income           ACC        False
    FUND          HKD       True  Fixed Income           INC        False
    FUND          SGD       True  Fixed Income           ACC        False

get_fund_quote 获取基金最新行情

QuoteClient.get_fund_quote(symbols: list[str])

说明

获取基金最新行情

参数

参数类型是否必填描述
symbolslist[str]yes基金代码,上限为500个

返回

pandas.DataFrame

字段类型说明
symbolstr标的代码
closefloat收市价
timestampint毫秒单位的时间戳

示例

from tigeropen.quote.quote_client import QuoteClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')


quote_client = QuoteClient(client_config)
result = quote_client.get_fund_quote(['IE00B11XZ988.USD', 'LU0476943708.HKD'])
print(result)
print(result.iloc[0]['close'])
# to python type
close = float(result.iloc[0]['close'])

返回示例

             symbol  close      timestamp
0  IE00B11XZ988.USD  25.10  1691596800000
1  LU0476943708.HKD   5.22  1691596800000

get_fund_history_quote 获取基金历史行情

QuoteClient.get_fund_history_quote(symbols: list[str], begin_time: int, end_time: int = None, limit: int = None)

说明

获取基金历史行情

参数

参数类型是否必填描述
symbolslist[str]Yes基金代码,上限为500个
begin_timeintYes开始时间戳,单位:毫秒(ms)
end_timeintYes结束时间戳,单位:毫秒(ms)
limitintNo请求返回单个标的数据量

返回

pandas.DataFrame

字段类型说明
symbolstr标的代码
navfloat净值
timeint时间戳

示例

from tigeropen.quote.quote_client import QuoteClient
from tigeropen.tiger_open_config import TigerOpenClientConfig
client_config = TigerOpenClientConfig(props_path='/path/to/your/properties/file/')

quote_client = QuoteClient(client_config)

result = quote_client.get_fund_history_quote(['LU0476943708.HKD', 'LU0476943708.HKD'], begin_time=1691337600000, end_time=1691596800000)
print(result)
if not result.empty:
    print(result.loc[result['symbol']=='LU0476943708.HKD'].iloc[0]['nav'])

返回示例

               symbol           time   nav
0    LU0476943708.HKD  1691596800000  5.22
1    LU0476943708.HKD  1691510400000  5.22
2    LU0476943708.HKD  1691424000000  5.20
3    LU0476943708.HKD  1691337600000  5.25