Skip to main content

Stock AI

PyPI version Build Status

Python module to get stock data from Yahoo! Finance

This is an ongoing project. If you have any requests or contributions, please create a ticket

Install

From PyPI with pip

pip install stockai

Development

Create a virtual environment

python3 -m venv venv
source env/bin/activate

pip3 install -r requirements.txt

For MacOS, you may need to use this command in order to install ciso8601

ARCHFLAGS="-arch x86_64" pip install ciso8601

Running Tests

python -m unittest tests/*

Running Jupyter Notebook

pip install jupyter
jupyter notebook

Usage examples

from stockai import Stock
td = Stock('TD.TO')

print(td.get_summary_profile())
print(td.get_price())
print(td.get_currency())

Get Historical Prices

### The date format should be yyyy-mm-dd
td.get_historical_prices('2019-01-01', '2019-01-05')

### The result is a dictionary with ['volumn', 'low', 'open', 'hight', 'close', 'date', 'adjclose']
{
   'volume':[
      3930300,
      5407700,
      5103400
   ],
   'low':[
      67.12000274658203,
      67.12000274658203,
      67.66999816894531
   ],
   'open':[
      67.51000213623047,
      68.11000061035156,
      68.0
   ],
   'high':[
      68.43000030517578,
      68.11000061035156,
      68.1500015258789
   ],
   'close':[
      68.25,
      67.30000305175781,
      67.9800033569336
   ],
   'date':[
      1546439400,
      1546525800,
      1546612200
   ],
   'adjclose':[
      67.57575225830078,
      66.63513946533203,
      67.30841827392578
   ]
}

Disclaimer

This project is for learning purpose. This is not intended to be investment advice for trading purposes.

  • USE AT YOUR OWN RISK.
  • DO NOT LEVERAGE THIS IN ATTEMPT TO DISRUPT ORDERLY MARKET FUNCTIONS.

Metadata

Release files for stockai 1.5.0

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

Source distribution (sdist)

Source distribution for stockai 1.5.0
File Size Uploaded
stockai-1.5.0.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stockai 1.5.0
File Interpreter ABI Platform
stockai-1.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.3 kB

Release files / stockai-1.5.0.tar.gz

Download URL stockai-1.5.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bfb7914bbb5c0a825f2d3cdf638870488b408153b7be072074537e78cbbae75e
BLAKE2b-256 checksum
How to use checksums
c37f611b2e1c58b245c677ce7be4e538aa4991f0f0515f0da670ad7cfdb0aae1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.2

Release files / stockai-1.5.0-py3-none-any.whl

Download URL stockai-1.5.0-py3-none-any.whl
Size 19.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36581236da29e9bfb18a106d26d03ce913e3399a3cf940c0445817e29dc37efe
BLAKE2b-256 checksum
How to use checksums
df6d337be5734499fde44512b764e5de56194f89f0f3df0dc0d5f58380d12d76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

1.5.0 This release

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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