# stocks

Audience: Programmer

**Served by:** [inventory](https://docs.pyck.cloud/latest/api/services/inventory.md)

## Arguments

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `after` | [Cursor](https://docs.pyck.cloud/latest/api/scalars/cursor.md) |  | Returns the elements in the list that come after the specified cursor. |
| `first` | Int |  | Returns the first _n_ elements from the list. |
| `before` | [Cursor](https://docs.pyck.cloud/latest/api/scalars/cursor.md) |  | Returns the elements in the list that come before the specified cursor. |
| `last` | Int |  | Returns the last _n_ elements from the list. |
| `orderBy` | [StockOrder](https://docs.pyck.cloud/latest/api/inputs/stockorder.md) |  | Ordering options for Stocks returned from the connection. |
| `where` | [StockWhereInput](https://docs.pyck.cloud/latest/api/inputs/stockwhereinput.md) |  | Filtering options for Stocks returned from the connection. |

## Returns

[StockConnection](https://docs.pyck.cloud/latest/api/types/stockconnection.md)!

## Example

Returns the 3 stock entries with the highest quantity.

```graphql
query GetStocks($after: Cursor, $first: Int, $before: Cursor, $last: Int, $orderBy: StockOrder, $where: StockWhereInput) {
  stocks(after: $after, first: $first, before: $before, last: $last, orderBy: $orderBy, where: $where) {
    totalCount
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
    edges {
      cursor
      node {
        createdAt
        createdBy
        deletedAt
        deletedBy
        id
        incomingStock
        itemID
        movementID
        outgoingStock
        ownIncomingStock
        ownOutgoingStock
        ownQuantity
        quantity
        repositoryID
        tenantID
        updatedAt
        updatedBy
        version
      }
    }
  }
}
```

**Variables**

```json
{
  "first": 3,
  "orderBy": {
    "direction": "DESC",
    "field": "QUANTITY"
  },
  "where": {
    "createdAtGTE": "2023-10-17T00:00:00Z"
  }
}
```
