tickterial


Nametickterial JSON
Version 1.1.2 PyPI version JSON
download
home_pageNone
SummaryDownload tick data from Dukascopy Bank SA to local cache, and simulate multi-symbol time-ordered price streams to stdout.
upload_time2024-06-04 08:46:02
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT License Copyright (c) 2024 drui9 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords tick-data forex-data tick-api ticks
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p style="text-align: center;">
	<img src="https://raw.githubusercontent.com/sp3rtah/tickterial/master/tickterial.png" alt="cover" title="tickterial logo"/>
<p>

# 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:
```monospace
$ 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? <tickterial>
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](https://www.dukascopy.com/swiss/english/marketwatch/historical/) are supported. <a href="mailto:drui9@duck.com">Email me</a> 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
```python
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

```monospace
In the spirit of opensource:
	# dev.drui9
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tickterial",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "tick-data, forex-data, tick-api, ticks",
    "author": null,
    "author_email": "drui9 <drui9@duck.com>",
    "download_url": "https://files.pythonhosted.org/packages/2d/38/6aae0179c37c7d83fb058c08ec15fe33e3d480fa111a366b073c95659122/tickterial-1.1.2.tar.gz",
    "platform": null,
    "description": "<p style=\"text-align: center;\">\r\n\t<img src=\"https://raw.githubusercontent.com/sp3rtah/tickterial/master/tickterial.png\" alt=\"cover\" title=\"tickterial logo\"/>\r\n<p>\r\n\r\n# tickterial: forex & cfd tick data\r\nDownload and cache tick data from Dukascopy Bank SA.\r\n\r\n## Installation ::Python3\r\n- `pip install tickterial`\r\n- `tickterial -h` to check supported arguments.\r\n\r\nExample multi-symbol stream download:\r\n```monospace\r\n$ tickterial --symbols GBPUSD EURUSD USDJPY XAUUSD --start '2024-04-08 17:00:00' --end '2024-04-10 00:00:00' --progress true\r\n\r\n# Output format is: <timestamp, symbol, ask, bid, ask-volume, bid-volume>,[repeated if multiple symbols at same timestamp]\r\n...\r\ntimestamp, symbol, ask-price, bid-price, ask-volume, bid-volume\r\n1712696398.152,GBPUSD,1.26785,1.26774,900000,900000\r\n1712696398.192,USDJPY,1.51808,1.51759,1800000,1800000\r\n1712696398.295,XAUUSD,2353.505,2352.835,90,470\r\n1712696398.343,USDJPY,1.51808,1.51755,1800000,1800000\r\n...\r\n#When multiple ticks exist in the same timestamp, the output is concatenated as such:\r\n1712696267.989,EURUSD,1.0857,1.08569,990000,900000,1712696267.989,GBPUSD,1.26778,1.26769,900000,900000\r\n...\r\n```\r\n- Easy, normalized prices, multi-currency, simultaneous and ordered price output!\r\n\r\n## Why the name? <tickterial>\r\nI thought of tick material as a replacement for tick-data, which has been used way too many times already, both in research and code.\r\n\r\n## How does it work?\r\n- 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!\r\n- Currency pairs(tested) and more(untested) instruments on [this page](https://www.dukascopy.com/swiss/english/marketwatch/historical/) are supported. <a href=\"mailto:drui9@duck.com\">Email me</a> for requests.\r\n- 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).\r\n\r\n### Integrating with your code\r\n```python\r\nfrom datetime import datetime\r\nfrom tickterial import Tickloader\r\n\r\n\r\ndef test_download():\r\n\ttickloader = Tickloader()\r\n\tperiod = datetime(hour=17, day=8,month=4, year=2024)\r\n\tprint(period.ctime())\r\n\t#\r\n\tticks = list()\r\n\tif data := tickloader.download('GBPUSD', period):\r\n\t\tfor tick in data:\r\n\t\t\tticks.append(tick)\r\n\t\tif ticks:\r\n\t\t\tprint(f'{period} tick count: {len(ticks)}')\r\n\t\t\tprint(ticks[0])\r\n\t\telse:\r\n\t\t\tprint('No data!')\r\n\r\ntest_download()\r\nprint('--end--')\r\n\r\n#output:\r\n# {'timestamp': 1689631196.875, 'ask': 1.30788, 'bid': 1.30778, 'ask-vol': 900000, 'bid-vol': 900000}\r\n\r\n```\r\n\r\n## Notes\r\n- Cache is store in UTC. Pass your UTC bias as last parameter to `tickloader.download` to fix local time offset.\r\n- Tick data can only be fetched to the previous hour. Current hour returns 404, thus ignored.\r\n- 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.\r\n- 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.)\r\n- Keeping track of the number of `,` should allow easy partitioning of the ticks for `backtesting systems`. - Voila! My next project.\r\n\r\n## Support the project\r\nI 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.\r\n- You can paypal at me: `ngaira14nelson@gmail.com`\r\n- Contact me for requests, optimizations, pull-requests and every other interesting topic.\r\n\r\n\r\n## TODO\r\n- Add support for streaming ordered-ticks to TCP endpoint - planned\r\n- Support for pandas dataframes and numpy arrays - differred\r\n- Integrate mplfinance for candlestick plotting - differred\r\n- Use proxies to perform async downloads - planned\r\n- Parse ticks to generate timeframe data - differred\r\n- Port to faster languages (C/Rust/GO) - differred\r\n\r\n```monospace\r\nIn the spirit of opensource:\r\n\t# dev.drui9\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 drui9  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Download tick data from Dukascopy Bank SA to local cache, and simulate multi-symbol time-ordered price streams to stdout.",
    "version": "1.1.2",
    "project_urls": {
        "Homepage": "https://github.com/drui9/tickterial"
    },
    "split_keywords": [
        "tick-data",
        " forex-data",
        " tick-api",
        " ticks"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d058b3fd30be380d10899f504fe5c32117b58752baf27b620ab80e755460756f",
                "md5": "8a0b7d0dd78e38cdabe7d3364c19376f",
                "sha256": "0a15f7b8bfdabd9f08817a3b3d0ac8b49c729c2bbf88837f14947c4a78029b44"
            },
            "downloads": -1,
            "filename": "tickterial-1.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8a0b7d0dd78e38cdabe7d3364c19376f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 9809,
            "upload_time": "2024-06-04T08:46:00",
            "upload_time_iso_8601": "2024-06-04T08:46:00.239951Z",
            "url": "https://files.pythonhosted.org/packages/d0/58/b3fd30be380d10899f504fe5c32117b58752baf27b620ab80e755460756f/tickterial-1.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2d386aae0179c37c7d83fb058c08ec15fe33e3d480fa111a366b073c95659122",
                "md5": "1813a1853f1b5ccbf72523d7e07f85f0",
                "sha256": "ffa0c8a4ce404791adffc51e4b6e31457dfc3117c1055ac9c4f829f9f336d2af"
            },
            "downloads": -1,
            "filename": "tickterial-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1813a1853f1b5ccbf72523d7e07f85f0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 11228,
            "upload_time": "2024-06-04T08:46:02",
            "upload_time_iso_8601": "2024-06-04T08:46:02.311850Z",
            "url": "https://files.pythonhosted.org/packages/2d/38/6aae0179c37c7d83fb058c08ec15fe33e3d480fa111a366b073c95659122/tickterial-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-04 08:46:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "drui9",
    "github_project": "tickterial",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "tickterial"
}
        
Elapsed time: 0.82693s