Trades

Read the trades your team is party to. Requires the trades.read scope and a token bound to a team via Login with MGX.

The counterparty stays null until both invoices on the trade are paid — the deal terms are visible, but not who the other party is, until settlement.

The trade model

  • Name
    id
    Type
    string
    Description
    Opaque trade id, e.g. trd_5Lp8.
  • Name
    side
    Type
    string
    Description
    buyer or seller, relative to your team.
  • Name
    status
    Type
    string
    Description
    Trade status.
  • Name
    commodity
    Type
    object
    Description
    slug and name.
  • Name
    quantity_mt
    Type
    number
    Description
    Quantity in tonnes.
  • Name
    price
    Type
    object
    Description
    amount, currency, unit.
  • Name
    counterparty
    Type
    object
    Description
    Null until both invoices are paid.
  • Name
    settled_at
    Type
    string
    Description
    When the trade settled.

GET/v1/trades

List trades

Trades your team bought or sold.

  • Name
    status
    Type
    string
    Description
    Filter by status.
  • Name
    commodity
    Type
    string
    Description
    Filter by commodity.
  • Name
    from
    Type
    string
    Description
    Created on or after (ISO date).
  • Name
    to
    Type
    string
    Description
    Created on or before (ISO date).

Request

GET
/v1/trades
curl "https://api.mygrainexchange.com/v1/trades?status=paid" \
  -H "Authorization: Bearer {token}"

GET/v1/trades/:id

Get a trade

Retrieve one of your team's trades by id. Returns 404 if your team is not party to it.

Request

GET
/v1/trades/trd_5Lp8
curl https://api.mygrainexchange.com/v1/trades/trd_5Lp8 \
  -H "Authorization: Bearer {token}"

Was this page helpful?