question

Upvotes
Accepted
23 0 0 1

Currency Tick History in Python

I am trying to obtain currency tick history, for example last 5 years of 1 minute Open, High,Low, Close for USDZAR. the documentaion seems to be fairly dated on how to set up the request (how do i obtain a token) and how do i structure the query to create a dataframe with DateTime Index, and the columns populated with values.

#producttick-history-rest-api#content
icon clock
10 |1500

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

Upvotes
Accepted
23 0 0 1

There was an error in the pdf. The code block with error line, in bold, corrected below.

timestamp = pd.Timestamp('now')
today = timestamp.tz_localize('UTC').tz_convert(pytz.timezone('Africa/Johannesburg'))
today_str = today.strftime('%Y-%m-%d')


yesterday = (today - pd.Timedelta(1, "d")).normalize()
yesterday_str = yesterday.strftime('%Y-%m-%d')


start_date = pd.to_datetime('2010-01-01', format='%Y-%m-%d')
start_date_str = start_date.strftime('%Y-%m-%d')


filedate = (timestamp - pd.Timedelta(1, "d")).strftime('%Y%m%d')


QueryStartDate = start_date.strftime("%Y-%m-%dT%H:%M:%S.000Z")
QueryEndDate = yesterday.strftime("%Y-%m-%dT%H:%M:%S.000Z")


print("QueryStartDate:", QueryStartDate)
print("QueryEndDate:", QueryEndDate)

icon clock
10 |1500

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

Upvotes
10.3k 18 6 9

@jolin.majmin Thanks for your question - have you tried downloading the python sample jupyter notebook and .py files here. We also have some articles about using Tick History with Python here and here. I hope these can help.

icon clock
10 |1500

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

Upvotes
23 0 0 1

I did try some of those files, they were fairly dated. Been used to xbbg from bloomberg which is easier to access data, and a bit faster, but after some fiddling. I created the script attached that takes account of proxy servers....glued some old bits together.Refinitiv Tick Summary Extraction.pdf



icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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