PYPI PACKAGE AUDIT v2.1.4 Healthy Package

hyperdrive

An algorithmic trading platform

PyPkgScore hyperdrive
Methodology & Criteria โ™ฅ Donate
670 / 1000
Quick Install
pip install hyperdrive
1. Governance
50/200
2. PEP Metadata
150/200
3. Security
200/200
4. Docs & SEO
105/200
5. CI Engineering
165/200
๐Ÿ“ฃ Share Audit: Share this report and visual preview in the current language
Advertisement
PYPI TELEMETRY

Downloads & Community Adoption

Last 30 days (without mirrors)
Last 7 days
698
Last 30 days
977
Total (180 days)
1981
Metric / Ecosystem Status / Value Source
Downloads (30d / 180d) โ€” PyPI Stats (without mirrors)
Trusted Publishing (PEP 740) โœ“ Verified OIDC PyPI Integrity / Sigstore
Django Packages โ€” djangopackages.org
PyTech / PyPkgScore 670 / 1000 PyPkgScore Engine

Health & Engineering Analysis (5 Pillars)

1. Governance & Community50 / 200 โ–พ
LICENSEโœ“ 50 pts
SECURITY.mdโœ• 0 pts
CONTRIBUTING.mdโœ• 0 pts
CODE_OF_CONDUCT.mdโœ• 0 pts
2. PEP Metadata & Packaging150 / 200 โ–พ
Wheel (.whl)โœ“ 50 pts
pyproject.tomlโœ“ 50 pts
Project URLsโœ“ 50 pts
Trove Classifiersโœ• 0 pts
3. Security & Supply Chain200 / 200 โ–พ
Zero CVEs (OSV)โœ“ 60 pts
Trusted Publishing (OIDC)โœ“ 50 pts
Snyk / Audit Linkโœ“ 40 pts
HTTPS Repositoryโœ“ 50 pts
4. Documentation, SEO & Ecosystem105 / 200 โ–พ
Structured READMEโœ“ 60 pts
Read the Docsโœ• 0 pts
Django Packagesโœ• 0 pts
Website / Technical Articlesโœ“ 45 pts
5. Engineering, CI & Quality165 / 200 โ–พ
Automated Testsโœ“ 65 pts
GitHub Actions CIโœ“ 65 pts
CHANGELOG.mdโœ• 0 pts
Env & Lockfile (uv, Python-Pin)โœ“ 35 pts
Advertisement
README & DOCS

Official Documentation & Usage Guide โ€” hyperdrive

PyPI Metadata v2.1.4
Show full original documentation (English README) โ–พ

hyperdrive

hyperdrive: an algorithmic trading library

Release Pull Request PyPI version Python 3.11+ License: MIT Downloads

hyperdrive is an algorithmic trading library that powers quant research firm Algotrade.io.

Unlike other backtesting libraries, hyperdrive specializes in data collection and quantitative research.

โœจ Features

  • Data Collection: Aggregate market data from Polygon, Robinhood, and BLS
  • Cloud Storage: Seamless S3 integration for historical data
  • Backtesting: Strategy testing with vectorbt
  • AI/ML: Machine learning predictions with AutoGluon
  • Exchange Support: Trade on Binance, Alpaca, and Kraken
  • CI/CD Ready: GitHub Actions workflows for automated data updates

๐Ÿ’– Support

Love this tool? Your support means the world! โค๏ธ

๐Ÿ“ฆ Installation

PyPI (Recommended)

pip install hyperdrive -U

Or with uv:

uv pip install hyperdrive

From Source

Clone the repository and install in development mode:

git clone https://github.com/alkalescent/hyperdrive.git
cd hyperdrive
make install DEV=1  # Install with dev dependencies

๐Ÿš€ Examples

Most secrets must be passed as environment variables. Future updates will allow secrets to be passed directly into class objects (see example on order execution).

1. Storing data

Pre-requisites:

  • a Polygon API key
  • an AWS account and an S3 bucket

