Crypto Trading #
We offer crypto trading through API and the Alpaca web dashboard! Trade all day, seven days a week, as frequently as you’d like.
Currently (as of November 18, 2022), cryptocurrency trading is open to select international jurisdictions. and only the following U.S. jurisdictions. To view the supported US regions for crypto trading, click here.
New users in approved jurisdictions can sign up for an account here to start trading crypto now.
Crypto Pairs Trading Learn Content
See Triangular Arbitrage with Coin Pair Trading for hands-on code examples in Python to trade crypto pairs.
Supported Assets #
Alpaca supports over 20+ unique crypto assets across 48 trading pairs. Current trading pairs are based on BTC, USD, and USDT with more assets and trading pairs coming soon.
To query all available crypto assets and pairs you can you use the following API call,
curl --request GET 'https://api.alpaca.markets/v2/assets?asset_class=crypto' \
--header 'Apca-Api-Key-Id: <KEY>' \
--header 'Apca-Api-Secret-Key: <SECRET>'
Below is a sample trading pair object composed of two assets, BTC
and USD
.
{
"id": "276e2673-764b-4ab6-a611-caf665ca6340",
"class": "crypto",
"exchange": "FTXU",
"symbol": "BTC/USD",
"name": "BTC/USD pair",
"status": "active",
"tradable": true,
"marginable": false,
"shortable": false,
"easy_to_borrow": false,
"fractionable": true,
"min_order_size": "0.0001",
"min_trade_increment": "0.0001",
"price_increment": "1"
}
Note that symbology for trading pairs has changed from our previous format, where BTC/USD
was previosly referred to as BTCUSD
. Our API has made proper changes to support the legacy convention as well for backwards compatibility.
For further reference see Assets API.
Supported Orders #
When submitting crypto orders through the Orders API and the Alpaca web dashboard, Market, Limit and Stop Limit orders are supported while the supported
time_in_force
values are gtc
, and ioc
. We accept fractional
orders as well with either notional
or qty
provided.
You can submit crypto orders for a any supported crypto pair via API, see the below cURL POST request.
curl --request POST 'https://paper-api.alpaca.markets/v2/orders' \
--header 'Apca-Api-Key-Id: <KEY>' \
--header 'Apca-Api-Secret-Key: <SECRET>' \
--header 'Content-Type: application/json' \
--data-raw '{
"symbol": "BTC/USD",
"qty": "0.0001",
"side": "buy",
"type": "market",
"time_in_force": "gtc"
}'
The above request submits a market order via API to buy 0.0001 BTC with USD (BTC/USD
pair) that is good till end of day.
Note We only supportgtc
andioc
time in force options for crypto orders.
To learn more see orders and fractional trading.
All cryptocurrency assets are fractionable but the supported decimal points vary depending on the cryptocurrency. See Assets entity for information on fractional precisions per asset.
Note these values could change in the future.
Crypto Market Data #
Historical Crypto Market Data
Alpaca provides free limited crypto data and a more advanced unlimited paid plan. To learn more on our paid plan or to subscribe see Alpaca Data.
To request trading pairs data via REST API, see [Crypto Pricing Data REST API Reference]({{< relref “../api-references/market-data-api/crypto-pricing-data/historical.md” >}}).
The example below requests latest orderbook data (bid and asks) for the following three crypto trading pairs: BTC/USD
, ETH/BTC
and ETH/USD
.
curl --request GET 'https://data.alpaca.markets/v1beta3/crypto/us/latest/orderbooks?symbols=BTC/USD,ETH/BTC,ETH/USD,SOL/USDT' \
--header 'Apca-Api-Key-Id: <KEY>' \
--header 'Apca-Api-Secret-Key: <SECRET>'
{
"orderbooks": {
"BTC/USD": {
"a": [
{
"p": 27539.494,
"s": 0.2632414
},
...
],
"b": [
{
"p": 27511.78083,
"s": 0.26265668
},
...
],
"t": "2023-03-18T13:31:44.932988033Z"
},
"ETH/USD": { ... },
"ETH/BTC": { ... },
"SOL/USDT": { ... }
}
}
Real-time Crypto Market Data
Additionally, you can subcribe to real-time crypto data via Websockets. Example below leverages wscat
to subscribe to:
BTC/USD
trades.ETH/USDT
andETH/USD
quotes.BTC/USD
orderbooksSOL/USDT
bars
$ wscat -c wss://stream.data.alpaca.markets/v1beta3/crypto/us
Connected (press CTRL+C to quit)
< [{"T":"success","msg":"connected"}]
> {"action": "auth", "key": "<KEY>", "secret": "<SECRET>"}
< [{"T":"success","msg":"authenticated"}]
> {"action":"subscribe", "trades":["BTC/USD"], "quotes":["ETH/USDT","ETH/USD"], "orderbooks":["BTC/USD"], "bars":["SOL/USDT"]}
< [{"T":"subscription","trades":["BTC/USD"],"quotes":["ETH/USDT","ETH/USD"],"orderbooks":["BTC/USD"],"bars":["SOL/USDT"],"updatedBars":[],"dailyBars":[]}]
< [{"T":"o","S":"BTC/USD","t":"2023-03-18T13:51:29.754747009Z","b":[{"p":27485.3445,"s":0.25893365},{"p":27466.92727,"s":0.52351568},...],"a":[{"p":27512.92,"s":0.26137249},{"p":27547.9425,"s":0.52011956},...],"r":true}]
< [{"T":"q","S":"ETH/USDT","bp":1815.55510989,"bs":8.24941727,"ap":1818.4,"as":4.15121428,"t":"2023-03-18T13:51:33.256826818Z"}]
< ...
For further reference of real-time crypto pricing data. see [Real-time Data Reference section]({{< relref “../api-references/market-data-api/crypto-pricing-data/realtime.md” >}}).
Transferring Crypto #
Alpaca now offers native on-chain crypto transfers with wallets! If you have crypto trading enabled and reside in an eligible US state or international jurisdiction you can access wallets on the web dashboard via the Crypto Transfers
tab.
Alpaca wallets currently support transfers for Bitcoin, Ether, Solana and USDT (ERC20). To learn more on transferring crypto with Alpaca, see Crypto Wallets FAQs
Wallets API coming soon!
Wallets functionality via API is coming out soon so that you can automate your crypto transfers. We will send out communications and update documentation when its ready.
Crypto Fees #
Alpaca stock trading remains commission-free, where crypto trading includes a small fee per trade dependant on volume. See the below table with volume-tiered fee pricing:
Tier | 30d Crypto Volume (USD) | Maker | Taker |
---|---|---|---|
1 | 0 - 100,000 | 0.15% | 0.25% |
2 | 100,000 - 500,000 | 0.12% | 0.22% |
3 | 500,000 - 1,000,000 | 0.10% | 0.20% |
4 | 1,000,000 - 10,000,000 | 0.08% | 0.18% |
5 | 10,000,000- 25,000,000 | 0.05% | 0.15% |
6 | 25,000,000 - 50,000,000 | 0.02% | 0.13% |
7 | 50,000,000 - 100,000,000 | 0.02% | 0.12% |
8 | 100,000,000+ | 0.00% | 0.10% |
The crypto fee will be charged on the credited crypto asset/fiat (what you receive) per trade. Some examples,
- Buy
ETH/BTC
, you receiveETH
, the fee is denominated inETH
- Sell
ETH/BTC
, you receiveBTC
, the fee is denominated inBTC
- Buy
ETH/USD
, you receiveETH
, the fee is denominated inETH
- Sell
ETH/USD
, you receiveUSD
, the fee is denominated inUSD
To get the fees incured from crypto trading you can use Activities API to query activity_type
by CFEE
or FEE
. See below example of CFEE
object,
{
"id": "20220812000000000::53be51ba-46f9-43de-b81f-576f241dc680",
"activity_type": "CFEE",
"date": "2022-08-12",
"net_amount": "0",
"description": "Coin Pair Transaction Fee (Non USD)",
"symbol": "ETHUSD",
"qty": "-0.000195",
"price": "1884.5",
"status": "executed"
}
Fees are currently calculated and posted end of day. If you query on same day of trade you might not get results. We will be providing an update for fee posting to be real-time in the near future.
For latest information regarding crypto fees see our Crypto FAQs.
Margin and Short Selling #
Cryptocurrencies are non-marginable. This means that you cannot use leverage to
buy them and orders are evaluated against non_marginable_buying_power
.
Cryptocurrencies are not shortable.
Trading Hours #
Crypto trading is offered for 24 hours everyday and your orders will be executed throughout the day.