Giter VIP home page Giter VIP logo

pyonvista's Introduction

pyOnvista

A tiny API for onvista.de financial website.

The API provides at a maximum all available chart data as can be viewed on the webpage. It does not scrap any recent quotes. So the prupose is to fetch historic quotes as can be viewed on the onvista chart diagrams.

The API core uses package requests to download contents. The implementation of requests is very flat without deeper exception handling.

It uses the super fast lxml binding to C libxml2 and libxslt instead of beautiful soup for html parsing. xpath are hardcoded but may be user defined at a later stage.

To get the quotes from the onvista server, the api first scraps some meta data of the instrument. This will be stored in a shelve database. The database can be access through the provided class InstrumentDatabase. This avoids traffic and complies with the typical user case. Once the metadata is known, the user can fetch the quotes from the server. These data is polled every time get_quotes is called. However, it is possible to use CachedRequest instead of Request classe you poll against an http cache stored locally after the first query.

Limitations

Does not work with ETFs or other Derivates. At the moment it does only support stocks.

Installation:

pip install pyonvista

Please note:

The API fakes a request from a chart shown on the instrument page. Therefore, the server sees only a normal user behavior like scrolling through the chart data. However, there may be a misalignment between notification_id and exchange (market). Because not all acronyms are provided yet or proper. See also markets.json. The API does not validate the market opening times as provided by onvista and market. It was not recognized why onvista provides this data with the quote data.

The server may mind the scrapping action when frequencies is high. It is recommended to use a rotating proxy, or at least rotate user agent and let pass plenty of time. Please keep also terms of webpage company in mind. This script may harm the terms.

Usage:

Preliminary you need to know the ISIN of the instrument. Create an instrument and request quote data by calling .get_quotes

from pyOnvista import Instrument, Request

# make a configured request. Provide a proper header
user_agent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0"
header = {'user-agent': user_agent}
request = Request(header=header)

# make the instrument you wish
vw = Instrument("DE0007664039", request)

# request quotes
quotes = vw.get_quotes("month")  # retrieve quotes from default market

# and do some stuff
for quote in quotes:
    print(quote.timestamp.isoformat(), " high: ", quote.high, " low: ", quote.low)

pyonvista's People

Contributors

cloasdata avatar

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.