Search code examples
pythoncoinbase-api

python coinbase_api placing order returns "{'message': 'Invalid expire_time '}"


i am trying to place an order with the coinbase pro api, but it fails because of the invalid expire_time.

i tried to pass the "cancel_after" parameter as timestamp, date string in iso format and seconds but still no success. i dont really understand what is meant by

cancel_after    [optional]* min, hour, day

my params are as follows:

params = {
    "type":"limit", 
    "side":"buy", 
    "product_id":  "BTC-EUR", 
    "price": "1000.0", 
    "size": "0.01",
    "stop_price": "1100.0",
    "stop": "entry",
    "time_in_force": "GTT",
    "cancel_after": ? 
}

has some faced the same problem ?

API-Reference for placing an order


Solution

  • cancel_after    [optional]* min, hour, day
    

    min,hour or day muste passed as string.

    there is no real datetime value you can only set:

    "min" => 1 Minute

    "hour" => 1 Hour

    "day" => 1 Day