Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Coinbase API #1

Closed
somabc opened this issue Apr 20, 2017 · 11 comments
Closed

Coinbase API #1

somabc opened this issue Apr 20, 2017 · 11 comments

Comments

@somabc
Copy link

somabc commented Apr 20, 2017

Hey just wanted to check if I should enable permissions for V1 or V2 coinbase API? You might want to also add that it takes 48 hours for coinbase to enable a new API key.

@somabc
Copy link
Author

somabc commented Apr 20, 2017

Error I have is

PHP Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: GET https://api.coinbase.com/v2/accounts resulted in a 404 Not Found response:
{"errors":[{"id":"not_found","message":"Account not found"}]}

@somabc
Copy link
Author

somabc commented Apr 20, 2017

Have confirmed API Key and secret are in config and active on coinbase.

@somabc
Copy link
Author

somabc commented Apr 20, 2017

If I use V1 Key set to "all".

PHP Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: GET https://api.coinbase.com/v2/accounts resulted in a 403 Forbidden response:
{"errors":[{"id":"invalid_scope","message":"API Key does not support wallet:accounts:read scopes","url":"https://develop (truncated...)

@somabc
Copy link
Author

somabc commented Apr 20, 2017

It's definitely an API mismatch. Enable all V2 and V1 coinbase options and it's talking to V2 while using V1. I think you could specify the API version to use in the request but that's one of the composer dependencies?

PHP Fatal error: Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: GET https://api.coinbase.com/v2/accounts resulted in a 403 Forbidden response:
{"errors":[{"id":"invalid_scope","message":"Scopes don't match current API version.","url":"https://developers.coinbase. (truncated...)
' in /home/pi/phptrader/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:111

API version is generally passed as a CB-VERSION header. If the API version is omitted, the version displayed below will be used.

API Version: 2017-04-18 YOU'RE UP-TO-DATE

@somabc
Copy link
Author

somabc commented Apr 20, 2017

Related: coinbase/coinbase-php#114

@geek-at
Copy link
Owner

geek-at commented Apr 21, 2017

Alright we will figure this out. I only enabled the V2 API for the key I used, didn't even expand the V1 info in the dialogue.

  • When does this error occur? When buying, when selling or in the watchdog?
  • Did you enable your API key for all wallets?
  • Did you rename any of your wallets? The script looks for "EUR Wallet" or "USD Wallet" by hand so if the name is off, it can't find it

@somabc
Copy link
Author

somabc commented Apr 24, 2017

It happens with

php trader.php buy 10 2

Gave access to all wallets. Have not renamed any. I'm in the UK so I have a GBP and EUR wallet if that makes a difference.

@somabc
Copy link
Author

somabc commented Apr 24, 2017

PHP Fatal error:  Uncaught exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: `GET https://api.coinbase.com/v2/accounts` resulted in a `404 Not Found` response:
{"errors":[{"id":"not_found","message":"Account not found"}]}
' in /home/pi/phptrader/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:111
Stack trace:
#0 /home/pi/phptrader/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 /home/pi/phptrader/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 /home/pi/phptrader/vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)
#3 /home/pi/phptrader/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#4 /home/pi/phptrader/vendor/guzzlehttp/promises/src/Promise.php(246): Gu in /home/pi/phptrader/vendor/coinbase/coinbase/src/Exception/HttpException.php on line 37

@somabc
Copy link
Author

somabc commented Apr 24, 2017

<?php

// The currency you're going to pay with when buying new coins
// This can also be a crypto currency you have on Coinbase
// EUR or USD or even ETH or BTC
define('CURRENCY','EUR');

// The crypto currency the bot is going to trade.
// BTC or ETH only the moment
define('CRYPTO','BTC');

// Script settings
define('DEV',true); //enables the program output
define('SIMULATE',true); //if false, transactions are really paid, else it's just a simulation

//how long between price checks in the watchdog?
define('SLEEPTIME',10);

// chat system output (rocket.chat and Slack supported)
define('ROCKETCHAT_REPORTING',false); //enables/disables rocketchat reporting
define('ROCKETCHAT_WEBHOOK',''); // The URL of the webhook. Also works with a Slack webhook!

// Coinbase
//define('COINBASE_KEY','<removed>');
//define('COINBASE_SECRET','<removed>');
define('COINBASE_KEY','<removed>');
define('COINBASE_SECRET','<removed>');



// REDIS for storing your data (bitcoin prices, orders, etc)
// if REDIS_SERVER is not set, will use a local JSON file
// if the JSON file is present AND REDIS_SERVER is set, will convert to redis and delete JSON
define('REDIS_SERVER', '');
define('REDIS_PORT', 6379);
define('REDIS_PASS','');
define('REDIS_DB',0);

@geek-at
Copy link
Owner

geek-at commented Apr 24, 2017

upgrade to the latest version that might fix it since the code is now looking for the wallets by currency rather by name like in the old version.

If the bug still persists, please send the first few lines from the debug output of /var/log/phptrader.log

@somabc
Copy link
Author

somabc commented May 2, 2017

Thanks git pull to recent version and a new API key and it's working.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants