我有一个给定比赛的事件(比赛,即Richmond vs Collingwood)及其各自的ID,在我的例子中是AFL,但是当试图获得与这些事件相关的市场ID时,API只给出竞争市场ID作为响应。如何更改我的请求,以便也提供此信息?
我使用的Python库是:https://github.com/liampauling/betfair
下面是我使用的代码: 1.获取afl的竞赛ID,2.获取该竞赛中所有比赛的事件ID和名称,3.获取事件的市场ID。
在1中
competition_id = client.betting.list_competitions(filter=filters.market_filter(event_ids=event_ids))[-1].competition.id输出1:11897406
在2个
events = client.betting.list_events(
filter=filters.market_filter(
competition_ids=[competition_id]))
for event_result in events:
print(event_result.event.name, event_result.event.id)Out2
AFL 28159788
Brownlow Medal 2019 28927640
Hawthorn v Western Bulldogs 29182265
North Melbourne v Brisbane 29182264
Gold Coast v Fremantle 29182266
Port Adelaide v Carlton 29182261
Favourites To Win 29203764
Geelong v Melbourne 29182263
West Coast v GWS 29182262
Sydney v Adelaide 29182257
Women's AFL 28113600
Essendon v St Kilda 29182258
AFL Round 2 Multis 29195364
Adelaide (W) v Carlton (W) 29199747在3年内
AFL_market_catalogue = client.betting.list_market_catalogue(filter=filters.market_filter(event_ids=event_ids),
market_projection=['EVENT', 'COMPETITION'])[0]输出3
{"marketId":"1.148783689","marketName":"Premiers 2019","totalMatched":293415.056733,"competition":{"id":"11897406","name":"AFL"},"event":{"id":"28159788","name":"AFL","countryCode":"AU","timezone":"GMT","openDate":"2099-01-01T00:00:00.000Z"}}如3的输出所示,返回的唯一marketID是2019年的首演-当我需要霍桑is西部斗牛犬,北墨尔本is布里斯班等等。
发布于 2019-04-04 21:56:40
尝试将max_results=n设置为list_market_catalogue()的参数。
文档(https://developers.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/listMarketCatalogue)说明listMarketCatalogue()需要一个maxResults整数。相反,体育演示工具(https://docs.developer.betfair.com/visualisers/api-ng-sports-operations/)默认为最大结果值1,最高结果为'Premiers 2019‘,其余结果被忽略。
[我的Python有点生疏了,所以我还想问一下,那个[0]是否应该在右括号之后?]
目前,我能看到的每一款AFL游戏都有14个可用的市场,所以如果你想将结果限制在主要的获胜团队市场,你需要在过滤器的market_types_codes中包括MATCH_ODDS。
https://stackoverflow.com/questions/55409444
复制相似问题