You've successfully subscribed to Alpaca Resources
Great! Next, complete checkout for full access to Alpaca Resources
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.
  • Home
  • We're hiring
  • Support
  • Forum
  • Docs
  • Log in
  • Sign up

Commission-free Crypto Trading API is here!

Broker API

Open-Sourcing Commission-Free Trading App Code for Alpaca Broker API

Crystal Xue
Crystal Xue

Invest commission-free*, easily search for and trade stocks you’re interested in, and choose from hundreds of stocks and ETFs, many of which are available for fractional trading.

Modern fintech is largely about user experience and virtually all Alpaca partners are building mobile app interfaces to deliver improved user experience. Here at Alpaca, we are committed to providing the best developer experience, and as part of that effort, we are open-sourcing the reference implementation of a commission-free mobile trading app called Ribbit, which is built on our own Broker API.

​​Written in Swift for iOS and Java for Android, Ribbit has an intuitive and easy-to-use interface. While it doesn’t have production-ready code, we encourage you to read more about how Ribbit uses specific Broker API requests in our documentation and check out the open-source code.

The codebase on GitHub is split up into the Android frontend, iOS frontend, and backend.

Example Mobile App
See what you can build with the Broker API!

Here are the highlights of what you can learn from Ribbit and implement in your own trading app:

Implementing bank account integrations and funding flows for your users can be intimidating if you aren’t aware of the financial and privacy requirements needed for these features. Broker API makes this easy and intuitive. Ribbit uses Plaid to verify bank account information so Alpaca can simply link the verified information with the brokerage account. To link specific bank accounts and safely execute transfers, Ribbit utilizes the funding capabilities offered under Broker API.

Learn more about how funding works through Alpaca by reading our documentation here.

How to trade stocks and ETFs with zero commission fees

With Alpaca, your users can buy and sell shares with no commission fees*. Fractional trading is available for a select list of stocks. Ribbit utilizes Trading API, which offers the ability to manage orders, positions, watchlists, portfolio history, and even customize trading configurations specific to each user.

Read more about Trading API here.

func (a *AccountService) createOrder(c *gin.Context) {
	id, _ := c.Get("id")
	user := a.svc.GetProfile(c, id.(int))
	if user != nil && user.AccountID != "" {
		client := &http.Client{}
		accountID := user.AccountID

		req, err := http.NewRequest("POST", os.Getenv("BROKER_API_BASE")+"/v1/trading/accounts/"+accountID+"/orders", c.Request.Body)
		if err != nil {
			fmt.Print(err.Error())
		}

		req.Header.Add("Authorization", os.Getenv("BROKER_TOKEN"))
		response, err := client.Do(req)

		if err != nil {
			fmt.Print(err.Error())
		}

		responseData, err := ioutil.ReadAll(response.Body)
		if err != nil {
			log.Fatal(err)
		}

		var responseObject interface{}
		json.Unmarshal(responseData, &responseObject)

		c.JSON(response.StatusCode, responseObject)
		return
	}
	c.JSON(http.StatusBadRequest, gin.H{
		"message": "Couldn't create order.",
	})
}
How Ribbit uses the Orders API to create an order

How to find and track stocks with Alpaca Market Data API

Alpaca’s Market Data API lets your users stay up-to-date on stocks they’re interested in and access both historical and real time data on them. In the above screen, Ribbit uses historical data to create the stock’s graph that shows the change in price over time. This can even be broken down to drill further into daily, weekly, monthly, and yearly views. Ribbit also uses real-time data to get the current price of the stock so that users can make decisions with the most up-to-date information.

To read more about Market Data API and our different plans, take a look at our documentation here.

What else does Ribbit offer?

Ribbit demonstrates how a user can interact with your trading app, and how easy it is to accomplish this using Broker API. To deep dive into which APIs are used to accomplish all the different functionality, head to our Ribbit documentation here. See the steps below for how a user would sign up and get started with executing trades right away:

  1. Create a Ribbit login email address and for the update password

2. Review account information and confirm that all details are correct

3. Connect a bank account

4. Add funds

5. Find stocks. In this example, we’re using Tesla ($TSLA).

6. Place the order for $50 worth of TSLA

7. View portfolio history

See your portfolio value and favorite stocks

*Relevant SEC and FINRA fees may apply.

About Alpaca Broker API

Alpaca Broker API is a suite of APIs that enables you to open customer accounts, offer commission-free trading, and manage the customer experience, while Alpaca manages US brokerage compliance. From account onboarding and funding to fractional trading support, learn more about Broker API in our docs.

Get details at alpaca.markets/broker
Resources | Alpaca Broker API
Tutorials, Examples, and Use Cases of Alpaca Broker API

We’re always looking to evolve and improve Broker API — if you have thoughts or questions, don’t hesitate to get in touch at support@alpaca.markets or @AlpacaHQ on Twitter.


Please note that this code is for example use only and is not intended to be used for distribution. The code is provided as an open-source for the purpose of demonstration of the Broker API usage. It is not designed for production use and Alpaca does not offer official support of the code.

This article is for educational and informational purposes only. All screenshots are for illustrative purposes only. Alpaca does not recommend any specific securities or investment strategies.

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.

Broker API