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.
Search
Trading API

How to Place an Order Using the Fractional Shares API?

Alpaca Team
Alpaca Team

This tutorial is a step-by-step demonstration of how to place an order with the fractional shares API and is part of the Alpaca 101 Tutorial Series. We will move forward assuming that you’ve registered on the Alpaca website. If you haven’t please visit Alpaca and sign up. Feel free to check out the other tutorials in this series at Alpaca Resources.


What is a Fractional Share?

Fractional Shares allow people to trade stocks and ETF’s at fractional increments. Starting as small as 0.000000001 of a share (or a notional amount of $1.00) Alpaca users now have the ability to incorporate fractional shares into their algorithm via the Fractional Share API. With over 2000 supported stocks and ETFs based on the associated market cap, trading volume, and stock prices, anyone with a live or paper trading account at Alpaca can start trading fractional shares today. As with trading whole-increment shares, trading fractional is still commission-free. Find the tutorial on how to place a fractional-order below!


How to Place a Fractional Order?

Step 1: Fractionals through the Alpaca Dashboard

Log in to your Alpaca account and click on “Paper Overview”. That should lead to a web page as shown in the picture below.

As we can see, a new paper trading account has starting equity of $100,000 and a buying power of $400,000. These can be reset at any time during your usage by clicking the “Reset” button and they will return back to their original equity of $100,000 and a buying power of $400,000 respectively.

Dashboard

One can buy a share fractionally through the Web Dashboard just like they can with an integer number of shares. Navigate to the Order Box in the right corner and select the symbol you wish to trade. For this tutorial, AAPl was used however this is solely for educational purposes. Now choose your order type, right now fractional trading are only supported with market orders. For market orders, you can either buy in shares or dollars and enter the respective amount. Lastly, you can select the Time-In-Force however again fractionals are only supported with Day. See an example below:

Order Box


Once you confirm the order we can see it on our positions page as such:

Positions

Step 2: Fractional Trading through Postman

For this tutorial, we will be implementing Postman as we need to be sending raw requests to the API encoded in a JSON body. As of right now, fractional trading is only offered with the API through raw requests. That being said, either generate new API keys or fetch your previously generated paper API keys.  Now that you have your keys ready, open up the Postman application.

  • To initiate your first API request, click the + tab in the Postman UI.
  • Add the following request URL:
    https://paper-api.alpaca.markets/v2/account
  • Add your API keys
    Click the Headers section and add two keys called APCA-API-KEY-ID and APCA-API-SECRET-KEY. Enter your key values in the VALUE column.
  • Hit the Send button

You should be able to see various account information from this API call. Now you’re ready to trade!

Postman Account

Step 3: Sending a Fractional Order

Next, let’s create our raw request to place a fractional order. In this tutorial, we will be placing a market order for $150.00 of AAPL with time in force = day. To do this, I am changing the request to POST, changing the endpoint to be /v2/orders, and entering the following JSON body:

{
"symbol": "AAPL",
"notional": "150",
"side": "buy",
"type": "market",
"time_in_force": "day"
}
JSON Body

Below one can see the response with the order object from the API after we sent our order for AAPL.

Order Object

Let’s check our Alpaca Portfolio to confirm what we have seen through the API. At the time of purchase, AAPL traded at $126.64. In our tutorial, we purchased a notional amount of $150.00 therefore we should see 1.184366364 shares in our account. Below is a screenshot of our positions which confirms this.

Positions


Great! Now, moving forward here are some important points to remember:

  • Our endpoint is the same as the previous orders v2 endpoint
  • For fractional orders, one can input the field notional”: Enter_notional_amount_here or a fractionable qty: Enter_fraction_shares_here
  • That being said Notional does not work with qty. They are mutually exclusive
  • As of right now, fractional trading is only offered with the API through raw requests

Thank you for using Alpaca. Here are a couple more links that you might be interested in.

Alpaca GitHub repository

Alpaca
Alpaca builds an API for free stock trading. Alpaca has 41 repositories available. Follow their code on GitHub.

Alpaca Blog

Alpaca Blog | API for Stock Trading
Alpaca Blog for product updates, new integration, and more. Alpaca’s commission-free trading API is built for algorithmic trading and building apps

Alpaca Forum

Alpaca Community Forum
Alpaca user forum for FAQ, feature requests, many discussions around Alpaca stock trading API

Alpaca API documentation

Orders at Alpaca
Using Alpaca Trade API, a user can monitor, place and cancel their orders with Alpaca. Each order has a unique identifier provided by the client. This client-side unique order ID will be automatically generated by the system if not provided by the client, and will be returned as part of the order ob…

You can also follow Alpaca and our weekly updates on our LinkedIn, Alpaca Community Slack, and @AlpacaHQ on Twitter!


Alpaca does not make recommendations with regard to fractional share trading, whether to use fractional shares at all, or whether to invest in any specific security. A security’s eligibility on the list of fractional shares available for trading is not an endorsement of any of the securities, nor is it intended to convey that such stocks have low risk. Fractional share transactions are executed either on a principal or riskless principal basis, and can only be bought or sold with market orders during normal market hours.

Commission-Free trading means that there are no commission charges for Alpaca self-directed individual cash brokerage accounts that trade U.S. listed securities through an API. Relevant SEC and FINRA fees may apply.

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


Trading API

Alpaca Team

API-first stock brokerage. *Securities are offered through Alpaca Securities LLC* http://alpaca.markets/#disclosures