Skip to main content

Download tick data from Dukascopy Bank SA to local cache with custom simulated price streams!

Project description

cover

Download and cache tick data(material) from Dukascopy Bank SA

This is a local API server that downloads tick data on request and caches results for subsequent calls. Finally, a free historical data collection for backtesting your forex trading algorithms! All instruments on this page are supported! (But only currency pairs are tested based on my use case.). Email me for special requests.

Installation ::Python3

pip install tickterial

Usage

This module can be used in two modes. As an API server using a flask backend, and as a module.

Module usage

from datetime import datetime, timedelta
from tickterial import tickloader

def download():
	period = datetime.now() - timedelta(minutes=60) # previous hour
	data = tickloader.download('GBPUSD', period)
	#
	count = 4
	for index, tick in enumerate(data):
		print(tick)
		#
		count -= 1
		if not count:
			print(f'--showing first {index + 1} ticks--')
			break

download()
print('--end--')

Sample output from GBPUSD

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

API-mode usage

Coming soon...

TODO

  • Internally convert prices to float - DONE
  • Add database caching for large offline histories - DEPRECATED
  • Add API functionality for use as a local tcp streaming service - HIGHER LEVEL FEATURE
  • Add console functionality, saving history files in multiple formats including json and csv.

Notes

  • Cache is store in UTC. Pass your UTC time difference 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. This is handled internally
  • Cache is stored in current working directory, path = .tick-data. Move this directory when migrating your server to save bandwidth and keep your cached data, or mount a local directory when using docker volumes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tickterial-1.1.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tickterial-1.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file tickterial-1.1.0.tar.gz.

File metadata

  • Download URL: tickterial-1.1.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for tickterial-1.1.0.tar.gz
Algorithm Hash digest
SHA256 fefaa5d4c8f80ca0cf789470149877d6571b18bb8a010c9ea058e0686eefcc63
MD5 eb71f362b1c1aae8423f2c97e236ff2c
BLAKE2b-256 d49307fd63c44163148ef737840aa62f7e7161cf0ab78c184cae4472e807d77e

See more details on using hashes here.

File details

Details for the file tickterial-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: tickterial-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for tickterial-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1679812171517a54cfe2e0e5abe4e10bd322e9cf82589169f272953288dcab85
MD5 ddfc85bda120266e301089179a00f376
BLAKE2b-256 59536038ccc4e1947bbf4936472e4a44d4dbe967eca1f451fd5593be895f3c34

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page