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

# Integration Model

> Merchant balances, customer allocations, and product boundaries

## Overview

Daya Stocks follows a merchant-managed account model. Daya maintains the aggregate Stocks cash balance, positions, orders, and activity for your business; your business maintains the allocation of those assets across its own customers.

## Responsibility model

| Daya                                                      | Your business                                          |
| --------------------------------------------------------- | ------------------------------------------------------ |
| Maintain the merchant Stocks balance and portfolio        | Maintain a customer-level stock subledger              |
| Execute quotes, orders, deposits, and withdrawals         | Associate every operation with the correct customer    |
| Return customer-safe order, activity, and portfolio state | Build customer portfolio, gain/loss, and history views |
| Apply account-level API authorization                     | Protect keys and authorize actions in your application |

## Separate product balances

Stocks, Coins, and the Business API keep independent balances. Your interface may aggregate them for display, but that does not combine them into one spendable pool.

<Warning>
  Check the Stocks cash balance before placing an order. A balance held in Coins or the Business API cannot be assumed to fund a Stocks trade. Cross-product funding is a separate operation and is not atomic with an order.
</Warning>

## Customer allocation workflow

<Steps>
  <Step title="Record the instruction">Create an internal operation ID and record the customer, symbol, side, and requested amount or quantity.</Step>
  <Step title="Quote and order">Request a quote, then place the order with its `quote_id`. Save one `Idempotency-Key` for this logical order, reuse it for every retry, and store the returned Daya order ID.</Step>
  <Step title="Confirm the outcome">Process the terminal order webhook, or poll `GET /orders/{id}` until the order is `filled` or `failed`.</Step>
  <Step title="Post the allocation">Update the customer's shares, cash, and fees exactly once.</Step>
  <Step title="Reconcile">Compare total customer allocations against the aggregate Daya Stocks balance and portfolio.</Step>
</Steps>

## Reconciliation

Persist the last state processed for each order and transaction, make customer-ledger updates idempotent, and periodically compare the sum of customer allocations with the aggregate Daya balance and portfolio.

<Note>
  Configure signed order and money-movement webhooks in the Daya Dashboard. Keep API polling and periodic reconciliation as fallbacks for delayed, duplicated, or missed deliveries.
</Note>
