Take profit orders?

From what I’ve seen, 400 is most often a problem with the order config. I’d be interested to see what the output of this section looks like:

String.join("", 
			"{\"client_order_id\":\"", UUID.randomUUID().toString(),
			"\",\"product_id\":\"", productID,
			"\",\"side\":\"SELL\",\"order_configuration\":{\"stop_limit_stop_limit_gtc\":{\"base_size\":\"", balance,
			"\",\"limit_price\":\"", value,
			"\",\"stop_price\":\"", trigger,
			"\",\"stop_direction\":\"STOP_DIRECTION_STOP_DOWN\",\"post_only\":\"false\"}}}"));

"post_only" isn’t listed as an option in the docs for a stop_limit_stop_limit_gtc order. Normally I think they would just ignore it, but it might be an option and is just missing from the docs. That might be your problem. It should be a JSON string, and JSON doesn’t put booleans in quotes, but you appear to have them here \"post_only\":\"false\". I believe Coinbase is using Go structs and it gets mad when you put in the wrong data type, even if it would be super easy to just convert it to the appropriate data type. That string should look something like this (but different order type) when you’re done joining everything together:

Beyond that, I mostly code in javascript, so I might not be much help here. That looks like Java, yeah?

1 Like