Skip to main content

Hello, welcome to tradingalgorithm, a Python package for easy algorithmic trading on Alpaca

This package allows one to check account status, make long orders, make short orders, run a custom momentum-based algorithm, and automatically calculate the best tickers to trade in the S&P500 based off of probability of returns and betas.

To run this package, you will need an IEX Finance key, as well as an Alpaca API key

To install the algorithm:

$ pip install alpaca-trading-algorithm

To pick a stock ticker:

from alpaca_trading_algorithm import tickerpicker

ticker = tickerpicker.tickerpicker()

To create a stock class:

from alpaca_trading_algorithm import trader

ticker = 'AAPL'

aapl = trader.stock(alpacaKey, alpacaSecretKey, iexKey, ticker)

Methods in the class:

aapl.position()
# output: Number of shares:  
#         Market Value: 
#         Profit/Loss: 

aapl.checkhours()
# output: The market is (open or close)

Returns maximum amount of shares that you can trade of the ticker based on market value of cash portfolio

aapl.max_shares()

Takes AAPL (or chosen ticker) long at the current market price and specified share amount

aapl.longmarket(shares)

Takes AAPL (or chosen ticker) long at the current close of the stock

aapl.longlimit(shares)

Takes AAPL (or chosen ticker) short at the current market price

aapl.short(shares)

Closes entire short or long position in AAPL (or chosen ticker) based on whether you specify "long" or "short" as the typetoclose

aapl.closeposition(typetoclose)

Runs a momentum algorithm ONE TIME based on volume and time&sales, will take a stock short, long, close position, re-position, and employs a custom stop-loss

aapl.algo()

Runs the same momentum algorithm CONTINUOUSLY for the set amount of minutes

aapl.trade(minutes)

Metadata

Release files for alpaca-trading-algorithm 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alpaca-trading-algorithm 0.0.5
File Size Uploaded Provenance Actions
alpaca_trading_algorithm-0.0.5.tar.gz 13.1 kB Without provenance Details for alpaca_trading_algorithm-0.0.5.tar.gz

Release files / alpaca_trading_algorithm-0.0.5.tar.gz

Download URL alpaca_trading_algorithm-0.0.5.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ebf706d0835022a4555640a756cdb21d248f601aa895aa70ccc4cd8d3d0b3fca
BLAKE2b-256 checksum
How to use checksums
27745fb924a5609b487a87635681fa915e8bdd6dd084c732185f9f82bf45ee28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.7.4

Security for alpaca-trading-algorithm 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page