我们不能使用以下API在投资组合之间进行转换。
(url:https://api-public.sandbox.pro.coinbase.com/withdrawals/coinbase-account)
错误msg如下:ApiError(状态403 code=):无效范围COINBASE args({'data':{“code=”:0.1,“货币”:"BTC","coinbase_account_id":“4b08d5e5-fe77-4249-b017-301e8890652a”),'headers':{'Content-type':'application/json',‘CB-KEY’:'XXXXXXXXXXXX',‘CB-ACCESS-符号’:‘‘’CB ACCESS-PASSPHRASE‘:'xxxxxxxxxxx'},'timeout':30.0})
让我们知道这两个API是否用于投资组合之间的转移。但是,如果API没有问题,请在url上演示并请求以下两个用例的有效负载:
),则使用A的API密钥到配置文件B。
特别是,coinbase_id是否代表配置文件(Potfolio) id或帐户(资产) id?如何通过API获得这个id?
发布于 2021-03-10 15:04:26
这已经是一个很长的时间了,我想你已经找到了你的答案,但是如果没有,对于那些感兴趣的人,你可以使用/profiles/transfer路线在你的Coinbase Pro投资组合之间转移资金。
只需使用传输权限从" from“组合中创建API密钥即可。
示例:
POST /profiles/transfer
{
"from": "86602c68-306a-4500-ac73-4ce56a91d83c",
"to": "e87429d3-f0a7-4f28-8dff-8dd93d383de1",
"currency": "EUR",
"amount": "100.00"
}发布于 2021-03-12 22:03:50
您可以通过首先获得Oauth2授权来获得帐户ID。一旦获得,您可以使用Coinbase (不是PRO)调用来获取帐户ID。我将不涵盖Oauth2调用,因为它们已经有了很好的文档记录。使用PHP的API调用如下所示:
//////////////////////
// IMPORTANT, not covered how to obtain this
// Assuming a variable which contains the Oauth2 access code is passed in
// with a variable name called
// $oauth_provided_access_token
// IMPORTANT
//////////////////////
// Obtain Timestamp
$API_VERSION = '2021-02-26';
$timestamp = json_decode(file_get_contents("https://api.coinbase.com/v2/time"), true)["data"]["epoch"];
// Define request
$req = "/v2/user";
// Define full URL, why Coinbase cannot parse this and obtain the request is strange
$url = "https://api.coinbase.com" . $req;
// Obtain API key/Secret (Do not put this in your PHP code, obtain it via environment variables
// Note that the key and secret are not required in this instance
// but many Coinbase API calls will need them
//$key = $_SERVER["HTTP_MY_COINBASE_API_KEY"];
//$secret = $_SERVER["HTTP_MY_COINBASE_API_SECRET"];
// Set up CURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, false );
curl_setopt($ch, CURLOPT_USERAGENT,'CoinbaseAPI');
curl_setopt($ch, CURLOPT_HTTPHEADER
, array ( "Authorization: Bearer " . $oauth_provided_access_token
, "CB-VERSION:" . $API_VERSION
, "CB-ACCESS-TIMESTAMP:" . $timestamp
)
);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true );
$response = curl_exec($ch); // Actual account info
$info = curl_getinfo($ch); // Get more debugging info
curl_close($ch);
$response_object=json_decode($response);
echo $response_object->{"data")->{"id"}; // User Account IDhttps://stackoverflow.com/questions/63112321
复制相似问题