You've successfully subscribed to Alpaca Learn | Developer-First API for Crypto and Stocks
Great! Next, complete checkout for full access to Alpaca Learn | Developer-First API for Crypto and Stocks
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.
Broker API

Get Started with Just-In-Time Funding for Broker API

Tamir Frank
Tamir Frank

Alpaca’s Just-in-Time (JIT) offering, also known as post-trade settlement, serves as an alternative to the traditional pre-funding model for securities trading. This helps enable the creation of a single wallet experience, increases flexibility with cash management, and provides quicker access to buying power compared to alternative funding models.

When a partner is JIT enabled, Alpaca’s system calculates the difference between inflow and outflow account activity and assesses a single wire amount. Inflows to Alpaca typically consist of executed buy trades, while outflows to the partner are made up of executed sell trades and dividend payments. Should the inflows exceed the outflows across your account base, you will be responsible for sending the funds to Alpaca in time for settlement. If the opposite is true, Alpaca will initiate the wire on the morning of settlement equal to the difference between the outflows and the inflows.

Funding Flow

JIT Funding Flow for Stock Trading 

Overview

During regular and extended market hours, accounts will place trades to open or close long positions in securities. Any executed purchasing activity contributes to the gross amount due to Alpaca by settlement date. Conversely, executed selling activity contributes to the gross amount due to the partner on settlement date. Keep in mind that all REG / TAF fees are assessed on the trade date and settle at the same time as the respective trades (T+2).

The automated journaling process looks at all account activities from a settlement date perspective. For simplicity of reconciliation as well as feasibility in payment timing, all T+0 and T+1 settling activity will be treated as T+1 settling activity in the JIT funding flow. For example, a dividend that is paid on T+0 settles on T+0 but will be factored into the funds movement on T+1.

Reports

Four JIT reports are available through the API and can be accessed within the hour after 11:30 PM ET. The reports communicate transaction-level details as well as overall settlement amounts, direction and timing.

Detail CSV

The Detail report displays users’ activities that impact cash throughout the day. Typically, this takes the form of executed trades, trading fees, and corporate actions that involve cash allocations. Each of these activities is represented by a single row per transaction for each account.

Summary CSV

The Summary CSV has three columns and a single row, which lists the net money movement to or from Alpaca for T0, T1, and T2.

Payment PDF

The Payment PDF serves as a formal invoice for what the partner is expected to send to Alpaca for settlement liabilities, or conversely, what the partner should expect to receive from Alpaca on the settlement date. The Payment PDF will highlight the net amount due between the partner and Alpaca as well as the total amount of funds to be transferred for settlement.

Payment Final CSV

The Payment Final PDF is made available near the end of T+1 within the hour after 11:30 PM ET under the same API endpoint as the aforementioned files. It is identical to the Payment PDF, but includes an additional row that accounts for T+0 and T+1 settling activity. This is helpful for bookkeeping and reconciliation, and should be used as a replacement to the Payment PDF in determining the amount of money moved during the automated settlement journaling process.

To learn more about these reports, please refer to the Broker API JIT documentation.

Reports API Example

The reports can be accessed with the following API call after they are generated in a batch process that begins at 11:30 PM ET. This API request example retrieves  the Summary CSV report by passing a net_summary as the report_type value.

GET https://broker api.sandbox.alpaca.markets/v1/transfers/jit/reports?report_type=net_summary&system_date=2021-12-15

JIT Accounts

Partners have four firm accounts that are opened by Alpaca to help facilitate the Just-in-Time flow: IN, JT, JTO, and JTR. These accounts will be present in the sandbox and production environments.

The Money In account (IN) account serves as a wash account for the JIT process. JIT settlement payments should be sent to this account. The funds  remain in this account until the automated journaling process takes place at 10:30 AM ET on T+2.

The JIT deposit account (JT) is used to store the JIT deposit, along with the clearing deposit. A deposit minimum will be established as outlined by the JIT Agreement, a formal amendment to the standard partnership agreement, which can fluctuate based on projected or actual settlement activity. This deposit will be used as collateral for JIT enabled partners.

The Money Out account (JTO) collects the money due to the partner for activity settling today. Cash is moved into this account during the automated journaling process on T+2. On days where the settlement cash outflows (sell trades and dividends) exceed settlement cash inflows (buy trades), the account will have a non-zero balance that will be transferred out to you.

