Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Eikon Data APIs /
avatar image
Question by benoit.laurent2 · Jan 28, 2020 at 04:43 PM · rhistory apidisplayparams

How to show results of a RHistory query with VBA into an Excel sheet?

I would like to write into the cell A1 of an Excel sheet the result of the query below, but I don't know what I need to do :

Set myRHistoryManager = CreateHistoryManager

myRHistoryCookie = myRHistoryManager.Initialize("MY BOOK")

Set myRHistoryQuery = myRHistoryManager.CreateHistoryQuery(myRHistoryCookie)

' Set the query parameters accordingly to your needs

With myRHistoryQuery

.InstrumentIdList = "VOWG5YEUAM=R" ' Range("G6").Value

.FieldList = "MID_SPREAD.Timestamp;MID_SPREAD.Close" ' Range("G7").Value 'Or of the form "TRDPRC_1.TIMESTAMP;TRDPRC_1.VALUE;TRDPRC_1.VOLUME"

.RequestParams = "START:" & CDbl(ActiveSheet.Range("A1").Value) & " END:" & CDbl(ActiveSheet.Range("A2").Value) & " INTERVAL:1D" ' Range("G8").Value

.RefreshParams = "FRQ:5S" ' Range("G9").Value

.DisplayParams = "" ' ActiveSheet.Range("G10").Value '"TSREPEAT:YES CH:Fd"

.Subscribe

End With

Exit Sub


Where do I have to write the cell on which I want the result?


Thanks


People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

4 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by jirapongse.phuriphanvichai · Jan 29, 2020 at 09:51 AM

I have modified the Basic.sample.xlsm to display the result at Cell A1.

Private Sub m_rhistoryQuery_OnImage(ByVal a_historyTable As Variant)
    ' TODO: Use the data in the array a_historyTable
    Range(Cells(1, 1), Cells(UBound(a_historyTable, 1), UBound(a_historyTable, 2))).Value = a_historyTable
End Sub

Private Sub m_rhistoryQuery_OnUpdate(ByVal a_historyTable As Variant, ByVal a_startingRowIndex As Long, ByVal a_startingColumnIndex As Long, ByVal a_shiftDownExistingRows As Boolean)   
    Range(Cells(1, 1), Cells(UBound(a_historyTable, 1), UBound(a_historyTable, 2))).Value = a_historyTable
End Sub

Basic.sample.zip


basicsample.zip (26.1 KiB)
Comment
benoit.laurent2

People who like this

1 Show 1 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
benoit.laurent2 · Feb 19, 2020 at 10:19 AM 0
Share

Hi,

Is it possible to include this sub into a loop? I would like to query historical data of many assets with VBA to avoid writing RHistory in my Excel sheets for each. When I create a loop, the first lap works, but on the second one, the ".suscribe" functionality doesn't work and no data can be requested.

Do I need to to put something particular?


Thank you.

avatar image
REFINITIV
Answer by zoya.farberov · Jan 28, 2020 at 05:37 PM

Hello @benoit.laurent2,

You may find useful RHistory API Examples, Single-Query Sample Excel book conveys output via Cells.

Does this help?

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
Answer by benoit.laurent2 · Jan 29, 2020 at 08:22 AM

Thank you, but it doesn't help me to understand where I have to give the cell where the answer of the query must be written. By default, in RHistoryAPI.xlsm, there is no place in the code to display the results in termsheet.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

avatar image
Answer by benoit.laurent2 · Jan 29, 2020 at 10:24 AM

Ok thanks. I didn't understand the use of .subsrcibe. I can see this property calls the sub myRHistoryQuery_OnImage when I put a stop on this sub.

Maybe it's not clear enough in the tutorial.

Many thanks for your help.

Best regards.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
10 People are following this question.

Related Questions

Is there a way to retrieve RHistory data via API without using the Event-subs? e.g. ist there a data property?

  • Feedback
  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Careers
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Calais
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRIT
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • World-Check Data File
  • Explore
  • Tags
  • Questions
  • Badges