Skip to Content
Technical Articles

Bring Your Own Rates to SAP Market Rates Management in 3 easy steps

Hello there.

 

SAP Market Rates Management offers you, in addition to getting market rates directly from leading providers like Thomson Reuters, the ability to bring in your own market data from your own sources. In this case, you need to implement your own mechanism to upload rates to the service.

This may appear to be a daunting task at first. So here, we attempt to break this task down for you, and provide examples and sample implementations which will hopefully be able to guide you through developing your own Upload implementation. Remember, your Upload implementation can be done in any system or technology of your choice, as long as you can perform the steps listed here.

We expect you have already finished your service setup. If not, please feel free to check out our ‘Getting Started’ blog here.

Here, we take up the example of fetching latest market rates from the European Central Bank (ECB) via their APIs, and then posting them to the SAP Market Rates Management Upload service. The steps essentially would remain the same for your own market data provider as well.

A sample application covering the following steps is available for your reference here.

So let’s get started.

 

Step 1: Fetch market rates from your market data provider – ECB in this case – via their APIs.

 

We receive the data from ECB in the following format.

Key Freq Currency Currency_Denom Exr_Type Exr_Suffix Time_Period Obs_Value
EXR.D.USD.EUR.SP00.A D USD EUR SP00 A 2019-02-28 1.1393

This is what the fields are called, and this is what a sample record looks like.

We fetch this data using ECB’s APIs in our Upload implementation.

 

Step 2: Parse rates from the market data provider and convert them into the Market Rates Management Upload CSV or JSON format.

 

The fields needed for Market Rates Management Upload are the following.

Provider Code – The market data provider from whom you are fetching your data, for example, Thomson Reuters, or the European Central Bank as in this case.

Market Data Source – The direct source from which your data provider gets their market data, for example, NYSE.

Market Data Category – The identifier for the type of market data. For example, 01 for exchange rates, 03 for interest rates, and so on.

Key 1 – Placeholder1 for a key you can assign to a market data type. For example, the <From> currency type when you are using the exchange rates data type, or <Reference Interest Rates> when you are using the interest rates data type.

Key 2 – Placeholder2 for a key you can assign to a market data type. It is usually the <To> currency type for when you are using a currency exchange transaction. When you are making a call for interest rates, this field is empty.

Market Data Property – The specific kind of market data that you are requesting. For example, <CLOSE> for End of Day rates.

Effective Date – The effective date on which the market data value is valid.

Effective Time – The effective time from which the market data value is valid.

Market Data Value – The actual value of the market data.

You can find out more details about the fields to be used in our Help documentation section ‘Uploading Rates’ here.

We take the data received from Step 1, and map it to the Upload fields mentioned here.

For the ECB example, the sample record above can be mapped to the Market Rates Management fields as follows.

Provider Code Market Data Source Market Data Category Key 1 Key 2 Market Data Property Effective Date Effective Time Market Data Value
ECB ECB 01 EUR USD CLOSE 2019-02-28 16:00:00 1.1393

Based on these descriptions, you need to map the data from your market data provider to this format supported by the service.

 

Step 3: Upload the parsed rates to the MRM service.

 

Once you have converted the rates you have received from your market data provider into the Market Rates Management Upload format, all that remains to be done is for you to post these rates to the Upload endpoint of the service.

From your service setup on the SAP Cloud Platform, you should already have the following values from your generated service key – uploadUrlclientidclientsecret, and url.

The first thing we now need to do is to generate an access token for us to access the service with our credentials. For this, we need to send a request to the url from the service key with the following details.

POST:{'url' from your service key}/oauth/token

Headers:
Content-Type: application/x-www-form-urlencoded

Body:
client_id:{'clientid' from Service Key}
client_secret:{'clientsecret' from Service Key}
grant_type:client_credentials
response_type:token
Content-Type:application/x-www-form-urlencoded

Here, you can replace the urlclientid and clientsecret with the values from your service key.

Once executed, this request would return to you an access_token in the response body. We then take this access token and provide it to authenticate our call to the Upload endpoint.

This is how a call to the Upload endpoint would then look like –

POST:{'uploadUrl' from your service key}

Headers:
Authorization: Bearer {generated access token}
Content-Type: text/csv or application/json

Body:
{prepared market data set from Step 2}

Here, you’d need to replace the uploadUrl with the actual value from your service key. Also, add the generated access token, and of course, the market data itself.

And that’s it. Once you execute this request, you should receive a ‘201 Created’ HTTP status back from the Market Rates Management service. This tells you that the rates were successfully posted to to the service. You can also then execute a request to the Download endpoint to verify that your uploaded data is now available.

 

We hope this blog has helped you understand the Market Rates Management Upload process a little better, and that it’d now be a little easier for you to get started and build your own implementation.

 

Again, please feel free to check out our sample implementation for these steps here.

Please visit our Help documentation page for the Bring Your Own Rates data option here for a lot of more insights. Here, you shall also find a Postman collection available for download, where you’d be able to plug in your service credentials and try out the Upload and Download processes on your own.

For more information about the Thomson Reuters data option, please refer to our Help documentation here.

Thank you!

