Create Order Invalid Argument

import time
import http.client
import json
import uuid
import hashlib
import hmac
import base64
import os

api_key = ‘MY_API_KEY’
api_secret = ‘MY_SECRET_KEY’

timestamp = str(int(time.time()))
request_method = ‘POST’
request_path = ‘/api/v3/brokerage/orders’

order_uuid = str(uuid.uuid4())
conn = http.client.HTTPSConnection(“api.coinbase.com”)

payload = json.dumps({
“client_order_id”: “000000003245”,
“side”: “BUY”,
“product_id”: “BTC-USD”
})

message = timestamp + request_method + request_path + payload
signature = hmac.new(api_secret.encode(‘utf-8’), message.encode(‘utf-8’), digestmod=hashlib.sha256).digest()

headers = {
‘Content-Type’: ‘application/json’,
‘CB-ACCESS-KEY’: api_key,
‘CB-ACCESS-SIGN’: signature.hex(),
‘CB-ACCESS-TIMESTAMP’: timestamp,
}

conn.request(request_method, request_path, payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode(“utf-8”))

this code response is {“error”:“INVALID_ARGUMENT”,“error_details”:“account is not available”,“message”:“account is not available”}, please help me to fix this issue.

Any luck with this? I’m having the same issue.

It looks like the Payload is missing the order configuration.

Example Below:

import uuid

payload = json.dumps({

    'order_configuration':{

         "limit_limit_gtc": {
            "limit_price": "0.45",
            "base_size": "3.5"
        },
    },
    'client_order_id':  str(uuid.uuid1()),
    'side': "SELL",
    'product_id':  "ADA-USD"

})

See the following post to setup a Request Body:

Thx for the response! Yes that seems to be the problem with OP, didn’t notice.

I had a different issue, was using “ETH-USD” as product_id, switching to “ETH-USDC” solved the problem. I was earlier testing the wss channels and there the id had to be the opposite (“ETH-USD” instead of “ETH-USDC”) which confused me.

I came here after googling the error “Account is not available”. It turns out that in my case I was not allowed to trade to USD currency. When I changed to my local GBP it worked fine.