kmadac / bitstamp-python-client Goto Github PK
View Code? Open in Web Editor NEWPython package to communicate with bitstamp.net
License: MIT License
Python package to communicate with bitstamp.net
License: MIT License
you can add limit_price to buy_limit_order adding: limit_price to the params list of the function and
modifying the data as below:
data = {'amount': amount, 'price': price, 'limit_price': limit_price}
it works perfectly,
bye
V2 of the Bitstamp API has the option of specifying that the buy_limit_order
or sell_limit_order
can be a daily_order
(self cancelling at 00:00 UTC).
Would it be possible to add this in the same way as limit_price
is defined?
From Bitstamp API documentation:
daily_order(Optional) | Opens buy limit order which will be canceled at 0:00 UTC unless it already has been executed. Possible value: True
I'll try to submit a PR for this soon (similar to #30)
Hello,
I've the following error while I'm calling bitcoin_withdrawal method as follow
Traceback (most recent call last):
File "/home/pi/Bitstamp_Test.py", line 25, in
trading_client.bitcoin_withdrawal('0.00200000', bitcoin_withdrawal_address)
File "/usr/local/lib/python2.7/dist-packages/bitstamp/client.py", line 259, i$
return self._expect_true(response)
File "/usr/local/lib/python2.7/dist-packages/bitstamp/client.py", line 163, i$
raise BitstampError("Unexpected response")
BitstampError: Unexpected response
The withdrawal is accepted by bitstamp but there is this error message "Unexpected response".
Thank you for solving the issue,
Arnaud
Getting the bid Price of BTC witth "public_client.ticker()['bid']" works fine, how can i get the prices of ETH for example?
Bitstamp API seems to refuse requests without user-agent.
I added a fake user-agent around here to make it work again:
bitstamp-python-client/bitstamp/client.py
Line 80 in 35b9a61
Example:
kwargs['headers'] = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36'
}
When i let my script run it works fine for like 2-3 minutes, then it stops giving me this error. Could not find anything in the Documentation.
Traceback (most recent call last):
File "C:\Users\Stefan\Desktop\btc.py", line 15, in
ethusdbid = float(public_client.ticker(base='eth')['bid'])
File "C:\Users\Stefan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\bitstamp\client.py", line 111, in ticker
return self._get(url, return_json=True, version=2)
File "C:\Users\Stefan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\bitstamp\client.py", line 39, in _get
return self._request(requests.get, *args, **kwargs)
File "C:\Users\Stefan\AppData\Local\Programs\Python\Python37-32\lib\site-packages\bitstamp\client.py", line 98, in _request
"Could not decode json for: " + response.text)
bitstamp.client.BitstampError: Could not decode json for:
Could we get this API call (and maybe "withdrawal status" and "cancel withdrawal") added to the client? Would be nice to have.
Hi, I noticed that this module doesn't contain the API v2 requests XRP withdrawal and XRP deposit (this is different from the Ripple withdrawal). It would be great if this could be added!
'
The bitstamp API authenticates but has no integrity check built in, thus relying on SSL to provide integrity. However with Python, and its default-cert-checking-off ( http://lwn.net/Articles/582065 ), the Python client is vulnerable to MMAs.
http://stackoverflow.com/questions/1087227/validate-ssl-certificates-with-python has some general hints but since you are using requests http://www.python-requests.org/en/latest/user/advanced/#ssl-cert-verification verify=True + a custom CA_BUNDLE containing just the Bitstamp cert seems like a good solution.
I am installing as python3 lib and get a syntaxt error. Is this module suited for python3?
sudo pip install git+git://github.com/kmadac/bitstamp-python-client.git
Downloading/unpacking git+git://github.com/kmadac/bitstamp-python-client.git
Cloning git://github.com/kmadac/bitstamp-python-client.git to /tmp/pip-2txc1a-build
Running setup.py egg_info for package from git+git://github.com/kmadac/bitstamp-python-client.git
Installing collected packages: TradingBitStamp
Running setup.py install for TradingBitStamp
File "/usr/local/lib/python3.2/dist-packages/bitstamp/client.py", line 158
if r.text == u'true':
^
SyntaxError: invalid syntax
Successfully installed TradingBitStamp
Cleaning up...
I'm getting 500 Server Error when using unconfirmed_bitcoin_deposits and there is one unconfirmed deposit:
File "bitstamp-python-client/bitstamp/client.py", line 294, in unconfirmed_bitcoin_deposits
r.raise_for_status()
File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 683, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: INTERNAL SERVER ERROR
No errors when no unconfirmed deposits. Is it a problem with this code or in Bitstamp?
I'm receiving Invalid Signature error when I used any call from Trading class even my authorization data are correct.
BSD? MIT? GPL?
I recommend one of the first two ;)
Hi, Is there any easy way to track more than one channel?
I mean track not only 'order_book' but
'order_book' + 'order_book_ethusd' ?
Thanks.
I am making ticker calls to bitstamp through your method ticker() but some times bitstamp returns a null.
It appears that the raise BitstampError causes my code to halt. Here's my snippet and hoping to have a better understanding:
while bitstamp_ltcbtc == None:
try:
bitstamp_ltcbtc = bitstampz.ticker(base='ltc', quote='btc')
#print(bitstamp_ltcbtc)
except ValueError:
print("error at", json.JSONDecodeError)
continue
The json_response is none
I tried to catch the error by using a
try
except bitstampz.BitstampError
but only to be caught with AttributeError: 'Trading' object has no attribute 'BitstampError' ...
I would like to do a retry if it failed but not sure how to do so
Traceback (most recent call last):
File "", line 4, in
bitstamp_ltcbtc = bitstampz.ticker(base='ltc', quote='btc')
File "H:\Anaconda\Anaconda3\lib\site-packages\bitstamp\client.py", line 111, in ticker
return self._get(url, return_json=True, version=2)
File "H:\Anaconda\Anaconda3\lib\site-packages\bitstamp\client.py", line 39, in _get
return self._request(requests.get, *args, **kwargs)
File "H:\Anaconda\Anaconda3\lib\site-packages\bitstamp\client.py", line 98, in _request
# "Could not decode json for: " + response.text)
BitstampError: Could not decode json for:
Getting Module error
[root@docker ~]# pip3.6 freeze
BitstampClient==2.2.0
certifi==2017.11.5
chardet==3.0.4
decorator==4.1.2
idna==2.6
ipython==6.2.1
ipython-genutils==0.2.0
jedi==0.11.0
parso==0.1.0
pexpect==4.3.0
pickleshare==0.7.4
prompt-toolkit==1.0.15
ptyprocess==0.5.2
Pygments==2.2.0
requests==2.18.4
simplegeneric==0.8.1
six==1.11.0
traitlets==4.3.2
urllib3==1.22
wcwidth==0.1.7
[root@docker ~]#
Traceback (most recent call last):
File "./bitstamp.py", line 4, in
import bitstamp.client
File "/root/bitstamp.py", line 4, in
import bitstamp.client
ModuleNotFoundError: No module named 'bitstamp.client'; 'bitstamp' is not a package
[root@docker ~]#
I need to have the balance in FloatType (to make algebric operations) but I can not convert it with float() function because it is NoneType... how can I do?
I'm to much of a python noob to have to confidence to submit a patch but cancel_order does not seem to be working correctly
I changed the code from:
response = requests.post("cancel_order/", data=data)
return self._expect_true(response)
to:
return self._post("cancel_order/", data=data).json()
To make it look like the code in the other methods and that seemed to have fixed it.
The public API tests fail for me:
$ python public_client.py
E.{u'sell': u'1.3629', u'buy': u'1.3740'}
{u'timestamp': u'1390948125', u'bids': [[u'796.01', u'3.27353428'], [u'796.00', u'0.09854665'], [u'795.76', u'0.08796622'], [u'795.51', u'0.05028221'], [u'795.01', u'0.05660306'], [u'795.00', u'0.09867060'], [u'794.76', u'0.06291207'], [u'794.00', u'0.09879487'], [u'793.00', u'0.09891946'], [u'792.39', u'0.03700000'], [u'792.35', u'5.90000000'], [u'792.34', u'2.00000000'], [u'792.30',
[I skipped lots of lines]
e': u'791.54', u'amount': u'0.07650000'}, {u'date': u'1390944620', u'tid': 3266288, u'price': u'791.38', u'amount': u'0.19043545'}, {u'date': u'1390944608', u'tid': 3266287, u'price': u'791.38', u'amount': u'0.10100000'}.
======================================================================
ERROR: test_bitinstant_reserves (__main__.bitstamp_public_TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "public_client.py", line 27, in test_bitinstant_reserves
bitinstant_reserves = self.client.bitinstant_reserves()
File "/nh/nest/u/ondrej/repos/hashstack2/x2/lib/python2.7/site-packages/bitstamp/client.py", line 56, in bitinstant_reserves
r.raise_for_status()
File "/nh/nest/u/ondrej/repos/hashstack2/x2/lib/python2.7/site-packages/requests/models.py", line 773, in raise_for_status
raise HTTPError(http_error_msg, response=self)
HTTPError: 404 Client Error: NOT FOUND
----------------------------------------------------------------------
Ran 5 tests in 6.071s
FAILED (errors=1)
API v1 authentication and v1 endpoints are being deprecated and are no longer documented on this page. For now you can still access API v1 documentation [here](https://www.bitstamp.net/api-deprecated/)[](https://www.bitstamp.net/api/#top).
This library uses the v1 of the bitmap API, please account for this when using it.
I couldnt find it in documention. If so please guide
Hello,
I posted the question on stackoverflow, but I am getting the following error when using a valid user/key/secret.
http://stackoverflow.com/questions/24285109/python-bitstamp-api-invalid-nonce-error
Unsure what I can do to solve this or what I have done wrong. Please let me know if this is a bug or not as I would love to get it solved. Happy to contribute in modifying the code, but unsure why this is occurring.
This login was working up until it sporadically stopped working yesterday evening.
I am calling the transfer_to_main function with
trading_client.transfer_to_main(0.05,"ltc")
Yet I get the following error:
root@XXX:~# python test3.py
.Traceback (most recent call last):
File "test3.py", line 34, in process_withdrawals
trading_client.transfer_to_main(0.05,"ltc")
File "/root/anaconda3/lib/python3.6/site-packages/bitstamp/bitstampclienttest.py", line 403, in transfer_to_main
version=2)
File "/root/anaconda3/lib/python3.6/site-packages/bitstamp/bitstampclienttest.py", line 48, in _post
return self._request(requests.post, *args, **kwargs)
File "/root/anaconda3/lib/python3.6/site-packages/bitstamp/bitstampclienttest.py", line 93, in _request
raise BitstampError(json_response.get('reason'))
bitstamp.bitstampclienttest.BitstampError: Invalid parameters
What am I doing wrong?
Thanks!
Currently, the 'transactions' query only supports the 'time' parameter with 'minute' or 'hour' value:
Params:
time - time frame for transaction export ("minute" - 1 minute, "hour" - 1 hour). Default: hour.
I prefer that released packages live on PYPI rather than rely on just Github.
when i place a limit order, I sometimes , the order status is "In queue", which lasts for several seconds. And then, it becomes 'open', whats is the meaning of "in queue"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.