How to call count API Hits In DSS

Hello Team,

We want a better way to count API call hits, as One call, calls one more API call(As if Request_Url/nextlink is sent along with the result)

We use -
https://selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/ExtractWithNotes

&
https://selectapi.datascope.refinitiv.com/RestApi/v1/Search/FuturesAndOptionsSearch

Could you please guide and help on this.

Thank you,

Trisha Gehlot

Best Answer

Answers

  • @trisha.gehlot

    Thank you for reaching out to us.

    Please explain more about your requirement. You may need to contact the DSS support team directly via MyRefinitiv for more information as this forum is more for programming type queries.

    The DSS provides the Usage and Quota APIs, as shown in the DSS REST API Reference Tree.

    1718348676048.png

    You may also refer to the LSEG DataScope Select Best Practices & Fair Usage Policy for more information.

  • Thank you @Jirapongse !!

    Yes our query is regarding programming.

    From Document - LSEG DataScope Select Best Practices & Fair Usage Policy
    To keep a consistent tally of how many requests you have executing, we recommend that you consider a request to count against your tally as soon as you submit it, and that you do not consider it to be removed from that tally until you receive a status that the request has completed, failed, been rejected, or has been cancelled.


    So we want to count the request per minute.



  • Hello @trisha.gehlot,

    The usage details are also available through REST API in case you want to access it programmatically. For the API calls with on-demand extraction, you can also use ExtractWithNotes endpoint, which will produce a summary report of all the data used like this:

    Extraction Services Version 16.3.44775 (2a6cb5e55172), Built Dec 15 2022 23:00:22
    User has overridden estimates broker entitlements.
    Processing started at 16/01/2023 03:59:12 PM.
    User ID: ****
    Extraction ID: 2000000503421163
    Correlation ID: CiD/****/AAAAAA.0852c8fa81b879e9/RA
    Schedule: 0x0852c8fa81c879e9 (ID = 0x0000000000000000)
    Input List (1 items): (ID = 0x0852c8fa81c879e9) Created: 16/01/2023 03:59:12 PM Last Modified: 16/01/2023 03:59:12 PM
    Report Template (476 fields): _OnD_0x0852c8fa81c879e9 (ID = 0x0852c8fa81d879e9) Created: 16/01/2023 03:59:10 PM Last Modified: 16/01/2023 03:59:10 PM
    Schedule dispatched via message queue (0x0852c8fa81c879e9)
    Schedule Time: 16/01/2023 03:59:12 PM
    Timeseries Date Range: 07/12/2019 to 07/12/2022
    Column 'CIN Code' suppressed for lack of 'CIN Code' permission.
    Column 'Pricing Method Code' suppressed for lack of 'Distribution Rights - Field only allowed through Fixed Income Analytics template' permission.
    Column 'Pricing Method Code Description' suppressed for lack of 'Distribution Rights - Field only allowed through Fixed Income Analytics template' permission.
    (ISN,DE0001135424,QR1,DE113542=QTX) is inactive.
    Processing completed successfully at 16/01/2023 03:59:13 PM, taking 0.919 Secs.
    Extraction finished at 16/01/2023 08:59:13 PM UTC, with servers: x16q14, ETS (0.2 secs), QSDHA1 (0.0 secs), QSHC15 (0.5 secs)
    Usage Summary for User ****, Client ****, Template Type Price History
    Base Usage
    Instrument Instrument Terms Price
    Count Type Subtype Source Source
    ------- ----------------------------------- ---------------------------- -------------- ----------------------------------------
    1 Govt/Treasury/Central Bank N/A N/A
    -------
    1 Total instrument charged.
    0 Instruments with no reported data.
    =======
    1 Instrument in the input list.
    No Evaluated Pricing Service complex usage to report -- 1 Instrument in the input list had no reported data.

  • Thank you for this info @Gurpreet!!
    Also now I got a new idea to limit the API hits using something -


    from ratelimit import limits, sleep_and_retry

    # 30 calls per minute

    CALLS = 30

    RATE_LIMIT = 60

    Could you please guide if something like this, is good practice to be use?
    Or do we have something like this specific to DSS?

  • Hi @trisha.gehlot,

    Its advisable to rate limit the calls, and if possible try to use an instrument list and a report template to extract the data. You can see the different limits in the best practice and limits document.

  • Thank you for your response @Gurpreet !!

    With large amount of instruments, it was advised to use on-demand approach

    Also could you please give any example code to use rate limit, as same API is called in multiple functions.

  • Hello Team
    Could anyone please help with this query?
    Thank you :)