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
crypto-api-guides

Getting Started with Alpaca Crypto API

Sasha Cotterell
Sasha Cotterell
Alpaca is excited to announce the launch of Crypto Trading API

How to Sign Up for Crypto on Alpaca

If you’re new to Alpaca, please follow the directions below to sign up for a brokerage account and sign your crypto trading agreement to get started.

Go to https://app.alpaca.markets/signup to create your account. Once you sign up, you will see the dashboard below. Please select either “Individual Account” or “Business Trading Account” to begin the onboarding process.

Select individual account to begin your brokerage application

As the last step of your onboarding, you will be asked to read and agree to the terms of Alpaca’s crypto agreement.

Alpaca's crypto agreement at the last step of onboarding

How to Enable Crypto Trading on Your Existing Trading API Account

If you’re already trading with Alpaca Trading API, adding cryptocurrency to your workflow is easy. Please login to your account at https://app.alpaca.markets/login to open the Trading API dashboard. Once in your account, make sure you have selected “Live Trading” on the top left corner of the dashboard and are not in “Paper Trading.”

Expand the left side navigation if it is collapsed
Switch to your live account at the top left of the dashboard


From there, open the “Account” drop down on the left navigation and select “Configuration.” From there, you will be able to sign your crypto agreement to enable your account.

Configuration is under the Account section of the left-side navigation

Which Coins are Available?

Currently, Alpaca allows the following coins to be traded with the below ticker symbols. We’re actively working on adding more coins.

  • Aave AAVEUSD
  • Algorand ALGOUSD
  • Avalanche AVAXUSD
  • Basic Attention Token BATUSD
  • Bitcoin BTCUSD
  • Bitcoin Cash BCHUSD
  • ChainLink Token LINKUSD
  • Dai DAIUSD
  • Dogecoin DOGEUSD
  • Ethereum ETHUSD
  • Graph Token GRTUSD
  • Litecoin LTCUSD
  • Maker MKRUSD
  • Matic MATICUSD
  • Near Protocol NEARUSD
  • PAX Gold PAXGUSD
  • Shiba Inu SHIBUSD
  • Solana SOLUSD
  • Sushi SUSHIUSD
  • Tether USDTUSD
  • Tron TRXUSD
  • Uniswap Protocol Token UNIUSD
  • Wrapped BTC WBTCUSD
  • Yearn.Finance YFIUSD

How to Place a Crypto Trade on the Trading API Dashboard

To buy or sell a coin on the Trading API Dashboard, login and make sure you are in your Live Trading account. Once you’re on the dashboard, you will see a Buy and Sell box on the right side of the screen (highlighted in the image below). To place a trade, type in the coin symbol, select your order type and quantity, then review the order before placing. Select “Confirm Order” to place the trade.

Trade directly from the Trading API dashboard

How to Place a Crypto Trade via API Call

To buy or sell a coin, simply call the regular POST/v2/orders endpoint with the correct parameters, inputting the symbol for the desired cryptocurrency you’re looking to trade instead of a standard stock symbol. See the list of available symbols above.

An easy way to access the Crypto Trading API is by using the existing SDK libraries available in Python, C#/.NET, JavaScript and Go.  

For example in Python, to place a limit order for Bitcoin, simply use the syntax you normally would to place a trade for a stock and just use the symbol for Bitcoin instead, BTCUSD.

import alpaca_trade_api as tradeapi
    
alpaca = tradeapi.REST('YOUR_API_KEY','YOUR_API_SECRET')
    
order = alpaca.submit_order(
	symbol='BTCUSD',
	qty=1,
	type='limit',
	side='buy',
	limit_price=57000,
	time_in_force='day')

Available order types for cryptocurrency are Market, Limit & Stop-Limit orders. Regarding TIF (time-in-force), cryptocurrency trades offer GTC (Good Till Cancel), IOC (Immediate or Cancel), FOK (Fill or Kill), and GTD (Good Till Date).

