# Get Event Contract Ticker

get_event_contract_ticker(code, count=30)

  • Description

    Get the real-time ticker (trade-by-trade) data of a single event contract, including trade time, YES/NO trade price, trade volume and ticker direction (YES/NO). You must subscribe to SubType.TICKER before querying the ticker, otherwise an error is returned.

  • Parameters

    Parameter Type Description
    code str Event contract code, e.g. 'EC.KXODIMATCH-26JUL140600INDENG-IND'
    count int Number of records to return, default 30, max 1000
  • Return

    Parameter Type Description
    ret RET_CODE API call result
    data pd.DataFrame If ret == RET_OK, the ticker list is returned
    str If ret != RET_OK, an error description is returned

    The returned DataFrame fields are as follows:

    Field Type Description
    code str Contract code
    time str Trade time (yyyy-MM-dd HH:mm:ss, milliseconds not retained)
    yes_price float YES trade price
    no_price float NO trade price
    volume float Trade volume
    side str Trade direction, see PredSide (YES/NO); different from the buy/sell direction
    sequence str Ticker sequence (a large integer from the backend)
  • Example

from moomoo import *

quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)

# Subscribe to TICKER before querying the ticker (otherwise an error is returned)
ret, err = quote_ctx.subscribe_event_contract(
    ['EC.KXODIMATCH-26JUL140600INDENG-IND'], [SubType.TICKER]
)
if ret != RET_OK:
    print('Subscribe failed:', err)
else:
    ret, data = quote_ctx.get_event_contract_ticker(
        'EC.KXODIMATCH-26JUL140600INDENG-IND', count=5
    )
    if ret == RET_OK:
        print(data)
    else:
        print('error:', data)

quote_ctx.close()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  • Output
                                  code                 time  yes_price  no_price  volume side             sequence
0  EC.KXODIMATCH-26JUL140600INDENG-IND  2026-07-14 14:00:22        0.0      0.01    7.57   NO  7662445088852672512
1  EC.KXODIMATCH-26JUL140600INDENG-IND  2026-07-14 14:00:33        0.0      0.01   14.18   NO  7662445136097312768
2  EC.KXODIMATCH-26JUL140600INDENG-IND  2026-07-14 14:00:50        0.0      0.01  106.14   NO  7662445209111756800
3  EC.KXODIMATCH-26JUL140600INDENG-IND  2026-07-14 14:00:59        0.0      0.01    5.82   NO  7662445247766462464
4  EC.KXODIMATCH-26JUL140600INDENG-IND  2026-07-14 14:01:01        0.0      0.01  111.50   NO  7662445256356397056
1
2
3
4
5
6