Giter VIP home page Giter VIP logo

bitcoin-price-api's People

Contributors

dursk avatar g-p-g avatar joequant avatar sathoro 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  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  avatar  avatar

bitcoin-price-api's Issues

CoinDesk returns comma in price when over 1000USD

Just noticed this error when calling CoinDesk().get_current_price() as the price is now over 1,000 USD:

decimal.InvalidOperation: Invalid literal for Decimal: u'1,004.8813'

Wrapping coindesk.py line 14 in a str().replace() as such seems to resolve.

        price = data['bpi'][currency]['rate']

becomes

        price = str(data['bpi'][currency]['rate']).replace(',', '')

Might have to do on the rest of the price functions as well?

New to Python and GitHub in general so didn't actually fork and try to submit a PR.

.get_current_ask() Traceback NameError: name 'self' is not defined

In [1]: from exchanges.bitfinex import Bitfinex

In [2]: Bitfinex().get_current_bid()
Out[2]: Decimal('9593.8')

In [4]: Bitfinex().get_current_price()
Out[4]: Decimal('9592.3')

In [5]: Bitfinex().get_current_bid()
Out[5]: Decimal('9591.1')

In [6]: Bitfinex().get_current_ask()

NameError Traceback (most recent call last)
in
----> 1 Bitfinex().get_current_ask()

/usr/local/lib/python3.7/site-packages/exchanges/base.py in get_current_ask(cls)
74
75 def get_current_ask(cls):
---> 76 self.get_data()
77 price = self._current_ask_extractor(self.data)
78 return Decimal(price)

NameError: name 'self' is not defined

dead simple example of price monitor with notifications.

Not actually an issue. Just thought I'd share. If you think its alright, please use it or your revision of it in README/example. Thanks for sharing your module, very convenient.

#!/usr/bin/python
from sys import argv
from subprocess import check_output
from exchanges.bitfinex import Bitfinex
from time import sleep
above = 11900
below = 11450

def get_price():
    try:
        price = int(Bitfinex().get_current_price())
    except:
        price = 0
    return(price)

while True:
    print("Checking price...")
    price = get_price()
    print("----------------- "+str(price))

    if price > above:
        tmp = check_output('notify-send "BTC price is ABOVE '+str(above)+'" -u critical -t 9999999',shell=True, universal_newlines=True)

    if price < below and price != 0:
        tmp = check_output('notify-send "BTC price is BELOW '+str(below)+'" -u critical -t 9999999',shell=True, universal_newlines=True)

    sleep(35)

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.