![]() import osĪpi = tradeapi.REST('APCA_API_KEY_ID', 'APCA_API_SECRET_KEY', api_version='v2') The account variable is making sure that you have an account with Alpaca and that it is active. The os.environ section allows you to specify which environment you are connecting to - paper trading or live trading.ĪPCA_API_KEY_ID is where you will place your API Key ID, APCA_API_SECRET_KEY is where you will place your secret key. Below is a snippet of the code found in the GitHub Repo. Follow Alpaca’s documentation on how to download alpaca_trade_api. You will need to import the following packages: os, and alpaca_trade_api as tradeapi. These can be found on the right side of the dashboard, and below the API Key ID is your very own secret key. This example will be shown using the paper trading keys. You can access your Alpaca API keys from the Alpaca Dashboard, once your account is set up. '''All the code necessary to connect to API, trading logic and sending email notification will go in here''' That function will then be called in Google Cloud. The first thing to remember with the Python script is that you will need to create only one function. ![]() The next few steps will go over how to structure the Python script, attach the Alpaca API, send an email notification, and an example of how to build trading logic. In this example, it will be labeled, “Algo-trading”. ![]() Do this by clicking on “Activate” in the top right corner.įill out the necessary information, then create a “New Project”. ![]() Once you have created your account, start the free trial. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |