> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sequency.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Compute and ingest Alpaca borrow status

> Fetch the current Alpaca borrow-status snapshot and insert it into
`borrow_status_daily`, dated `as_of` (default: the most recent trading
day -- the daily-timer call).

Runs synchronously -- a single full-universe `/v2/assets` fetch + insert
completes well within normal HTTP timeouts, same posture as
`POST /api/internal/ssr/compute`.



## OpenAPI

````yaml /api/openapi.json post /api/internal/borrow/compute
openapi: 3.1.0
info:
  title: Sequency Graph API
  description: >

    # Sequency Graph-Native Trading API


    Graph-native API for trading intelligence, built on FalkorDB.


    ## Features


    - **Screener**: Filter stocks using graph-native queries with relationship
    expansion

    - **Stock Detail**: Complete stock context with all relationships

    - **Confluence Scoring**: Setup quality assessment with weighted components

    - **Strategy Matching**: Find matching options strategies via graph
    traversal

    - **Market Context**: Current market-wide context for trading decisions


    ## Data Sources


    All data is sourced from the FalkorDB knowledge graph, populated by:

    - Pattern detector (Go) - Technical indicators, patterns

    - Graph sync service - Levels, volume profiles, news, day classification
  version: 1.0.0
servers: []
security: []
paths:
  /api/internal/borrow/compute:
    post:
      tags:
        - borrow
      summary: Compute and ingest Alpaca borrow status
      description: |-
        Fetch the current Alpaca borrow-status snapshot and insert it into
        `borrow_status_daily`, dated `as_of` (default: the most recent trading
        day -- the daily-timer call).

        Runs synchronously -- a single full-universe `/v2/assets` fetch + insert
        completes well within normal HTTP timeouts, same posture as
        `POST /api/internal/ssr/compute`.
      operationId: trigger_borrow_compute_api_internal_borrow_compute_post
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/BorrowComputeRequest'
                - type: 'null'
              title: Body
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BorrowComputeResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    BorrowComputeRequest:
      properties:
        as_of:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: As Of
          description: Snapshot date to record rows under.
      type: object
      title: BorrowComputeRequest
      description: >-
        Request body for `POST /api/internal/borrow/compute`.


        `as_of` defaults to `get_most_recent_trading_day()` when omitted (the

        daily-timer call) -- Alpaca's `/v2/assets` payload is
        current-status-only

        (no history), so `as_of` is simply the label attached to today's

        snapshot, not a window to backfill.
    BorrowComputeResponse:
      properties:
        rows_inserted:
          type: integer
          title: Rows Inserted
        as_of:
          type: string
          format: date
          title: As Of
      type: object
      required:
        - rows_inserted
        - as_of
      title: BorrowComputeResponse
      description: Response from `POST /api/internal/borrow/compute`.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````