Crypto is also available on your Paper Trading account using the same methods as described above. Please ensure that you’re using the Paper endpoints (Domain root paper-api.alpaca.markets and using your Paper-specific keys) to make any calls. All Paper accounts, regardless of region, are able to access Cryptocurrency trading.

How is Buying Power Calculated?

Buying power is calculated as follows:
Non-Marginable Buying Power = Settled Cash - Pending Fills

Cryptocurrency is a non-marginable asset class. This also means that all cryptocurrency assets have 100% maintenance margin requirements.

Does Market Data Include Crypto?

Market Data is available for the above coins via our Market Data API with historical data going back 5 years. Learn more about the Crypto Data API in the documentation.

# gets hourly bar data for Bitcoin
bar_data = alpaca.get_crypto_bars('BTCUSD', TimeFrame.Hour, "2021-06-08", "2021-06-09").df
 
# gets trade data for Bitcoin
trade_data = alpaca.get_crypto_trades('BTCUSD', "2021-06-08", "2021-06-09").df
 
# gets quote data for Bitcoin
quote_data = alpaca.get_crypto_quotes('BTCUSD',"2021-06-08", "2021-06-09").df

Important Considerations for Trading Crypto

There are a few important things to note about trading cryptocurrency on Alpaca:

  1. Wallets are not yet available; Alpaca holds your coins in trust on your behalf, and you can buy and sell at any time. Spending or transferring your Alpaca-held crypto, however, is not yet available.
  2. You will require a fully authorized trading account in order to trade cryptocurrency with Alpaca. If you are only interested in testing out this functionality, any user is welcome to use the Paper Trading API or Dashboard to interact with the cryptocurrency marketplace.
  3. The crypto market does not have opening or closing times like the traditional securities exchanges; trades can occur at any time of day.
  4. Pattern Day Trading flags and associated rules do not apply to cryptocurrency trading; crypto trades do not change the PDT status of your account and are not reflected in the rules for PDT.
  5. Cryptocurrency is a non-marginable asset class.
  6. Cryptocurrency cannot be shorted.
  7. Currently, cryptocurrency trading is open to select international jurisdictions and only the following U.S. jurisdictions: Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Delaware, District of Columbia, Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana, Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, North Carolina, North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Rhode Island, South Carolina, South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, Washington, West Virginia, Wisconsin, and Wyoming.

The Paper Trading API is offered by AlpacaDB, Inc. and does not require real money or permit a user to transact in real securities in the market. Providing use of the Paper Trading API is not an offer or solicitation to buy or sell securities, securities derivative or futures products of any kind, or any type of trading or investment advice, recommendation or strategy, given or in any manner endorsed by AlpacaDB, Inc. or any AlpacaDB, Inc. affiliate and the information made available through the Paper Trading API is not an offer or solicitation of any kind in any jurisdiction where AlpacaDB, Inc. or any AlpacaDB, Inc. affiliate is not authorized to do business.

Please note that this article is for informational purposes only. The example above is for illustrative purposes only. Actual crypto prices may vary depending on the market price at that particular time. Alpaca Crypto LLC does not recommend any specific cryptocurrencies.

Cryptocurrency is highly speculative in nature, involves a high degree of risks, such as volatile market price swings, market manipulation, flash crashes, and cybersecurity risks. Cryptocurrency is not regulated or is lightly regulated in most countries. Cryptocurrency trading can lead to large, immediate and permanent loss of financial value. You should have appropriate knowledge and experience before engaging in cryptocurrency trading. For additional information please click here.

Cryptocurrency services are made available by Alpaca Crypto LLC ("Alpaca Crypto"), a FinCEN registered money services business (NMLS # 2160858), and a wholly-owned subsidiary of AlpacaDB, Inc. Alpaca Crypto is not a member of SIPC or FINRA. Cryptocurrencies are not stocks and your cryptocurrency investments are not protected by either FDIC or SIPC. Please see the Disclosure Library for more information.

This is not an offer, solicitation of an offer, or advice to buy or sell cryptocurrencies, or open a cryptocurrency account in any jurisdiction where Alpaca Crypto is not registered or licensed, as applicable.

crypto-api-guidesCrypto