Coder Social home page Coder Social logo

after-hours's Introduction

https://travis-ci.org/datawrestler/after-hours.svg?branch=master

Read me for afterhours package

Python module afterhours can retrieve pre-market and after-hours trading prices from Nasdaq for a given stock symbol

-Created by Jason Lewris

-License: The MIT License

-Developer Home Page: 'https://github.com/datawrestler'


Dependencies

  • Python (>=2.6 or >= 3.5)
  • beautifulsoup4 (>= 4.6.0)
  • requests (>= 2.18.4)
  • pandas (>= 0.20.3)
  • lxml (>= 4.1.0)

Valuable Links

Method Overview

Method Name Description
AH.getdata(datatype='highprice) Returns high market price
AH.getdata(datatype='lowprice') Returns low market price
AH.getdata(datatype='volume') Returns total market volume
AH.getdata(datatype='hightime') Returns datetime of high price
AH.getdata(datatype='lowtime') Returns datetime of low price
AH.getdata(datatype='mktclose') Returns market close price
AH.secure_all() Returns dataframe with all activity
AH.run_every() Updates all data points continuosly
Installation

Installation is done using pip install:

pip install afterhours

Alternative installation can be done by downloading the source files directly from github, navigating to the directory through terminal and running the following:

python setup.py install

Note

The source file can be downloaded here: https://github.com/datawrestler/after-hours/tarball/0.2.1

After installation, the package is ready for use. Simply import it into your python script with the following:

from afterhours.afterhours import AfterHours

Source

The latest source code can be checked out with the following command:

git clone https://github.com/datawrestler/after-hours.git

Examples

from afterhours.afterhours import AfterHours

# AFTER HOURS TRADING DATA
AH = AfterHours('aapl', typeof = 'after')

# get the low price from after hours trading
print(AH.getdata(datatype='lowprice'))
# 102.18

# get the high price of after hours trading
print(AH.getdata(datatype='highprice'))
# 109.055

# get the timestamp of after hours high trade
print(AH.getdata(datatype='hightime'))
# '12/15/2017 18:58:46 PM'

print(AH.getdata(datatype='lowtime'))
# '12/15/2017 19:58:46 PM'

# get all data points for after hours trading
print(AH.secure_all())
# Pandas DataFrame

# PRE HOURS TRADING DATA
# get pre hours trading info for apple
AH = AfterHours('aapl', typeof='pre')

# get the low price from pre hours trading
print(AH.getdata(datatype='lowprice'))
# 102.18

# get the high price from pre hours trading
print(AH.getdata(datatype='highprice'))
# 109.055

# get the timestamp for lowest trade
print(AH.getdata(datatype='lowtime'))
# '12/15/2017 18:58:46 PM'

# get the timestamp for highest time trade
print(AH.getdata(datatype='hightime'))
# '12/15/2017 19:58:46 PM'

# secure all pre hours trading data
print(AH.secure_all())
# Pandas DataFrame

Please add any questions, comments, concerns to the issues tab on Github for the project! I look forward to seeing this package built out further in future releases.

after-hours's People

Contributors

datawrestler avatar dependabot[bot] avatar marcus-rosti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

after-hours's Issues

Is this module still working?

Hi, I wonder if the module is still working?
I am trying to install the package using pip3 install afterhours, and the package is installed and I can tell that by the message in the console "Requirement already satisfied: afterhours in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (0.2.1)"
However, when I tried to import the module by from afterhours.afterhours import AfterHours, python complains "ModuleNotFoundError: No module named 'afterhours'". BTW, I am usnig python 3.8
Thanks.

Automated testing

You should checkout out using https://travis-ci.org/ to do automated testing. Whenever you commit changes to code, it runs tests and can send an email if something fails. It can be a little tricky making sure the test server has the right dependencies though. Or least I had trouble doing that in python.

can't install it for python 3.9

trying the pip install afterhours command on my terminal (Mac)
but when I try to use it python says candy find the module.
any help? is this abandoned project ? someone knows alternatives ?

Historical data

I just started using this, great work. I am wondering if there is any way to get historical data, for example if I could get a data frame with a week's worth of after hours trading data for AAPL or whatever.

Is this still working?

For some reason I pip install it fine, but it says the no module named afterhours.

Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.