Pandas wrapper for ActiveTick HTTP Proxy
Project description
activetick_http
Python module that connects to ActiveTick HTTP proxy and supplies Pandas DataFrames. Requires requests for the quoteStream, and redis for caching.
Currently unstable, may end up changing the methods from camelCase to pep8 snake_case.
tests run using pytest
How to use:
Run the HTTP proxy supplied by ActiveTick and instantiate ActiveTick, the defaults are shown with a Redis cache enabled:
from activetick_http import ActiveTick # Import the StrictRedis client to enable local persistent caching from redis import StrictRedis # ActiveTick initialized with Redis caching enabled (requires Redis) at = ActiveTick(host='127.0.0.1', port=5000, cache=StrictRedis(host='127.0.0.1'))
>From the ActiveTick instance we have access to all the functionality provided by the HTTP proxy with the following methods:
quoteData
quoteData(symbols, fields)
Returns instantaneous quote information (fields) on symbols check quote_fields.py for available options.:
fields = ['LastPrice', 'BidPrice', 'AskPrice'] df = at.quoteData(('SPY', 'TLT', 'TVIX'), fields) print(df[fields].head())
LastPrice |
BidPrice |
AskPrice |
|
---|---|---|---|
SPY |
216.3 |
216.46 |
216.55 |
TLT |
137.51 |
137.02 |
137.5 |
TVIX |
18.15 |
18.2 |
18.25 |
quoteStream
quoteStream(symbols)
Returns a live updated quote stream iterator:
stream = at.quoteStream(('NUGT','DUST')) for tick in stream: print(tick)
TODO: example df
barData
barData(symbol, historyType='I', intradayMinutes=60, beginTime=datetime, endTime=datetime)
Returns OHLCV data for singular symbol:
df = at.barData('INTC', historyType='I', beginTime=datetime(datetime.now().year, 9, 27)) print(df.head())
open |
high |
low |
close |
volume |
|
---|---|---|---|---|---|
2016-09-28 09:00:00 |
37.52 |
37.52 |
37.25 |
37.395 |
1.79294e+06 |
2016-09-28 10:00:00 |
37.4 |
37.46 |
37.27 |
37.31 |
1.59818e+06 |
2016-09-28 11:00:00 |
37.31 |
37.32 |
37.15 |
37.28 |
1.32702e+06 |
2016-09-28 12:00:00 |
37.28 |
37.32 |
37.2 |
37.27 |
2.39398e+06 |
2016-09-28 13:00:00 |
37.275 |
37.39 |
37.22 |
37.37 |
1.23249e+06 |
tickData
tickData(symbol, trades=False, quotes=True, beginTime=datetime, endTime=dateime) Returns historical tick level quote and trade data for a symbol:
df = at.tickData('GDX', trades=True, quotes=False) print(df.head())
type |
last |
lastz |
lastx |
cond1 |
cond2 |
cond3 |
cond4 |
|
---|---|---|---|---|---|---|---|---|
2016-09-28 09:30:00.091000 |
T |
26.27 |
52073 |
P |
0 |
0 |
17 |
0 |
2016-09-28 09:30:00.091000 |
T |
26.27 |
52073 |
P |
16 |
0 |
0 |
0 |
2016-09-28 09:30:00.182000 |
T |
26.25 |
211 |
T |
0 |
12 |
0 |
0 |
2016-09-28 09:30:00.184000 |
T |
26.25 |
89 |
T |
37 |
12 |
14 |
0 |
2016-09-28 09:30:00.185000 |
T |
26.25 |
500 |
T |
0 |
12 |
14 |
0 |
optionChain
optionChain(symbol)
Returns the symbols making up the optionchain for the underlying:
df = at.optionChain('SPY') print(df.head())
0 |
OPTION:SPY—161014P00186000 |
1 |
OPTION:SPY—161012C00197000 |
2 |
OPTION:SPY—161014C00187000 |
3 |
OPTION:SPY—161014P00192000 |
4 |
OPTION:SPY—161012P00193000 |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file activetick_http-0.12.1-py3-none-any.whl
.
File metadata
- Download URL: activetick_http-0.12.1-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6228a2eb38df439e3388862200fe168b6f0904cc88949f2c5e5d06ae10d55b81 |
|
MD5 | 88ab974b0e0cfff7892793a4a55ab379 |
|
BLAKE2b-256 | 041ef8b5e5412cf5c79bc0d59f523b972e8faa31538aa3bff8255d6109fe72c6 |
File details
Details for the file activetick_http-0.12.1-py2.py3-none-any.whl
.
File metadata
- Download URL: activetick_http-0.12.1-py2.py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65574f96fe8b217fe0a0ad43da9d7c5070197243dd35cf8364e6a800ac7dd89d |
|
MD5 | fc05f15045eb4273f70b21ad76564167 |
|
BLAKE2b-256 | 5b671798e8ceb6c37dc32b8e186659fb6075dd16e5f86b1a0ef0c0f0fdb9b89a |