Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A small example package

Project description

Chaintrail API Wrapper

Installation

pip3 install chaintrailapi

Import and use the package as demonstrated in example.py below:

from chaintrailapi import ChainTrail, Accounts, Dataset
import matplotlib.pyplot as plt

api = ChainTrail("localhost:3000", Dataset.JAN_2019)

account_data = api.get_accounts(['acct_address'])
account_scaled = api.get_accounts(['tx_count','avg_tx_in','avg_tx_out','std_tx_in','std_tx_out']).get_scaled()

print(account_scaled.shape)

pcadata = ChainTrail.calculate_pca(account_scaled, components=2)
inliers, outliers, xx, yy, z_train = ChainTrail.predict_outliers(pcadata)

# plot the training points
plt.contour(xx,yy,z_train, levels=[0], linewidths=2, colors='darkred')
plt.scatter(pcadata[inliers,0], pcadata[inliers,1], color='blue', alpha=0.2)
plt.scatter(pcadata[outliers,0], pcadata[outliers,1], color='red', alpha=0.4)
plt.show()

Project details


Download files

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

Files for chaintrailapi, version 0.0.6
Filename, size File type Python version Upload date Hashes
Filename, size chaintrailapi-0.0.6-py3-none-any.whl (4.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size chaintrailapi-0.0.6.tar.gz (2.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page