Metadata-Version: 2.1
Name: tickterial
Version: 1.0.3
Summary: Download tick data from Dukascopy Bank SA to local cache with custom simulated price streams!
Author-email: sp3rtah <ngaira14nelson@gmail.com>
License: MIT License
        
        Copyright (c) 2022 sp3rtah
        
        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.
        
Project-URL: Homepage, https://github.com/sp3rtah/tickterial
Keywords: forex,forex-data,streaming,forex 
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Flask==2.3.2
Requires-Dist: Flask-SQLAlchemy==3.0.5
Requires-Dist: loguru==0.6.0
Requires-Dist: pytz==2022.7
Requires-Dist: requests==2.31.0
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"

<p style="text-align: center;">
	<img src="https://raw.githubusercontent.com/sp3rtah/tickterial/master/tickterial.png" alt="cover" title="tickterial logo"/>
<p>

## 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](https://www.dukascopy.com/swiss/english/marketwatch/historical/) are supported! (But only `currency pairs` are tested based on my use case.).  <a href="mailto:ngaira14nelson@gmail.com">Email me</a> 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`
```python
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
- Add API functionality for use as a local tcp streaming service
- Containerize the API through docker for ease of use
- Stick around. There's more coming!

## 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 fetch to the previous hour. Current hour returns 404. This is handled internally though
- 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.

## `Please donate to keep development going`
- My Public Address to Receive BTC: `bc1qg8tqa0azl7el38wtdfawxnj2tfz46ajtjnv685`
- Via [Trust Wallet](https://link.trustwallet.com/send?coin=0&address=bc1qg8tqa0azl7el38wtdfawxnj2tfz46ajtjnv685)