The Receivable account (JTR) tracks the amount of money owed to Alpaca for covering missed settlement obligations. This account typically sits at a $0 value, but will increase to the amount of capital Alpaca provides in the event that the IN account balance is not sufficient to pay for the trades. The IN account can go negative temporarily, but will be brought to a $0 balance by the JTR account. A non-zero balance in the JTR account accrues interest daily at a variable rate.

Settlement Journaling Processes

The settlement journaling process automatically allocates funds to pay for customer trades. This process is set to run daily at 10:30 AM ET on the settlement date. However, the final cutoff time for funds to land in Alpaca’s bank account in time for settlement is no later than 8:30 AM ET.

During the journaling job, funds in the IN account will be used to pay off customer dues. In the event that the IN account balance is not sufficient, Alpaca will cover the remaining settlement obligation on behalf of the partner, thus increasing the JTR account balance. The JTO account balance will increase by the amount of the funds due to the partner. After the journaling process completes, any funds due to the partner are wired out.

Trading Limits

In order to minimize risk, Alpaca sets a daily trading limit at the partner level, which is agreed upon during partner onboarding and outlined in the JIT Agreement. Any further purchasing activity will be halted once the net of executed and open buy orders minus executed sell orders reach the daily limit. Keep in mind that the real-time limit in use can be reduced by subsequent executed selling activity.

It is recommended that partners use the Retrieving Daily Trading Limits API endpoint to monitor real-time limit usage. Furthermore, partners are responsible for reaching out to Alpaca to request an increase in the limit. Inquiries to increase or decrease the trading limit are welcome, but may come with a corresponding change to the JIT deposit requirement.

Trading Limits API Example

You may access your trading limits with the following API call at any point in the day and your daily limit and limit in use will be calculated and returned in real time. This should be monitored so you can request an increase to your daily trading limit when needed.  needed.

https://broker-api.sandbox.alpaca.markets/v1/transfers/jit/limits

Late Payment Protocols

Late payments to Alpaca may occur in the event of bank holidays, disrupted payment rails, or other events. In this case, the JTR balance will increase by the amount of the settlement liabilities and will accrue interest charges daily. Cash in the JTO account may be applied during the automated settlement.

Occurrences of this scenario can be mitigated by partners sending money in advance of bank holidays or foreseeable payment method disruptions. During the time the JTR has a non-zero balance or if the deposit amount in the JT account falls below the minimum value, Alpaca will withhold any outbound payments to the partner and use the funds for the partner’s outstanding obligations as needed until the required payments are received. Repeated failures to pay on time may result in an increase to the minimum deposit amount.

Onboarding and Sandbox Testing

Ready to get started with Alpaca’s JIT integration? The first step is to reach out to your Relationship Manager to learn more about JIT funding and if it is right for you. Once you are ready for sandbox testing, Alpaca will create four firm-level accounts for you: IN, JT, JTO, and JTR. Additionally, Alpaca will make the necessary adjustments to enable JIT funding and set your daily net limit in the sandbox environment.

We recommend you begin with the following process to test the end-to-end flow in sandbox.

https://broker-api.sandbox.alpaca.markets/v1/accounts

Account Creation 

Let’s start with creating customer accounts by using the POST /accounts endpoint. After accounts have been created, it is very important that you do not fund the account since adding money to the account at this point in time would represent the flow of the pre-funding model. The JIT funding model allows accounts to trade without the funds being in Alpaca’s custody.

https://broker-api.sandbox.alpaca.markets/v1/trading/accounts/ff1d2206-15d3-4c0e-96e8-a9ffb2fca9e6/orders

Orders
{
  "symbol": "AAPL",
  "qty": "1",
  "side": "buy",
  "type": "market",
  "time_in_force": "gtc"
}

Next, we can place buy and sell orders within the new accounts. On buy order submission, buying power checks will be skipped for all accounts under a JIT enabled correspondent. All selling activity will follow standard protocols since execution of sell trades is based on the account’s position at the time of order submission.

Orders

All executed orders will be included in the EOD JIT reports that are generated after the trading session closes as well as the journaling logic that takes place on T+2. In this example, the purchase of AAPL will be the only trade across the account base for the trade date (T+0).