7 Comments
You must be Logged on to comment or reply to a post.
  • Hi Nisheeth,  Thanks for sharing ur knowledge. M trying to Upload sample rates . But m stuck in first step – generating token(

    POST:{'url' from your service key}/oauth/token

    . Using postman – and getting 401 unauthorized with below authorization error .

    {
    “error”: “unauthorized”,
    “error_description”: “Bad credentials”
    }

    I also tried  adding basic authorization with my trial id and pwd but still same error.

     

    Would appreciate any pointers.

     

    Postman data:

    Method : Post

    URl : https://ssensemrmtrial.authentication.eu10.hana.ondemand.com/oauth/token

    Headers :

    Content-Type: application/x-www-form-urlencoded

     

    Body:

    client_id:sb-59beef90-f8e8-48d1-a453-8d3a8eed94c2!b49039|market-data-MRM-MRM_TRIAL!b4225
    client_secret:ESi2m1ecB25+HjwGEPWK5kIAkVs=
    grant_type:client_credentials
    response_type:token
    Content-Type:application/x-www-form-urlencoded

    Thanks,

    rini

    • Hi Rini,

       

      Thanks for trying out the offering.

      Surprisingly though, I tried to post a request with exactly the content you provided and it is working for me. Could you please confirm once if there isn’t a typing error/missing characters/extra spaces in your postman call against the content you pasted here? Attaching a screenshot here from my call as well.

      Screenshot%20of%20my%20Postman%20request

      Screenshot of my Postman request

      If you are still facing an issue, could you please mail your Postman script over, and we can have a look. Would that work for you?

      Thanks again!

      Best,

      Nisheeth

      /
      Screenshot%20of%20my%20Postman%20request
      • Thanks a lot Nitheesh !

        Issue was i was selecting body as RAW ; changed it as per ur screenshot and it worked.

        I got the Bearer token back.

        I am stuck in next step now , to upload rates .

        I am using trial account for MRM – service “MRM – ECB Data” , as thats the only service available in list in Service list , dont see anything for BYOR so i am assuming this is the one for BYOR 

         I didnt get upload url in service key but only download url .

        So I am  calling “https://mrmawseu10-mrm-mrm-trial-market-data-upload.cfapps.eu10.hana.ondemand.com/uploadMarketData” . I formed this url watching the youtube video posted in ur other blog post (One Stop ..) .

        But I am getting  401 Unauthorized with below error mssg

        {
        “message”: “Provide a valid scope in your request.”
        }

        Is there anything else I need to do to get upload URL in service key ?

        Copying the service key here

         

        {

        “downloadUrl”: “https://mrmawseu10-mrm-mrm-trial-market-data-download.cfapps.eu10.hana.ondemand.com/downloadMarketData”,

        “uaa”: {

        “uaadomain”: “authentication.eu10.hana.ondemand.com”,

        “tenantmode”: “dedicated”,

        “sburl”: “https://internal-xsuaa.authentication.eu10.hana.ondemand.com”,

        “clientid”: “sb-59beef90-f8e8-48d1-a453-8d3a8eed94c2!b49039|market-data-MRM-MRM_TRIAL!b4225”,

        “verificationkey”: “—–BEGIN PUBLIC KEY—–MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtz9Qql3aFwMuHzR5/tGCGa8QVr7c9vA9QpV7ji3UjL7LKlNWmKipRvA8D4pes2LiZInOsKT67kfIxZN/seCpb9yP9C6nlnvAFeVwOwjcniTy3lHV0YAARqnlgOo8BzNucdZhL+iFlYzwohihQD/xuRm6c3gbwyT8QQAR0HUkY/EosEVGhW5+bdTXWOFokq93E2HlxxWUSnnRIxugvzP0l023ljB/nHmU0gWd/UnxIUPgOBcJSMVx56Q+F+ToKNCqMttpf0D7m9go/Tjf3SKBBZ3DL9qZ+lw1xsg5J1RFkz7gdQfNWEqfpw+F/qh4AWvGKmmMevGuPad+4I+/ZQhJ4QIDAQAB—–END PUBLIC KEY—–“,

        “apiurl”: “https://api.authentication.eu10.hana.ondemand.com”,

        “xsappname”: “59beef90-f8e8-48d1-a453-8d3a8eed94c2!b49039|market-data-MRM-MRM_TRIAL!b4225”,

        “identityzone”: “ssensemrmtrial”,

        “identityzoneid”: “2bc94f11-b7a7-441f-bfa2-0b062b710339”,

        “clientsecret”: “ESi2m1ecB25+HjwGEPWK5kIAkVs=”,

        “tenantid”: “2bc94f11-b7a7-441f-bfa2-0b062b710339”,

        “url”: “https://ssensemrmtrial.authentication.eu10.hana.ondemand.com”

        }

        }

  • Hi Nisheeth,

    Thanks for sharing ur knowledge. M trying to Upload sample rates , with below error mssg “XXX is a mandatory field”, Is there an API introduce with uploading, which fields are mandatory and which are optional?

    It’s very necessary, mandatory a few fields that are not displayed in the help viewer : https://help.sap.com/viewer/64e0eccf2d424543be76606dd5e5e460/LATEST/en-US/add8a38b20d3454d9d4479c5c1c8d708.html

    I added the following fields, can upload successfully:

    1、marketDataKey 2、fromDate 3、fromTime

    /
    • Hi Tongyong,

      Thanks for trying out this API. This is a valid feedback that I take back with me.

      Meanwhile, for your reference, all fields are mandatory for the Download call, whereas all fields till the Market Data Value are mandatory during the Upload. This is for exchange rates though, but different market data types may need some of the additional fields as well. This is also one of the reasons we have refrained from specifically stating whether a field is mandatory or not, as this may depend on the type of rates you are uploading.

      You may check out the API definitions here as well.

      Thanks and Best Regards,

      Nisheeth

      • Hi Nitheesh !

        Thanks for you reply! If we want to use both MRM-Refinitiv Data and Bring Your Own Rates,

        But upload our own rates, there is a small issue here:

        Steps to reproduce:

        1、Upload Ouer Own Rates (eg. Y001)  With uploadUrl

        2、Logon on SCP, Open App Manage Marktes Rates, choose no need data (eg. Y001) and delete

        3、Use the upload interface to upload other data (eg. Y002), the deleted data (Y001)  still be in the app.