Can we test get_fills's Exchange/Pro api in testnet

Hi,

I’m trying to test some apis in testnet url: https://api-public.sandbox.exchange.coinbase.com. All works well, but get_fills . Are we able to call this api in testnet? Thank you for your consideration.

Hi @phucnguyen! Welcome to the forum! Upon trying it on our end, we were able to successfully call the Get all fills endpoint using the testnet url you have provided. Therefore, we would like to ask some information for us to better understand the issue you are experiencing:

  • Can you provide us with the full body of the code you are using, including the portion containing the headers and code for generating a signature?
  • If you are receiving any error messages, can you copy the text of the error messages into this email?

If you have any additional information/screenshot that can demonstrate your concern, feel free to share it with us. Once you send us the information requested above, we’ll work to quickly address your concern.

Also, please note that as you might know, while Sandboxes are a great way of testing, they can also be unstable at times. This might happen due to several reasons such as the Sandbox server not validating the orders and so unrealistic orders are put into place, affecting placing market orders, etc. Besides that, please note that not all functionalities present on our Exchange/Pro API are available on the Sandbox for testing.

We appreciate your patience and understanding.

def create_signature(api_secret, timestamp, method, path_url, body):
    message = timestamp + method + path_url.split('?')[0] + body
    hmac_key = base64.b64decode(api_secret)
    signature = hmac.new(hmac_key, message.encode('utf-8'), hashlib.sha256)
    signature_b64 = base64.b64encode(signature.digest()).decode('utf-8')
    return signature_b64

headers = {
        'Content-Type': 'application/json',
        'CB-ACCESS-KEY': api_key,
        'CB-ACCESS-PASSPHRASE': passphrase,
        'CB-ACCESS-SIGN': signature_b64,
        'CB-ACCESS-TIMESTAMP': timestamp,
        'User-Agent': 'python-requests'
    }

hi @Faker, thanks for your reply. here is my function to create signature, the path url I pass is /fills?product_id=BTC-EUR and body = ‘’

1 Like

Hi @phucnguyen! Thanks for the information.

Are you receiving an error when calling the get all fills endpoint? If you are, can you post the text of the error messages into this thread? Otherwise, please send a screenshot of the API response and please omit any sensitive information.

We will await your response.

1 Like

it responds {'message': 'invalid signature'}

1 Like

Hi @phucnguyen!

We can see in your code that you are using the split() function path_url.split('?')[0] to remove the query parameter. For Exchange/Pro endpoint and sandbox environment, you must include the query parameter in your requestPath. Removing the query parameter in the requestPath is a signature generation for Advanced Trade API.We request that you include query parameters and try to call the /fills endpoint to check if it still returns an invalid signature error.You may check these forum posts for reference:

We hope this helps!

1 Like

thanks so much @HakunaMatata , it works after I keep query parameters in signature generation :pray:

1 Like

Hi @phucnguyen! We are glad it all worked for you. We’re always happy to help! Please reach out in the future if you need anything else. Have a good day!

1 Like