Skip to content

Commit 9e9e9ae

Browse files
Update .env.template and README to include ALPACA_PAPER variable; modify alpaca_integration.py to utilize PAPER setting for client initialization.
1 parent fb51494 commit 9e9e9ae

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

.env.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
GOOGLE_SCRIPT_URL=deployed_google_script_url
22
APCA_API_KEY_ID=your_alpaca_key_id
3-
APCA_API_SECRET_KEY=your_alpaca_secret_key
3+
APCA_API_SECRET_KEY=your_alpaca_secret_key
4+
ALPACA_PAPER=true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Create a `.env` file in the root directory with your credentials:
2323
```
2424
APCA_API_KEY_ID=your-alpaca-key
2525
APCA_API_SECRET_KEY=your-alpaca-secret
26-
APCA_API_BASE_URL=https://paper-api.alpaca.markets
2726
GOOGLE_SCRIPT_URL=your-google-apps-script-url
27+
ALPACA_PAPER=true # Set to 'false' to use live trading (default is 'true' for paper trading)
2828
```
2929

3030
### 3. Install Dependencies

alpaca_integration.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77

88
API_KEY = os.environ.get("APCA_API_KEY_ID")
99
API_SECRET = os.environ.get("APCA_API_SECRET_KEY")
10+
PAPER = os.environ.get("ALPACA_PAPER", "true").lower() == "true"
1011

1112

1213
def init_alpaca_client():
1314
try:
14-
client = TradingClient(API_KEY, API_SECRET, paper=True)
15-
print("Alpaca client initialized.")
15+
client = TradingClient(API_KEY, API_SECRET, paper=PAPER)
16+
print(f"Alpaca client initialized. Paper mode: {PAPER}")
1617
return client
1718
except Exception as e:
1819
print(f"Error initializing Alpaca client: {e}")

0 commit comments

Comments
 (0)