Get fees for simple trades (swap)

Hello,

I want to get fees for the transactions of type ‘trade’ (not advanced trades fill)

I’m using this endpoint :
GET https://api.coinbase.com/v2/accounts/:account_id/transactions

By example, i have this response below for a trade

{
  "id": "a66cd195-cd02-5b28-8037-9451600a47bb",
  "type": "trade",
  "status": "completed",
  "amount": {
      "amount": "-60.997926",
      "currency": "ALGO"
  },
  "native_amount": {
      "amount": "-50.00",
      "currency": "USD"
  },
  "description": null,
  "created_at": "2022-03-02T15:32:46Z",
  "updated_at": "2022-03-02T15:32:48Z",
  "resource": "transaction",
  "resource_path": "/v2/accounts/306062cb-1cfd-56ec-bc0f-9e23a1c339c9/transactions/a66cd195-cd02-5b28-8037-9451600a47bb",
  "instant_exchange": false,
  "trade": {
      "id": "708841cc-c742-54d8-b0fa-0f217a388b5b",
      "resource": "trade",
      "resource_path": ""
  },
  "details": {
      "title": "Convertis à partir de Algorand",
      "subtitle": "En utilisant Portefeuille en ALGO",
      "header": "60,997926 ALGO convertis (50,00 $)",
      "health": "positive",
      "payment_method_name": "Portefeuille en ALGO"
  },
  "hide_native_amount": false
}

Ok, i get the id of the trade, but i don’t understand how to get details about it to find fees data,

There is no “resource_path” available and i don’t see in documentation a path to get this.

For the other transactions (buy, withdrawals, advanced trade ) , i have not this problem because either the fee data are directly available ( for advanced trades) or there is a path to get it ( for buys) in the response.

So i don’t see where is my error.
I hope, i have give enough informations (let me know if not)

Please, can you tell me where i must look for ?

Best,

Olivier

Hello @Olivier ! Thank you for posting your concern here at the Coinbase Developer forum. To be able to help you in full, we would like to ask the following:

  • You mentioned that you wanted to get the fees for trades by utilizing this endpoint: GET https://api.coinbase.com/v2/accounts/:account_id/transactions and by using transactions type “trade”. May we ask if you successfully called this endpoint before using the transactions type “trade”? This is because in this documentation, the transaction type “trade” was not listed as an available transaction type.
  • Also, aside from the fees associated with the trade, can you confirm if you also wanted to get the trade_id?

We’ll work hard to resolve your concern once you have provided answers to our questions above.

Additionally, please note that Sign In with Coinbase APIs are used for buying/selling digital assets as well as deposits and withdrawals, etc. While the Advanced Trade REST API supports advanced trading features that offers a secure and easy way to trade digital assets online across various trading pairs.

Hello @PochiiKun ! Thank you for your response.

Indeed, maybe I was not clear, my goal is to get fees when you make a simple trade in Coinbase. It’s also called ‘swap’.

Yes, i have successfully called this endpoint. The example above in my last post is a part of real API response of my own account Coinbase.

If you check in my response :
I have a "type" : "trade"

and additional data :

“trade”: {
“id”: “708841cc-c742-54d8-b0fa-0f217a388b5b”,
“resource”: “trade”,
“resource_path”: “”
},

As you see, there is the trade.id but the ressource_path is empty.

So i understand, that in documentation, the type ‘trade’ doesn’t exist, but in this case, this type is available.

I think, this type match with swap transactions ( ex : you exchange ALGO directly against SOL ).

To be more precise, in this case , there is two transactions (combined in one for user) :

  • ALGO ->USD ( cf the transaction in my first post)
  • USD->SOL ( the transaction below )

In this two case, you can see the trade id match between the two transactions (“id”:“051d6545-2d3a-57d8-a978-9f0de36ca107”) but there is no more informations about fees.


{
"id":"051d6545-2d3a-57d8-a978-9f0de36ca107",
"type":"trade",
"status":"completed",
"amount":{
"amount":"0.480843074",
"currency":"SOL"
},
"native_amount":{
"amount":"48.96",
"currency":"USD"
},
"description":null,
"created_at":"2022-03-02T15:32:45Z",
"updated_at":"2022-03-02T15:32:49Z",
"resource":"transaction",
"resource_path":"/v2/accounts/b15fb45b-5c12-52ed-8cbe-d4031f032087/transactions/051d6545-2d3a-57d8-a978-9f0de36ca107",
"instant_exchange":false,
"trade":{
"id":"708841cc-c742-54d8-b0fa-0f217a388b5b",
"resource":"trade",
"resource_path":""
},
"details":{
"title":"Converti en Solana",
"subtitle":"En utilisant Portefeuille en ALGO",
"header":"0,48084307 SOL convertis (48,96 $)",
"health":"positive",
"payment_method_name":"Portefeuille en ALGO"
},
"hide_native_amount":false
}

So, i don’t know how i must do, i hope you can help me ?

Hello @Olivier! Thank you for providing us with a better context about your concern. Please be advised that we will check on this for you internally with the relevant teams to ensure that this is addressed accurately for you. We will get back to you once we have more information. Keep in touch!

2 Likes

Hello @ereeca15 !
Thank you for giving me an answer last time.
I don’t mean to offend you and I’m sorry to put you on the spot, but may I ask if my request is still being processed ?
:slightly_smiling_face:

Hi @Olivier ! We apologize if this took too long to be addressed. Please be informed that our team was already informed about your concern and from the last communication, they were working on it. We also reiterated this to our internal teams to obtain any updates regarding this matter and will update you as soon as we hear from them.

We appreciate your utmost patience and understanding. Have a great day!

1 Like

Hi @Olivier! Apologies for the delay in our response as we confirm this to our relevant team. We would like you to try calling first the Show a Transaction endpoint with expanded resource. To call the endpoint with the expanded resource, you may call the Show a Transaction endpoint but should add the expand parameter. For the request URL, you may refer on this example: “https://api.coinbase.com/v2/accounts/8fcd97cd-50ca-5803-8c27-1146e54b1c09/transactions/0ec2de93-7dae-5a50-8580-6445a08e4ae4?expand[]=to”. For more information about expanding resources, you may go through this documentation.

However, if upon trying to call the endpoint with the expanded resource and still the information regarding fees are not present, this means that we are not supporting the fee data providence for the trade type transaction as of the moment.

We hope the resolution mentioned above works. Please reach back to us if you need anything else. Thank you and have a great day!

Hi @uncle_genie !

Thank for your reply.
I’ll try with the expand parameter and let you know if it’s OK.
Have a great day !

5 Likes

@Olivier did you figure out how to get the fee? I am struggling with the same problem, that we dont get the fee…

Unfortunately no, I have not reviewed, but for me these data are still not available. I have the impression that Coinbase is no longer working on this API, but more on advanced trade and pro trade

Could you try to add new_version_opt_in=true parameter in the request so that the new schema should have the fee returned.

2 Likes