Environment Variables:

  • POLYGON
  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_DEFAULT_REGION
  • S3_BUCKET
from hyperdrive import DataSource
from DataSource import Polygon, MarketData

# Polygon API token loaded as an environment variable (os.environ['POLYGON'])

symbol = 'TSLA'
timeframe = '7d'

md = MarketData()
poly = Polygon()

poly.save_ohlc(symbol=symbol, timeframe=timeframe)
df = md.get_ohlc(symbol=symbol, timeframe=timeframe)

print(df)

Output:

           Time     Open       High      Low    Close       Vol
2863 2021-11-10  1010.41  1078.1000   987.31  1067.95  42802722
2864 2021-11-11  1102.77  1104.9700  1054.68  1063.51  22396568
2865 2021-11-12  1047.50  1054.5000  1019.20  1033.42  25573148
2866 2021-11-15  1017.63  1031.9800   978.60  1013.39  34775649
2867 2021-11-16  1003.31  1057.1999  1002.18  1054.73  26542359

2. Creating a model

Much of this code is still closed-source, but you can take a look at the Historian class in the History module for some ideas.

3. Backtesting a strategy

We use vectorbt to backtest strategies.

from hyperdrive import History, DataSource, Constants as C
from History import Historian
from DataSource import MarketData

hist = Historian()
md = MarketData()

symbol = 'TSLA'
timeframe = '1y'

df = md.get_ohlc(symbol=symbol, timeframe=timeframe)

holding = hist.from_holding(df[C.CLOSE])
signals = hist.get_optimal_signals(df[C.CLOSE])
my_strat = hist.from_signals(df[C.CLOSE], signals)

metrics = [
    'Total Return [%]', 'Benchmark Return [%]',
    'Max Drawdown [%]', 'Max Drawdown Duration',
    'Total Trades', 'Win Rate [%]', 'Avg Winning Trade [%]',
    'Avg Losing Trade [%]', 'Profit Factor',
    'Expectancy', 'Sharpe Ratio', 'Calmar Ratio',
    'Omega Ratio', 'Sortino Ratio'
]

holding_stats = holding.stats()[metrics]
my_strat_stats = my_strat.stats()[metrics]

print(f'Buy and Hold Strat\n{"-"*42}')
print(holding_stats)

print(f'My Strategy\n{"-"*42}')
print(my_strat_stats)

# holding.plot()
my_strat.plot()

Output:

Buy and Hold Strat
------------------------------------------
Total Return [%]                138.837436
Benchmark Return [%]            138.837436
Max Drawdown [%]                 36.246589
Max Drawdown Duration    186 days 00:00:00
Total Trades                             1
Win Rate [%]                           NaN
Avg Winning Trade [%]                  NaN
Avg Losing Trade [%]                   NaN
Profit Factor                          NaN
Expectancy                             NaN
Sharpe Ratio                      2.206485
Calmar Ratio                      6.977133
Omega Ratio                       1.381816
Sortino Ratio                     3.623509
Name: Close, dtype: object

My Strategy
------------------------------------------
Total Return [%]                364.275727
Benchmark Return [%]            138.837436
Max Drawdown [%]                  35.49422
Max Drawdown Duration    122 days 00:00:00
Total Trades                             6
Win Rate [%]                          80.0
Avg Winning Trade [%]            52.235227
Avg Losing Trade [%]             -3.933059
Profit Factor                     45.00258
Expectancy                      692.157004
Sharpe Ratio                      4.078172
Calmar Ratio                     23.220732
Omega Ratio                       2.098986
Sortino Ratio                     7.727806
Name: Close, dtype: object

4. Executing an order

Pre-requisites:

  • a Binance.US API key

Environment Variables:

  • BINANCE
from pprint import pprint
from hyperdrive import Exchange
from Exchange import Binance

# Binance API token loaded as an environment variable (os.environ['BINANCE'])

bn = Binance()

