Git Product home page Git Product logo

dolarpy's Introduction

dolarPy

Checks USD/PYG exchange rate from several sites, with a calculator, RESTful API and a twitter bot

  • Scraper: Checks USD/PYG exchange rate from several sites every 10 minutes, saves the info in a json file
  • Webservice: Flask app to serve the API and display the main website with the calculator
  • TwitterBot: Reads the webservice output and tweet it(in a human readable format)

DEMO/Webservice

http://dolar.melizeche.com/api/1.0/

Twitter Bot

https://twitter.com/DolarPy

Mobile

API wrappers

Documentation in progress

Requirements

  • Python 2.7+ or 3.5+
  • BeautifulSoup4
  • Flask
  • Tweepy

Install

git clone [email protected]:melizeche/dolarPy.git
cd dolarPy
python3 -m venv env
# if venv module is not installed install with `sudo apt install python3-venv`
source env/bin/activate
pip install -r requirements.txt
crontab -e (add coti.py) // See example below
python cotiapp.py

On macOS High Sierra with python3 (also most linux distros)

# pip3 is installed with Python3
pip3 install virtualenv
# creating the virtualenv
virtualenv -p python3 env
# activate the virtualenv:
source env/bin/activate
pip3 install -r requirements.txt
# and the run
# if you need to deactivate the virtualenv:
deactivate

Crontab format and example

MIN HOUR DAYofMONTH MONTH DAYofWEEK PYTHONPATH SCRIPT

So for check/update the exchange rate every 10 minutes between 6am and 8pm on weekdays

*/10 6-20 * * 1-5 /apps/dolarPy/env/bin/python /apps/dolarPy/coti.py

And for tweet the exchange rate at 8am, 12pm and 6pm on weekdays

0 8,12,18 * * 1-5 /apps/dolarPy/env/bin/python /apps/dolarPy/single_tweet_bot.py

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

Contributors / Thanks

TODO(APIv2)

  • Better Documentation
  • Add more currencies
  • Databases support
  • Historical data API endpoint

License

This project is licensed under the Apache 2.0 License - see the LICENSE.txt file for details

dolarpy's People

Contributors

alcides29 avatar avolpe avatar berithpy avatar blasferna avatar cabupy avatar carloscarvallo avatar claspina avatar dependabot[bot] avatar diocaraballo avatar eduzetapy avatar garyservin avatar ivankoop avatar lucasginard avatar mariodot avatar matisanchez25 avatar mauri-medina avatar melizeche avatar nestorcde avatar padaleiana avatar snyk-bot avatar zv3 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  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  avatar  avatar  avatar  avatar

dolarpy's Issues

Interfisa cambio su modo de proveer cotizaciones

Anteriormente la página de interfisa retornaba la cotización diaria, en algun momento dado, dejaron de retornar la cotización actualizada y siempre retorna la misma (5750 y 5830).

Ahora al cargar la página hace otro request, a la url https://seguro.interfisa.com.py/rest/cotizaciones, la cual retorna un JSON con los valores actualizados, y actualiza los valores con js.

Basa api does not work

Describe the bug
basa api does not work. I've been testing for several days and it still doesn't work.

The bank's home page has a table with rates. I can make a scraper that returns the content.

Context

  • Website
  • API
  • other

Screenshots

image

Add databases support

Feature Request

Summary

Add database support, right now there's no historic data about the exchange rate

Basic example

Could be any SQL database but probably the best idea would be to use some ORM to support many databases at once, suggestions are welcome

Motivation

To eventually build graphs about the exchange rate evolution

Cards overlaps when resizing

Responsiveness issue, the "cards" overlaps in small screens

Expected Behavior

No overlap when resizing ¯_(ツ)_/¯

Current Behavior

dolarpy_rendering2

Replace Alberdi from tweets

Describe the bug
Since a while Alberdi exchange rate website is not working, so the bot tweets 0 as the exchange rate

Context

  • Website
  • API
  • other
    This has to be done in single_tweet_bot.py file

Expected behavior
Replace Alberdi with other exchange

Screenshots

image

Broken Exchanges Rates

Many exchanges have changed their websites or API endpoints, therefore breaking the scrapper.
The following exchanges need to be fixed.

  • Amambay (endpoint is now under bancobasa.com.py)
  • Cambios Alberdi (Their websocket is currently not displaying any rates)
  • Mundial (New website, need to rework the scrapper)

Context

  • Website
  • API
  • other

To Reproduce
Check the exchanges currently displaying 0 in their rates.

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.