Converting from BTC to another currency - coinbase-api

From Coinbase API can you convert from Bitcoin to, for example, USDC? I cannot see any reference but I have this feature on the app. I wonder if API supports (or expects support for) this operation, or it just that I'm missing something.

Looking at the Coinbase API PRO Documentation you can create a conversion by:
HTTP REQUEST
POST /conversions
API KEY PERMISSIONS
This endpoint requires the “trade” permission.
Request
{
"from": "USD",
"to": "USDC",
"amount": "10000.00"}
PARAMETERS
from: A valid currency id
to: A valid currency id
amount: Amount of from to convert to to
Probably more of a question of what the valid currencies are

There is a reference for this in the Coinbase API documentation:
https://developers.coinbase.com/api/v2#transfer-money-between-accounts
But as I stated in my question, it unfortunately doesn't seem to work:
Coinbase transfer between accounts returns "Not found"

Without using CoinbasePro API but only Coinbase API from webapp that are the endpoints you need to call:
Have to know base_id of crypto that you want to sell and base_id of
crypto want to buy. You can know it by call GET
"https://api.coinbase.com/v2/
/assets/prices?base=USD&filter=holdable&resolution=latest" and get
from response the "base_id" of your currencies.
Make an order by calling POST "https://api.coinbase.com/v2/trade"
with a request body in json like this:
{ 'amount': [amount that you want to convert], 'amount_asset':
[currency of amount that you want to convert], 'amount_from':
'input', 'source_asset': ["base_id" of crypto that you want to
sell], 'target_asset': ["base_id" of crypto that you want to buy] }
If previous POST "/trade" response code is 201, you have to get the
"id" value of response's json and do a commit of your order by
calling POST "https://api.coinbase.com/v2/trades/[id of json
response of previous https://api.coinbase.com/v2/trade POST"]/commit". If
the response code of this POST commit is 201, your exchange is
started and if there are not error in coinbase, your conversion is
done!

Related

Can't get data from Marvel API - The passed referrer not allowed for the passed API key

I'm trying to get data from the Marvel API, using this request URL:
https://gateway.marvel.com:443/v1/public/characters?apikey=4dab7cb0585a4ea6c5d6a183f6769968
But, when using the fetch API method and logging the data to console. I'm get this:
{code: "InvalidCredentials", message: "The passed referrer is not allowed for the passed API key."}
Following the link you shared I get this error:
{"code":"MissingParameter","message":"You must provide a hash."}
Accoring to the documentation, you need to provide a timestamp, ts and a hash value in the request parameter.
Also check your Your authorized referrers section.If you add * and update it will allow from any host.
See docs:
https://developer.marvel.com/documentation/authorization

How to convert via the Coinbase API

Within the Coinbase app one can convert digital currencies (see the image below).
But does one convert via the Coinbase or Coinbase Pro API?
Watching API from coinbase webapp i see what endpoint you need to call:
Have to know base_id of crypto that you want to sell and base_id of crypto want to buy. You can know it by call GET "https://api.coinbase.com/v2/
/assets/prices?base=USD&filter=holdable&resolution=latest" and get from response the "base_id" of your currencies.
Make an order by calling POST "https://api.coinbase.com/v2/trade" with a request body in json like this:
{
'amount': [amount that you want to convert],
'amount_asset': [currency of amount that you want to convert],
'amount_from': 'input',
'source_asset': ["base_id" of crypto that you want to sell],
'target_asset': ["base_id" of crypto that you want to buy]
}
If previous POST "/trade" response code is 201, you have to get the "id" value of response's json and do a commit of your order by calling POST "https://api.coinbase.com/v2/trades/[id of json response of previous https://api.coinbase.com/v2/trade POST"]/commit". If the response code of this POST commit is 201, your exchange is started and if there are not error in coinbase, your conversion is done!

How can I set a deposit tag for XRP transactions using the Coinbase API?

I am playing with the Coinbase API and am attempting to send XRP from my Coinbase wallet to another account (outside of Coinbase). The Coinbase send API (https://developers.coinbase.com/api/v2#send-money) allows me to set the destination address but there is no means of setting the destination tag, which is required for XRP transfers.
How can I set the destination tag?
The Coinbase Pro API has documentation for their platform that hints at a possible solution (https://docs.pro.coinbase.com/?r=1#crypto). Two parameters of interest are destination_tag and no_destination_tag. So if you want to send XRP using Python, you might say the following:
client.send_money(account_id = <account-id>,
to = <destination-address>,
amount = <amount>,
currency = 'XRP',
destination_tag = <destination-tag>,
no_destination_tag = False)
If you don't want to use the destination tag, you can just omit the destination_tag parameter and set no_destination_tag to True.
Extremely late to this but figured it'll be useful for someone else stumbling onto this thread.
I've just tested putting deposit_tag into the POST request to Coinbase's API (not Coinbase Pro) and it successfully puts the deposit tag through.
Coinbase also doesn't allow you to send XRP if you don't specify a deposit tag, which is handy.

GetFeedSubmissionResult is not Giving data in response

I have tried to call GetFeedSubmissionResult api of Amazon MWS Feed submission. i have one Feedsubmissionid which is successfully gives response in "Amazon MWS Scratchpad"
but
In this when i am passing the feedsubmissionid into this api it gives below response,
Service Response=============================================================================
GetFeedSubmissionResultResponse
GetFeedSubmissionResult ContentMd5 YQtHphFPLIcA4vEOn2guCQ==
ResponseMetadata
RequestId
4f715dcf-9e89-4ad5-b721-5bb1ba6bbafa
ResponseHeaderMetadata: RequestId: 4f715dcf-9e89-4ad5-b721-5bb1ba6bbafa, ResponseContext : H5F8Si8GvjCkIIlV+vqovD1zOzXDQ+i7/xRZB46IM/XgePQAAliUi6NzK7tCrVsHM/fZFLhjQkM 0Tvk46V5dJCSmZr22uad,2LvooKOfZwPK75jMl3gDmvuK1oCUt3JWf9UvVTFfXSIhrMpIxkcjQp/ekS0I2neiRcoh0X14RWs0 na0j6cY9ZQ==, Timestamp: 2016-03-09T06:55:38.418Z
Please provide solution as soon as possible.
I get the result in correct format using CURL. I have call API using CURL and i am getting the response in XML format which is actual response.

paypal pay now and returned variables

I am making a paypal pay now button for my website to add credits that can be used.
I understand the whole buy now and ipn thing but I what I would like to do is that when the user finishes his pay, there should be a way for the IPN to get the username so that I could add the credits into the database.
Is there a way to have the username sent together with the transaction so that it is returned, too? Thank you.
Please do not rely on the notify url.
You can send a 'custom' parameter in your dictionary object to paypal as listed in the Paypal IPN Docs.
paypal_dict = {
"business": "yourpaypalemail#example.com",
"amount": "10000000.00",
"item_name": "name of the item",
"invoice": "unique-invoice-id",
"notify_url": "http://www.example.com/your-ipn-location/",
"return_url": "http://www.example.com/your-return-location/",
"cancel_return": "http://www.example.com/your-cancel-location/",
"custom": request.user.username, #or you can use request.user.pk
}
The 'custom' value will be saved on paypal's server with the transaction and in your IPN object. This is a much better option than having payments with no customer identified.
In the button params, set the notify_url variable to an URL of maximum 255 characters.
PayPal will HTTP POST to this URL with the IPN details (payment_status, payment_date, etc.).
When creating the button, add params to this URL, such as http://yourwebsite.com?username_for_credits=john%20doe
.
When PayPal will make the IPN HTTP POST, you will get back the username you want.

Resources