trade_with_bitstamp.com_api
This is an old revision of the document!
```python
import time import hmac, hashlib import requests
def sign():
user = '' # username @ Bitstamp key = '' # API key secret = '' # API secret now = time.strftime("%s") message = now + user + key signature = hmac.new(secret.encode(),message.encode(),hashlib.sha256).hexdigest().upper() return {'key':key,'signature':signature,'nonce':now}
uri = “https://www.bitstamp.net/api/v2/”
# public requests
requests.get(uri + 'ticker/btceur').json() requests.get(uri + 'ohlc/btceur', {'limit': 1000, 'step': 3600}).json()
# private requests
requests.post(uri + 'balance/btceur/', sign()).json() requests.post(uri + 'buy/instant/btceur/', {sign(), 'amount': 10}).json() # amount in EUR requests.post(uri + 'cancel_order/', {sign(), 'id': order_id}).json() ```
trade_with_bitstamp.com_api.1723861376.txt.gz · Last modified: 2024/08/17 02:22 by bruno