# use 45% of your USD account balance to buy BTC
order = bn.order('BTC', 'USD', 'BUY', 0.45)

pprint(order)

Output:

{'clientOrderId': '3cfyrJOSXqq6Zl1RJdeRRC',
 'cummulativeQuoteQty': 46.8315,
 'executedQty': 0.000757,
 'fills': [{'commission': '0.0500',
            'commissionAsset': 'USD',
            'price': '61864.6400',
            'qty': '0.00075700',
            'tradeId': 25803914}],
 'orderId': 714855908,
 'orderListId': -1,
 'origQty': 0.000757,
 'price': 0.0,
 'side': 'SELL',
 'status': 'FILLED',
 'symbol': 'BTCUSD',
 'timeInForce': 'GTC',
 'transactTime': 1637030680121,
 'type': 'MARKET'}

๐Ÿ—๏ธ Architecture

Project Structure

hyperdrive/
โ”œโ”€โ”€ hyperdrive/              # Core package
โ”‚   โ”œโ”€โ”€ DataSource.py       # Market data providers (Polygon, Robinhood)
โ”‚   โ”œโ”€โ”€ Exchange.py         # Trading integrations (Binance, Alpaca, Kraken)
โ”‚   โ”œโ”€โ”€ History.py          # Backtesting with vectorbt
โ”‚   โ”œโ”€โ”€ Precognition.py     # ML predictions with AutoGluon
โ”‚   โ”œโ”€โ”€ Storage.py          # S3 cloud storage
โ”‚   โ”œโ”€โ”€ Broker.py           # Order execution
โ”‚   โ”œโ”€โ”€ Constants.py        # Shared constants
โ”‚   โ””โ”€โ”€ _version.py         # Package version
โ”œโ”€โ”€ scripts/                 # Automation & data update scripts
โ”œโ”€โ”€ tests/                   # Unit and integration tests
โ”œโ”€โ”€ .github/workflows/       # CI/CD pipelines
โ”‚   โ”œโ”€โ”€ pr.yml              # PR checks + TestPyPI
โ”‚   โ”œโ”€โ”€ release.yml         # Release + PyPI
โ”‚   โ”œโ”€โ”€ test.yml            # Reusable test workflow
โ”‚   โ””โ”€โ”€ *.yml               # Data collection jobs
โ””โ”€โ”€ pyproject.toml          # Project configuration

End-to-End Flow

flowchart LR
    subgraph Data["๐Ÿ“Š Data Sources"]
        Polygon[Polygon API]
        RH[Robinhood]
        BLS[BLS API]
    end
    
    subgraph Core["๐Ÿ”ง hyperdrive"]
        DS[DataSource]
        S3[(S3 Storage)]
        Hist[History]
        ML[Precognition]
    end
    
    subgraph Trade["๐Ÿ’น Exchanges"]
        Binance[Binance]
        Alpaca[Alpaca]
        Kraken[Kraken]
    end
    
    subgraph CI["โš™๏ธ GitHub Actions"]
        Scheduled[Scheduled Jobs]
        PR[pr.yml]
        Release[release.yml]
    end
    
    Polygon --> DS
    RH --> DS
    BLS --> DS
    DS --> S3
    S3 --> Hist
    Hist --> ML
    ML --> Binance
    ML --> Alpaca
    ML --> Kraken
    Scheduled --> DS
    PR --> |TestPyPI| S3
    Release --> |PyPI| S3

๐Ÿงช Testing

Run the test suite:

make test

Run with coverage reporting:

make cov

Run smoke tests:

make smoke

๐Ÿ“Š Data Collection

Use the scripts provided in the scripts/ directory as a reference since they are actually used in production daily.

Available data collection workflows:

  • OHLC (from Polygon)
  • Intraday (from Polygon)
  • Dividends (from Polygon)
  • Splits (from Polygon)
  • Unemployment (from Bureau of Labor Statistics)

๐Ÿ“„ License

MIT License โ€” see LICENSE for details.