How-To

Welcome to the how-to section of our documentation! Here, you’ll find some examples of how to do specific tasks using the Alpaca API in supported programming languages.

Before running these examples, it is recommended that you set the following environment variables to the corresponding values found on your dashboard. Please be aware of whether you’re using the values for your paper trading account or for your live trading account.

APCA_API_BASE_URL
APCA_API_KEY_ID
APCA_API_SECRET_KEY

On Linux, this can be done with export ENV_VAR_NAME=DASHBOARD_VALUE. (You’ll probably want to add them to your ~/.bash_profile so they stay set when the machine restarts.) On Windows, you can instead use setx ENV_VAR_NAME "DASHBOARD_VALUE". After running these commands, you’ll want to open a new command prompt window so the variables are available.


Suggestions or questions?
We're always happy to hear from you. You can contribute to these docs on GitHub, or you can join our Community Slack to get help from other community members and the Alpaca team.