Skip to main content

Financial Python. Using python to do stock analysis.

Project description

finpy

Financial Python

To install

Requirement: Python 3

pip install finpy

You can also download the window install package if you're using windows. Introduction

I plan to expand the capabilities. Please let me know if you have any suggestions. You can reach me at blacksburg98 (at) yahoo dot com

I've tried to use docstring as much as possible, so you can try these commands in python shell to get more information.

:: from finpy.utils import get_tickdata from finpy.equity import Equity help(Equity) from finpy.portfolio import Portfolio help(Portfolio)

Please go to https://github.com/blacksburg98/finpy to file a issue if you have any problems.

Recommend: This will be the area where the downloaded stock data are stored.

setenv FINPYDATA ~/stock_data

Tutorial 1

::

"""
Tutorial 1 
Load stock data and print 
"""
import matplotlib
matplotlib.use('Agg') # fix for matplotlib under multiprocessing
import matplotlib.pyplot as plt
import matplotlib.dates as mdates 
import datetime as dt
from finpy.utils import get_tickdata

import finpy.fpdateutil as du
if __name__ == '__main__':
    dt_timeofday = dt.timedelta(hours=16)
    dt_start = dt.datetime(2010, 1, 1)
    dt_end = dt.datetime(2010, 12, 31)
    ls_symbols = ['AAPL','GOOG', 'IBM', 'MSFT']
    ldt_timestamps = du.getNYSEdays(dt_start, dt_end, dt_timeofday)
    all_stocks = get_tickdata(ls_symbols=ls_symbols, ldt_timestamps=ldt_timestamps)
    fig = plt.figure()
    ax = fig.add_subplot(111)
    for tick in ls_symbols:
        ax.plot(ldt_timestamps, all_stocks[tick].normalized())
    legend = ls_symbols
    ax.legend(legend, loc=2)
    fig.autofmt_xdate()
    svg_file = 'tutorial1.pdf'
    fig.savefig(svg_file)

Project details


Download files

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

Source Distribution

FinPy-0.61.tar.gz (71.5 kB view details)

Uploaded Source

File details

Details for the file FinPy-0.61.tar.gz.

File metadata

  • Download URL: FinPy-0.61.tar.gz
  • Upload date:
  • Size: 71.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.9

File hashes

Hashes for FinPy-0.61.tar.gz
Algorithm Hash digest
SHA256 388172dae02c069ac308887cf360915e6b82c8d4a61145e02599b1ca91b1aa6a
MD5 b0c8a3f4f37706f38485a967d4002368
BLAKE2b-256 f2bd29d2a4461fd69c0f65fc50fc0a3ccee493e8a0255acb10bc92a97c34cfd4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page