We are thrilled to announce the launch of Alpaca-py 🎉 our official Python SDK that offers app developers and traders a versatile and developer-friendly user interface that enables you to easily interact with Alpaca's complete suite of APIs for building your own trading app to trading to streaming real-time crypto and stock market data.
Alpaca Python SDK Built to Enhance Developer Experience
A Developer-Friendly Python SDK for all of Alpaca APIs
Due to its simplicity and versatility, Python is one of today’s most popular programming languages, with an estimated 8.2 million users 1.
Alpaca-py is a Python library built by Alpaca that offers complete module structures with relevant tools, documentation, code samples, examples, and guides to provide you with a cohesive interface to interact with Alpaca’s complete set of API products.
In addition to the Market Data and Trading APIs, Alpaca-py also lets you use Broker API and Alpaca Connect through Python. Broker and Connect partners can also use Alpaca-py to provide investment services to their users. Alpaca-py also makes it easy to use python to create your own investment app on Alpaca.
Compared to the previous SDK alpaca-trade-api, Alpaca-py has an upgraded idiomatic Python codebase and generated documentation from docstrings. The SDK includes well-documented models that simplify the process of submitting large object payloads.
Here is an example of submitting a market order in Alpaca-py.
Note: Alpaca Connect Marketplace documentation will be coming soon.
What will happen to the previous Python SDK?
Moving forward, we will continue to support the alpaca-trade-api SDK until the end of 2022. This means we will patch bugs but will stop pushing new features. At the end of this year, we will deprecate the repository and will no longer push any new changes or patches.
Key Features of Alpaca-py
Alpaca-py allows developers and traders to:
- Interact with Alpaca complete API products (Market Data, Trading, Broker) with detailed documentation
- Trade and place orders for crypto and stocks under a uniform interface
- Access 6+ years of historical data for 20+ cryptocurrencies, 5000+ US Stocks, ETFs, ADRs, and more
- Stream live market data for all of our crypto and stock offerings
- Create and manage thousands of brokerage accounts on behalf of others with Broker API
How to Install Alpaca-py?
Alpaca-py is supported on Python 3.7+. You can install Alpaca-py seamlessly by using pip.
In order to use Alpaca’s services, you’ll need to sign up for Alpaca’s Trading API or Broker API account and retrieve your API keys.
Signing up is completely free and takes only a few minutes. Sandbox environments are available to freely experiment and test the API. To use the sandbox environment, you will need to provide sandbox or paper keys.
API keys are passed into Alpaca-py through either TradingClient, HistoricalDataClient, MarketDataStream, CryptoDataStream, or BrokerClient.
Get Started with Alpaca-py
Check our Alpaca-py documentation to get started and for additional information.
Happy Coding! 🛠
Please note that this article is for general informational purposes only. All screenshots are for illustrative purposes only.
Securities brokerage services are provided by Alpaca Securities LLC ("Alpaca Securities"), member FINRA/SIPC, a wholly-owned subsidiary of AlpacaDB, Inc. Technology and services are offered by AlpacaDB, Inc.
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. Depending on your location, cryptocurrency services may be provided by West Realm Shires Services, Inc., d/b/a FTX US (NMLS #1957771). Please see the Disclosure Library for more information.
This is not an offer, solicitation of an offer, or advice to buy or sell securities or cryptocurrencies, or open a brokerage account or cryptocurrency account in any jurisdiction where Alpaca Securities, Alpaca Crypto, or FTX US respectively, are not registered or licensed, as applicable.