Git Product home page Git Product logo

bitstampy's People

Contributors

gravengaard avatar johan-bjareholt avatar smileychris avatar unwitting 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitstampy's Issues

ImportError on Python 3.5

When trying to do 'from bistampy import api' i get 'ImportError: No module named calls'

A simple fix for this was to simply change the first line in api.py from 'import calls' to 'from . import calls'

unicode objects must be encoded

maybe it's just me but:
from bitstampy import api
c='999999'
k='xXx'
s=b'xXx'
api.account_balance(c, k, s)

and I get the error:
TypeError: Unicode-objects must be encoded before hashing
on pyhton 3.4

What type to use for client_id, api_key, api_secret

c = '12345'
k = 'xxxxx'
s = 'yyyyy'
api.account_balance(c, k, s)

~/.virtualenvs/bitstamp/lib/python3.6/site-packages/bitstampy/api.py in account_balance(client_id, api_key, api_secret)
     38 def account_balance(client_id, api_key, api_secret):
     39     return (
---> 40         calls.APIAccountBalanceCall(client_id, api_key, api_secret)
     41         .call()
     42     )

~/.virtualenvs/bitstamp/lib/python3.6/site-packages/bitstampy/calls.py in call(self, **params)
     79         message = nonce + self.client_id + self.api_key
     80         signature = hmac.new(
---> 81             self.api_secret, msg=message, digestmod=hashlib.sha256)
     82         signature = signature.hexdigest().upper()
     83         params.update({

~/.virtualenvs/bitstamp/lib/python3.6/hmac.py in new(key, msg, digestmod)
    142     method.
    143     """
--> 144     return HMAC(key, msg, digestmod)

~/.virtualenvs/bitstamp/lib/python3.6/hmac.py in __init__(self, key, msg, digestmod)
     40 
     41         if not isinstance(key, (bytes, bytearray)):
---> 42             raise TypeError("key: expected bytes or bytearray, but got %r" % type(key).__name__)
     43 
     44         if digestmod is None:

TypeError: key: expected bytes or bytearray, but got 'str'


Changed key to bytes :

k = b'xxxxx'
Then :

api.account_balance(c, k, s)

TypeError                                 Traceback (most recent call last)
<ipython-input-27-35f3ae0e7115> in <module>()
----> 1 api.account_balance(c, k, s)

~/.virtualenvs/bitstamp/lib/python3.6/site-packages/bitstampy/api.py in account_balance(client_id, api_key, api_secret)
     38 def account_balance(client_id, api_key, api_secret):
     39     return (
---> 40         calls.APIAccountBalanceCall(client_id, api_key, api_secret)
     41         .call()
     42     )

~/.virtualenvs/bitstamp/lib/python3.6/site-packages/bitstampy/calls.py in call(self, **params)
     77     def call(self, **params):
     78         nonce = self._get_nonce()
---> 79         message = nonce + self.client_id + self.api_key
     80         signature = hmac.new(
     81             self.api_secret, msg=message, digestmod=hashlib.sha256)

TypeError: must be str, not bytes

I am rather confused. Could you please clarify the argument types to use for client_id, api_key, api_secret ? Thanks

problem with bytes, bytearray ans str

Hi,
Tried to run the code on python3, and got this stacktrace. It appears to be a python3 compatability issue - the code runs perfectly on python2
Thankyou

Traceback (most recent call last):
File "tr5.py", line 158, in
bitstamp_USD_balance=bitstamp_balance(bs_c=bs_c, bs_k=bs_k, bs_s=bs_s, asset="usd_available")
File "tr5.py", line 61, in bitstamp_balance
bs_data=api.account_balance(bs_c, bs_k, bs_s)
File "/home/ubuntu/btc/installstuff/bitstampy/bitstampy/api.py", line 40, in account_balance
calls.APIAccountBalanceCall(client_id, api_key, api_secret)
File "/home/ubuntu/btc/installstuff/bitstampy/bitstampy/calls.py", line 81, in call
self.api_secret, msg=message, digestmod=hashlib.sha256)
File "/usr/lib/python3.4/hmac.py", line 144, in new
return HMAC(key, msg, digestmod)
File "/usr/lib/python3.4/hmac.py", line 42, in init
raise TypeError("key: expected bytes or bytearray, but got %r" % type(key).name)
TypeError: key: expected bytes or bytearray, but got 'str'

python3

Does this library support python3?

Getting "APIError: Invalid nonce"

Hi Jack

Thanks for the API!

I'm trying to do a buy limit order and I'm getting an error. Is this a problem with Bitstampy or just something that I'm doing wrong... sorry to post this here but I could not find your email address.

bitstamp.buy_limit_order(c, k, s, 0.01, ask * 1.10)

Traceback (most recent call last):
File "/Users/daniel/bitcoin/coinduit/bank/bank.py", line 17, in
bitstamp.buy_limit_order(c, k, s, 0.01, ask * 1.10)
File "/Library/Python/2.7/site-packages/bitstampy/api.py", line 62, in buy_limit_order
.call(amount=amount, price=price)
File "/Library/Python/2.7/site-packages/bitstampy/calls.py", line 86, in call
return super(APIPrivateCall, self).call(**params)
File "/Library/Python/2.7/site-packages/bitstampy/calls.py", line 57, in call
raise APIError(response['error'])
APIError: Invalid nonce

Is there something I need to do to set the nonce?

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.