https://broker-api.sandbox.alpaca.markets/v1/transfers/jit/reports?report_type=detail&system_date=2022-04-29

JIT Reports

https://broker-api.sandbox.alpaca.markets/v1/transfers/jit/reports?report_type=net_summary&system_date=2022-04-29

JIT Reports

https://broker-api.sandbox.alpaca.markets/v1/transfers/jit/reports?report_type=net_payment&system_date=2022-04-29

https://broker-api.sandbox.alpaca.markets/v1/transfers/jit/reports?report_type=net_payment_final&system_date=2022-04-30

JIT Reports

The trade date (T+0) reports are available for consumption using the API shortly after 11:30 PM ET. These files aggregate information on executed trade and non-trade activity at the firm level. Once the reports have been accessed, you should now fund the Money In (IN) account with the amount stated in the in_t2 column in the net_summary.csv or ‘Due to Alpaca’ amount stated in the net_payment.pdf (they are the same amount). In Sandbox, this can be accomplished using sandbox fixtures. In production, this funding process would be accomplished by initiating the wire transfer to Alpaca’s bank account and specifying the IN account in the wire details.

https://broker-api.sandbox.alpaca.markets/v1/trading/accounts/ff1d2206-15d3-4c0e-96e8-a9ffb2fca9e6/account

Account Balances

When interacting with the GET Accounts endpoint, the cash parameter for an account will return a non indicative number. This is reflective of settlement date liabilities as opposed to actual cash in the account since the funds are managed on the partner’s platform. This value will return to $0 on settlement date after the automated journaling process takes place. Allocating funds on the settlement date from the firm level payment to the IN account to bring the customer account to $0 completes the payment for trade date activities.

At 10:30 AM ET on the settlement date, two trading days after the test trades were placed, you will see the following money movement occur.

  1. Before the journaling job, accounts will have a cash balance equal to the settlement date liabilities from the trade date activity.
  2. The funds in the IN account will be used to flatten each account’s cash to $0, which represents the payment of settlement date liabilities.
  3. In the case that selling activity was greater than purchasing activity, remaining funds due to customers will be aggregated into the Money Out (JTO) account and will be transferred to the partner.
  4. In the case that the IN account balance was not sufficient to pay for all customer dues, the JTR will increase by the difference between the amount needed for settlement and the starting IN account balance. This JTR balance will accrue interest starting at business close on settlement date.

From there, sandbox testing is complete and you are ready to move into production trading with the JIT funding model. Alpaca will open the same four accounts in the production environment. If you are a pre-existing customer under the pre-funding model, please contact an Alpaca representative to discuss migration plans.

Trading Considerations

JIT funding comes with a few core changes to the trading and Order Management System (OMS) logic that are distinct from pre-funded accounts.

Buying Power

Buying power checks are not enforced for JIT enabled accounts. This funding flow model does not allow Alpaca to derive the cash value in an account because the funds remain in the partner’s custody until it lands at Alpaca to pay for settlement date liabilities. The onus will be on partners to ensure each account is trading within their proper limits.

API-Based Equity Values

All equity-based values returned via the API will consist of the long market value of the account’s assets. In the pre-funding model, equity values include the trade date cash, however, it will not be possible for Alpaca to apply the account’s cash value into the equity calculation for JIT enabled accounts. Therefore, the onus will be on the partner to manage accounts’ buying power and equity.

Conclusion

With Alpaca’s Just-in-Time funding offering, it is now possible to trade securities using a post-trade settlement model. This helps provide you greater flexibility for money management and enables the creation of a single wallet experience and quicker access to buying power.


Just in Time | Alpaca Docs
Open brokerage accounts, enable trading, and manage the ongoing user experience with Alpaca Broker API

Please note that this article is for general information only and is believed to be accurate as of posting date but may be subject to change. All screenshots are for illustrative purposes only.

Securities brokerage services are provided by Alpaca Securities LLC ("Alpaca Securities"), member FINRA/SIPC, a wholly-owned subsidiary of AlpacaDB, Inc. Technology and services are offered by AlpacaDB, Inc.

This is not an offer, solicitation of an offer, or advice to buy or sell securities, or open a brokerage account in any jurisdiction where Alpaca Securities is not registered (Alpaca is registered only in the United States).



Broker API