Skip to main content

A python client for tickerdax.com with a built-in caching system.

Project description

icon

TickerDax Client



CI

A python package that interfaces with the tickerdax.com REST and websockets API. It handles common data operations like batch downloading data, streaming real-time data, and caching data locally to minimize network requests.

Installation

You can install this package with pip by running the command below.

pip install tickerdax

Docker Dependency

This client interfaces with a redis docker container. In order for the package to work, you must first install docker. Here are instructions per platform.

Mac

Instructions

Linux

Instructions

Windows

Note on windows you must first install WSL then you can install docker. Instructions

Python Examples

Here is a basic example of getting historical data using the python SDK.

Get historical data

from pprint import pprint
from datetime import datetime, timezone
from tickerdax.client import TickerDax

client = TickerDax()
pprint(client.get_route(
    route='predictions/ml-order-book-model-1',
    symbols=["BTC"],
    start=datetime.now(tz=timezone.utc),
    end=datetime.now(tz=timezone.utc)
))

Note that if this data doesn't exist in your cache, the data will be fetched from the REST API. All subsequent calls to the same data will only be from the cache and not the REST API. This is designed give you lighting fast responses and ultimately deliver data to you a cheaper cost.

Stream realtime data

This is how you can stream data to your cache. This will run indefinitely and fill your local cache as new data is available.

client.stream(
    routes={
        'predictions/ml-order-book-model-1': ['BTC', 'LTC'],
    },
)

In another process you can call client.get_route() as many times you like or whenever your app re-evaluates. The data will be available once it is updated by the stream.

CLI

The package also has a command line interface.

 _____  ___   ____  _  __ _____  ____   ____      _    __  __
|_   _||_ _| / ___|| |/ /| ____||  _ \ |  _ \    / \   \ \/ /
  | |   | | | |    | ' / |  _|  | |_) || | | |  / _ \   \  / 
  | |   | | | |___ | . \ | |___ |  _ < | |_| | / ___ \  /  \ 
  |_|  |___| \____||_|\_\|_____||_| \_\|____/ /_/   \_\/_/\_\
                                                             

                                                                                
 Usage: callback [OPTIONS] COMMAND [ARGS]...                                    
                                                                                
 TickerDax CLI 0.0.29. This tool interfaces with the tickerdax.com REST and     
 websockets APIs. Ithandles common data operations like batch downloading,      
 streaming, and caching datalocally to minimize network requests.               
                                                                                
โ•ญโ”€ Options โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ --version                                                                    โ”‚
โ”‚ --install-completion          Install completion for the current shell.      โ”‚
โ”‚ --show-completion             Show completion for the current shell, to copy โ”‚
โ”‚                               it or customize the installation.              โ”‚
โ”‚ --help                        Show this message and exit.                    โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€ Commands โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ create-config  Creates a new ticker dax config.                              โ”‚
โ”‚ download       Downloads data from the routes with the time interval         โ”‚
โ”‚                specified in your config.                                     โ”‚
โ”‚ list-routes    Lists all routes available to download or stream.             โ”‚
โ”‚ stream         Streams data from the routes specified in your config.        โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Environment Variables

Name Description
TICKERDAX_CONFIG A file path to the config file for the CLI.
TICKERDAX_EMAIL Your email linked to your tickerdax.com account.
TICKERDAX_REST_API_KEY Your REST API created with your tickerdax.com account.
TICKERDAX_WEBSOCKET_API_KEY Your websocket API created with your tickerdax.com account.
TICKERDAX_CACHE_ROOT An alternative persistent cache location on disk. By default this is written into a tickerdax_cache folder in your system's temp folder.
TICKERDAX_REDIS_SERVER_ADDRESS An alternative redis server address. Can be useful if redis is on another address besides localhost.
TICKERDAX_REDIS_SERVER_PORT An alternative redis server port. Can be useful if redis needs to user another port besides 6379.

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

tickerdax-0.0.29.tar.gz (17.1 kB view hashes)

Uploaded Source

Built Distribution

tickerdax-0.0.29-py3-none-any.whl (18.6 kB view hashes)

Uploaded Python 3

Supported by

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