Hello,
I’m currently trying to adapt my python trading program for use on the new advanced trade api.
At the moment on the Pro api, I get a price feed, then when it spots a trade the program authenticates me so it can place an order.
For the new api we have to authenticate first to get the price feed. The program might not trade for days at a time, so will the initial authentification still be valid, or will it have to authenticate again for the trade order to go through?
Hi @garry! Welcome to the Coinbase Developer Forum! We understand that you are currently trying to adapt your python trading program for use on the new Advanced Trade, but in order to ensure that we are on the same page with you, we would like you to provide us first with the following information:
“For the new api we have to authenticate first to get the price feed. The program might not trade for days at a time, so will the initial authentication still be valid?”
To better understand your scenario, can you elaborate further on what you meant with price feed? Are you utilizing an endpoint for this use case?
For your statement “will it have to authenticate again for the trade order to go through? Sorry, I meant Authorization, not authentication.?”
Can you specify the authentication method you are using for your API calls, if you are using API keys or OAuth2?
Please note that this is essential so that we could address your concern more accurately for you.
Since you stated that you are currently trying to adapt your python trading program, is it a third-party platform? Otherwise, please provide further details.
And once you reply back to us for the requested information above, we’ll work to quickly address your concerns. We appreciate your understanding. Have a great day ahead!
Hello KatKat.
By price feed I meant using websocket to suscribe to channels-ticker.
I’m authorizing API calls using my API keys.
My program is self written in python. I’m not an expert; I can write the trading part myself, but for the websocket feed and authentication parts I had to get the code from the internet as I couldn’t work that part out.
Currently on Pro my program:
gets the public channels ticker
keeps looking at the ticker until the right price comes up
when the right price comes goes to authorization
places a buy or sell order
checks for the order to fill
back to the start
On advanced trade api, would authorizing to get the ticker feed also authorize me to trade later on or would I still have to authorize again to place a trade order?
Thanks for your answer, hope I’ve cleared it up a bit for you.
Hi @garry! Thank you for providing the information we need. With regard to your question "On advanced trade api, would authorizing to get the ticker feed also authorize me to trade later on or would I still have to authorize again to place a trade order, " please note that the answer to this is yes, you still have to authorize again to place a trade order.
Unlike the Websocket Feed in CB Pro, the Websocket Feed of Advanced Trade requires authentication in order to subscribe to its channels. You can learn more about this in the documentation. Please note that this authentication is only for the Websocket and is not the same for authenticating API calls. Hence, in order to successfully place an order, you have to authenticate the API call by following the steps provided in this documentation about Authenticating Messages and you also have to ensure that the required permission (scope) related to this /order endpoint has been granted. You can learn more on which permissions (scopes) are required to access each endpoint in this Rest API overview.
We hope this clarifies your concerns. Please let us know if you still have more questions or clarifications. Thank you!