coinbase-api

Pagination on Coinbase Python API

 ̄綄美尐妖づ 提交于 2019-12-09 23:58:03
问题 I am trying to get all of the transactions on a Coinbase account, which requires pagination. The documentation is sparse on how to do this in Python, but I have managed to make it work: client = Client(keys['apiKey'], keys['apiSecret']) accounts = client.get_accounts() for account in accounts.data: txns = client.get_transactions(account.id, limit=25) while True: for tx in txns.data: print(tx.id) if txns.pagination.next_uri != None: starting_after_guid = re.search('starting_after=([0-9a-f]{8}-

CoinBase “invalid signature” PHP Buy API Request

倖福魔咒の 提交于 2019-12-08 09:31:49
问题 I have looked over the code many times but whenever I send request to API it returns "message":"invalid signature" I am thinking it has to do with hashing the body, possibly. I'm new to PHP and its my first project. :) Anyone see an error? Thanks. <?php $arr = array('size' => ".01", 'price' => '240', 'side' => 'sell', 'product_id' => 'BTC-USD'); $output = json_encode($arr); echo json_encode($arr)."<br/>"; $key = "f23612b06cb4d020cda7e04b1ae6ef9a"; $secret = "RENqodtuTCn4v7g7Pn

How to declare CURL body for CoinBase API call

こ雲淡風輕ζ 提交于 2019-12-08 07:04:39
问题 I am currently working on a small app using the API of Coinbase. Coinbase needed CB-ACCESS-SIGN header to authenticate. The CB-ACCESS-SIGN header is generated by creating a sha256 HMAC using the secret key on the prehash string timestamp + method + requestPath + body (where + represents string concatenation). Reference page https://developers.coinbase.com/api/v2?shell#api-key to create address, based from: https://developers.coinbase.com/api/v2?shell#create-address. I wrote command :

Invalid Signature Coinbase

白昼怎懂夜的黑 提交于 2019-12-07 19:16:27
问题 I'm trying to use the API for Coinbase but I get invalid signature. So probably I'm actually sign it wrong or I'm missing something. what should I use on request? should i use POST or GET on method? $urlapi = "https://api.coinbase.com/v2/time"; $Key = "--------------"; $Secret = "------------"; $fecha = new DateTime(); $timestamp = $fecha->getTimestamp(); $request=""; $body=""; $method="GET"; $Datas = $timestamp . $method . $request . $body; $hmacSig = hash_hmac('sha256',$Datas,$Secret);

Invalid Signature Coinbase

北城余情 提交于 2019-12-06 04:45:21
I'm trying to use the API for Coinbase but I get invalid signature. So probably I'm actually sign it wrong or I'm missing something. what should I use on request? should i use POST or GET on method? $urlapi = "https://api.coinbase.com/v2/time"; $Key = "--------------"; $Secret = "------------"; $fecha = new DateTime(); $timestamp = $fecha->getTimestamp(); $request=""; $body=""; $method="GET"; $Datas = $timestamp . $method . $request . $body; $hmacSig = hash_hmac('sha256',$Datas,$Secret); $curl = curl_init($urlapi); curl_setopt($curl,CURLOPT_HTTPHEADER,array('Content-Type: application/json','CB

How to send a keep-alive packet through websocket in ruby on rails

坚强是说给别人听的谎言 提交于 2019-12-05 01:56:06
问题 I want to send a "Keep alive from client" message every 30 seconds for my websocket connection. Here's what the code that I have in my websocket initializer looks like: ws = WebSocket::Client::Simple.connect 'wss://bitcoin.toshi.io/' ws.on :message do |msg| rawJson = msg.data message_response = JSON.parse(rawJson) end ws.on :open do ws.send "{\"subscribe\":\"blocks\"}" end ws.on :close do |e| puts "WEBSOCKET HAS CLOSED #{e}" exit 1 end ws.on :error do |e| puts "WEBSOCKET ERROR #{e}" end

Pagination on Coinbase Python API

拟墨画扇 提交于 2019-12-04 20:22:56
I am trying to get all of the transactions on a Coinbase account, which requires pagination. The documentation is sparse on how to do this in Python, but I have managed to make it work: client = Client(keys['apiKey'], keys['apiSecret']) accounts = client.get_accounts() for account in accounts.data: txns = client.get_transactions(account.id, limit=25) while True: for tx in txns.data: print(tx.id) if txns.pagination.next_uri != None: starting_after_guid = re.search('starting_after=([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})', txns.pagination.next_uri, re.I)[1] txns = client.get_transactions

Historical ethereum prices - Coinbase API

你。 提交于 2019-12-04 10:45:18
问题 Using the python coinbase API-- The functions-- get_buy_price , get_sell_price , get_spot_price , get_historical_data , etc... all seem to return bitcoin prices only. Is there a way of querying Ethereum prices? It would seem that currency_pair = 'BTC-USD' could be changed to something akin to currency_pair = 'ETH-USD' although this has no effect. I would expect that the API simply doesn't support this, except that the official documentation explicitly states: Get the total price to buy one

How to send FIX logon message with Python to GDAX/Coinbase

吃可爱长大的小学妹 提交于 2019-12-04 09:36:02
问题 I'm trying to establish a FIX 4.2 session to fix.gdax.com (docs: https://docs.gdax.com/#fix-api or https://docs.prime.coinbase.com/?python#logon-a) using Python 3.5 and stunnel. Everything is working apart from my logon message which is rejected and the session is closed by the server with no response making it difficult to debug what's going wrong. My Python code is as follows: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("127.0.0.1", 4197)) # address and port specified

How to send a keep-alive packet through websocket in ruby on rails

佐手、 提交于 2019-12-03 16:28:33
I want to send a "Keep alive from client" message every 30 seconds for my websocket connection. Here's what the code that I have in my websocket initializer looks like: ws = WebSocket::Client::Simple.connect 'wss://bitcoin.toshi.io/' ws.on :message do |msg| rawJson = msg.data message_response = JSON.parse(rawJson) end ws.on :open do ws.send "{\"subscribe\":\"blocks\"}" end ws.on :close do |e| puts "WEBSOCKET HAS CLOSED #{e}" exit 1 end ws.on :error do |e| puts "WEBSOCKET ERROR #{e}" end Without any sort of 'keep alive', the connect closes in about 45 seconds. How should I send the 'heart-beat'