github.com/diadata-org/diadata@v1.4.593/documentation/oracle-documentation/near-request-oracle.md (about)

     1  ---
     2  description: This page contains an overview on how to interact with the NEAR Request oracle
     3  ---
     4  
     5  # NEAR Request Oracle
     6  
     7  On the NEAR blockchain, DIA operates an oracle that can fetch any quotation from the DIA API. The oracle follows a request/response pattern, i.e., an on-chain NEAR contract _requests_ data from the DIA API which is then promptly served by the oracle as a callback.
     8  
     9  The latest oracle addresses are listed [here](deployed-contracts.md).
    10  
    11  ### How to use the oracle
    12  
    13  The oracle can be used by interfacing it with a client for quotations, that takes the callbacks and processes the data. An example deployment can be seen [here on the NEAR testnet](https://explorer.testnet.near.org/accounts/quote-test-client.dia-test.testnet). The corresponding source code is located [in this repository](https://github.com/diadata-org/dia-adapter).
    14  
    15  Follow the instructions in its README to learn how to interact with the DIA oracle on the NEAR blockchain. There, the exact steps are described for getting a client up and running that is served quotations using the request oracle.
    16  
    17  ### Usage Example
    18  
    19  You can test the oracle by querying a price quotation using code from the [example repository](https://github.com/diadata-org/dia-adapter). For that, checkout the repository and install dependencies using `npm install`\
    20  After that, you can build the oracle consumer with `npm run build`and start the oracle consumer with `node dist/test/quote-make-request`
    21  
    22  An example request and response for the asset DIA (can be configured in the source file) looks like this
    23  
    24  `user@host% node dist/test/quote-make-request` \
    25  `near.call quote-test-client.dia-test.testnet make_request`\
    26  `near.view quote-test-client.dia-test.testnet get_callback_response`\
    27  `result: {"request_id":"111","err":"","data":{"Symbol":"DIA","Name":"DIAData","Price":2.433626800388127,"PriceYesterday":2.542690797155571,"VolumeYesterdayUSD":583156.1339811679,"Source":"diadata.org","Time":"2021-03-12T14:10:18.357245071Z","ITIN":"undefined"}}`