Skip to main content

cover

tickterial: forex & cfd tick data

Download and cache tick data from Dukascopy Bank SA.

Installation ::Python3

  • pip install tickterial
  • tickterial -h to check supported arguments.

Example multi-symbol stream download:

$ tickterial --symbols GBPUSD EURUSD USDJPY XAUUSD --start '2024-04-08 17:00:00' --end '2024-04-10 00:00:00' --progress true

# Output format is: <timestamp, symbol, ask, bid, ask-volume, bid-volume>,[repeated if multiple symbols at same timestamp]
...
timestamp, symbol, ask-price, bid-price, ask-volume, bid-volume
1712696398.152,GBPUSD,1.26785,1.26774,900000,900000
1712696398.192,USDJPY,1.51808,1.51759,1800000,1800000
1712696398.295,XAUUSD,2353.505,2352.835,90,470
1712696398.343,USDJPY,1.51808,1.51755,1800000,1800000
...
#When multiple ticks exist in the same timestamp, the output is concatenated as such:
1712696267.989,EURUSD,1.0857,1.08569,990000,900000,1712696267.989,GBPUSD,1.26778,1.26769,900000,900000
...
  • Easy, normalized prices, multi-currency, simultaneous and ordered price output!

Why the name?

I thought of tick material as a replacement for tick-data, which has been used way too many times already, both in research and code.

How does it work?

  • This package downloads tick data on request and caches downloads to disk for subsequent offline calls. Finally, a quick and easy historical data collection for backtesting trading algorithms!
  • Currency pairs(tested) and more(untested) instruments on this page are supported. Email me for requests.
  • Note that this code respects their API rate-limits. As such, asyncronous frameworks like aiohttp largely returned errors, before I settled for a syncronous. A work-around is to use a list of proxies for each individual request (planned).

Integrating with your code

from datetime import datetime
from tickterial import Tickloader


def test_download():
	tickloader = Tickloader()
	period = datetime(hour=17, day=8,month=4, year=2024)
	print(period.ctime())
	#
	ticks = list()
	if data := tickloader.download('GBPUSD', period):
		for tick in data:
			ticks.append(tick)
		if ticks:
			print(f'{period} tick count: {len(ticks)}')
			print(ticks[0])
		else:
			print('No data!')

test_download()
print('--end--')

#output:
# {'timestamp': 1689631196.875, 'ask': 1.30788, 'bid': 1.30778, 'ask-vol': 900000, 'bid-vol': 900000}

Notes

  • Cache is store in UTC. Pass your UTC bias as last parameter to tickloader.download to fix local time offset.
  • Tick data can only be fetched to the previous hour. Current hour returns 404, thus ignored.
  • Cache is stored in current working directory(default), path = $(pwd)/.tick-data, or to path specified in --cachedir option, also available while creating Tickterial(cachedir=/your/path) object. Move this directory when migrating to keep your offline tick data.
  • For multi-symbol downloads, the streams are ordered by timestamp(wow!). You can stream ordered prices for say EURUSD, GBPUSD etc. (Currently, only supported for commandline invokation.)
  • Keeping track of the number of , should allow easy partitioning of the ticks for backtesting systems. - Voila! My next project.

Support the project

I couldn't afford college. I therefore learn through the web and create amazing software that can impact this world in ways I can. A little help will offload my bills and give me more working time.

  • You can paypal at me: ngaira14nelson@gmail.com
  • Contact me for requests, optimizations, pull-requests and every other interesting topic.

TODO

  • Add support for streaming ordered-ticks to TCP endpoint - planned
  • Support for pandas dataframes and numpy arrays - differred
  • Integrate mplfinance for candlestick plotting - differred
  • Use proxies to perform async downloads - planned
  • Parse ticks to generate timeframe data - differred
  • Port to faster languages (C/Rust/GO) - differred
In the spirit of opensource:
	# dev.drui9

Release files for tickterial 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tickterial 1.1.2
File Size Uploaded
tickterial-1.1.2.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tickterial 1.1.2
File Interpreter ABI Platform
tickterial-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 21.0 kB

Release files / tickterial-1.1.2.tar.gz

Download URL tickterial-1.1.2.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ffa0c8a4ce404791adffc51e4b6e31457dfc3117c1055ac9c4f829f9f336d2af
BLAKE2b-256 checksum
How to use checksums
2d386aae0179c37c7d83fb058c08ec15fe33e3d480fa111a366b073c95659122
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release files / tickterial-1.1.2-py3-none-any.whl

Download URL tickterial-1.1.2-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a15f7b8bfdabd9f08817a3b3d0ac8b49c729c2bbf88837f14947c4a78029b44
BLAKE2b-256 checksum
How to use checksums
d058b3fd30be380d10899f504fe5c32117b58752baf27b620ab80e755460756f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page