Git Product home page Git Product logo

yoc's Introduction

yoc (yahoo option chains)

version 2, works with yahoo.com website design since July 2016.

Quick start

yahoo_options.py is a command line tool for scraping financial options prices and related data from finance.yahoo.com

It's written in Python 2.7 and also ported to Python 3.4 using 2to3 tool.

It can be used to scrape current options data for one or more tickers.

There are several ways to supply list of tickers (in order of priority):

-as command line arguments

-using config.ini file

-as user input during script execution.

Sample config.ini is included.

Here is an example how to supply list of tickers as command-line arguments:

C:>yahoo_options.py googl yhoo

If no command line arguments were supplied, user will be asked to enter one or more tickers separated by comma.

Enter ticker or tickers, separated by comma: googl,yhoo

Downloaded data are stored as a csv file, one file for each ticker. If file already exists, it will append the new data.

Advanced usage

In ver.2 it requests and gets response in json format. See included json_response_GOOGL.json for sample of the json response. As you can see there are a lot more data available. One can easily change the script to parse the json and extract any of these data. All you need to do is to amend the get_json_data() to return the desired data. Eventually you will need to change slightly also the main function.

yoc's People

Contributors

boyank avatar hamannju 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

Watchers

 avatar  avatar  avatar  avatar  avatar

yoc's Issues

Support for Python 3

Hi, in the method get_json_data you should use:

chain_json = json.loads(urllib.request.urlopen(url).read().decode('utf-8'))

instead of

chain_json = json.load(urllib.request.urlopen(url))

to work properly in Python 3.5.

Cheers,

Peter

TODO: add support for lxml parser if installed.

In BeaustifulSoup 4.4. UserWarning was added when no parser is specified when BeautifulSoup object is created. Currently fixed using default html.parser. I plan to add support for better lxml parser if isntalled.

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.