Search code examples
coinbase-apigdax-api

GDAX API: getting status 'rejected' (reject_reason: post only) when buying


I have a Python script that calls the /orders method with the following parameters:

{
    "size": "0.01",
    "price": "<last price>",
    "side": "buy",
    "product_id": "BTC-USD",
    "type": "limit",
    "post_only": true
}

Some times it works, but most of the times I get this error:

{
    "status": "rejected",
    "reject_reason": "post only"
}

Upon reading the trading rules, it says that:

1.8A Limit Order with ‘post-only’ selected will only be posted to the Order Book if it would not be posted at the same price as an existing Order on the Order Book.

So I attempted to make the purchase with + $0.01, + $0.02, ..., + $0.99 (just to make sure that it won't have the same price as existing orders in the book) but I still get that message no matter how many cents I increase the price to buy ...

Did anybody bump into this issue?
Does anybody know what that "reject reason" really mean?


Solution

  • "Post Only" buy orders must have a price that is less than the current market price that people are willing to sell at.

    Put differently, if you want the buy order to go on the order book, and not fill immediately, you must bid less than people are currently willing to sell for.

    When you try to post an order at <last_price>, there's a decent chance that price was at the lowest ask price, i.e., the price that people are currently willing to sell for.

    And then certainly when you increase your bid, you're easily going into territory that people are already willing to sell for.

    To solve this, simply bid less, not more.

    The 1.8A section is saying exactly this, though it is ambiguous the way you're looking at it. They're saying you cannot post a buy order to the order book if someone is already on the order book saying they're willing to sell at that price. You certainly can post a buy order at the same buy price as other people are already willing to buy at.