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.
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:
Once you confirm the order we can see it on our positions page as such:
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!
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:
Below one can see the response with the order object from the API after we sent our order for AAPL.
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.
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 fractionableqty
: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.
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.