Hello, I wanted to know how can I get the positions that I hold and are open. I surfed through the documentation for coinbase advanced trade api and the ways that I found were either giving me the orders that were in open or the historical trades that I made, both of which are not really what I needed in this context. I would really appreiciate it if some one could help me getting the open positions for the user.
I am looking to integrate coinbase advanced trade api with my platform and I need to show the user their open positions.
I’m also looking for a way to get all of the user’s current positions
And get the user’s total account $ balance.
Any way to do this with the advanced trade API?
Hi @Bro_1234! Thank you for Using Coinbase Advanced Trade API.
To get the open positions that you hold with the Coinbase Advanced Trade API, you can use the Get Open Orders endpoint. This endpoint returns a list of your open orders for a given product and account. This endpoint requires the product ID and account ID as parameters and returns a list of your open orders for a given product and account. You can use this endpoint :
We hope this helps. Do let us know in case you have any more questions or conerns.
Hi @Loop_11 , Thanks for the reply. Just wanted to know if we have any differentiator between open orders and open positions here.
Regarding the open positions and open orders. So I had mapped some of the responses earlier and from reading some of the stuff regarding various types of orders. I choose to go with the orders that had the status of filled since a lot of stuff seems to tell me that orders getting filled is equivalent to a position being opened but the data that I am getting from the api still seems to be incorrect. I would like to know how to get the data of open positions from the coinbase advanced api. Even from the above api given by loop seems to return open orders instead of positions that I hold.
I’m also facing the same issue, There doesn’t seem to be any positions endpoint.
So I tried to manually calculate positions using trades like @Bro_1234 but the results are unexpected. I’m not getting any withdrawal orders which is messing with the final results.
I’ve found a way to calculate positions but for that I need access to withdrawals API but apparently there’s no way to use v2 API’s anymore as the API key only works with v3 API’s.
Is there any possible way to use v2 API’s anymore?
Hi @Bro_1234 @lightyagami and everyone else for sharing this! We are logging this as a feedback and will share this with our team as a feature request too. While we are unable to provide an ETA. We will try to bring this as soon as possible for our public use.
Open positions refer to the assets you currently hold in your portfolio. They can result from buying or selling a coin and are actively managed by placing orders to buy or sell at specific prices. Open positions represent market exposure for the trader, and the risk remains until the position is closed.
For your question we would suggest to get the open positions that you hold with the
GET /accounts endpoint. This endpoint returns a list of trading accounts associated with your API key, including the account balance, currency, and other relevant information. Once you have retrieved the list of accounts, you can filter the results to show only the open positions by checking the
hold field for each account. If the
hold field is greater than zero, it means that you have an open position in that currency.
We hope this helps. Do let us know in case you have any more questions or concerns.