how to get interval high low data for different securities or different start date and end date in o

Say I have 3 securities and 3 sets of start date and end dates as follow,


2021-01-02 - 2021-03-06 for 0700.HK
2023-04-02- 2023-09-30 for 9988.HK
2022-07-02 - 2022-08-06 for 0005.HK


Is there a way to retrieve 3 rows of interval high low price for the input above using only a single function call in python?

Best Answer

  • Hi @thomas.ng,
    You can try to fetch calculated data using data cloud function MAX and MIN. By default it is calculated on a daily interval.

    rd.get_data(["0700.HK"],
    ["MAX(TR.PriceHigh(SDate=2021-01-02, EDate=2021-03-06))"])

    and of course if there is a need to do it in one go you can go with:

    rd.get_data(["0700.HK","9988.HK","0005.HK"],
    ["MAX(TR.PriceHigh(SDate=2021-01-02, EDate=2021-03-06))","MIN(TR.PriceLow(SDate=2021-01-02, EDate=2021-03-06))",
    "MAX(TR.PriceHigh(SDate=2023-04-02, EDate=2021-09-30))","MIN(TR.PriceLow(SDate=2023-04-02, EDate=2021-09-30))",
    "MAX(TR.PriceHigh(SDate=2022-07-02, EDate=2022-08-06))","MIN(TR.PriceLow(SDate=2022-07-02, EDate=2022-08-06))"])


Answers

  • Hi @thomas.ng ,


    I am afraid there is no a direct way of making api call with multiple dates. However, one approach could be to make the request for all rics and use the earliest date (2021-01-02) as a start_date and latest date as an end date (2023-09-30) and then filter out the dates you are interested in per RIC.


    Hope this helps.


    Best regards,

    Haykaz