How to get trading status of RICs through python api ?

@alex

when i run the below codes

start=time.strftime("%Y-%m-%dT01:29:00",time.localtime(time.time()))
end=time.strftime("%Y-%m-%dT07:00:00",time.localtime(time.time()))
df=ek.get_timeseries(['000001.SZ','600781.SS'],fields=["Open","High","Low","Close","Volume"], start_date = start,end_date =end,interval='minute')

I get the result like this: "ERROR"

('600781.SS', ': ', 'Error: TSINoDataAvailable, ErrorCode: TA-TSINoDataAvailable, Fault: TSIError, Description: No data available for the requested date range', '\n')

and I know the reason is that RIC(600781.SS) is suspended on Nov-23-2017。

Is there a function to calculate fun(600781.SS) 's trading status ,for example I hava a code list like this

lst=['000001.SZ',
'000002.SZ',
'000004.SZ',
'000005.SZ',
'000008.SZ',
'000009.SZ',
'000010.SZ',
'000011.SZ',
'000012.SZ',
'000014.SZ',
'000016.SZ',
'000017.SZ',
'000018.SZ',
'000020.SZ',
'000021.SZ',
'000022.SZ',
'000023.SZ',
'000025.SZ',]

Alex Putkov
jirapongse.phuriphanvichai

Best Answer

  • You can try this one:

    df = ek.get_data(['600781.SS', '000001.SZ', '000002.SZ', '000004.SZ', '000005.SZ', '000008.SZ', '000009.SZ', '000010.SZ', '000011.SZ', '000012.SZ', '000014.SZ', '000016.SZ', '000017.SZ', '000018.SZ', '000020.SZ', '000021.SZ', '000022.SZ', '000023.SZ', '000025.SZ'], ["PRC_QL_CD"])

    The result is:

    (   Instrument PRC_QL_CD
    0 600781.SS SDL
    1 000001.SZ
    2 000002.SZ
    3 000004.SZ
    4 000005.SZ
    5 000008.SZ
    6 000009.SZ
    7 000010.SZ
    8 000011.SZ
    9 000012.SZ
    10 000014.SZ
    11 000016.SZ
    12 000017.SZ
    13 000018.SZ
    14 000020.SZ SUS
    15 000021.SZ
    16 000022.SZ SUS
    17 000023.SZ
    18 000025.SZ , None)

    The above code shows the value of PRC_QL_CD which is a real-time field.

    The definition of this field is defined in the RDMFieldDictionary file.

    PRC_QL_CD  "PRICE CODE"           118  NULL        ENUMERATED    3 ( 3 )  ENUM             1
    !
    ! Price qualifier code for equities, bonds, and options, generally related to the
    ! quote price.

    It is an enumerated field. Its values are defined in the enumtype.def file.

    PRC_QL_CD    118
    !
    ! VALUE DISPLAY MEANING
    ! ----- ------- -------
    0 " " normal market or not allocated
    ...
    19 "SDL" instrument suspended while drawing of lots takes place
    ...
    54 "SUS" Suspended
    ...
    94 "CLS" Market closed
    ...

Answers