File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed
Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 11GOOGLE_SCRIPT_URL = deployed_google_script_url
22APCA_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
Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ Create a `.env` file in the root directory with your credentials:
2323```
2424APCA_API_KEY_ID=your-alpaca-key
2525APCA_API_SECRET_KEY=your-alpaca-secret
26- APCA_API_BASE_URL=https://paper-api.alpaca.markets
2726GOOGLE_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
Original file line number Diff line number Diff line change 77
88API_KEY = os .environ .get ("APCA_API_KEY_ID" )
99API_SECRET = os .environ .get ("APCA_API_SECRET_KEY" )
10+ PAPER = os .environ .get ("ALPACA_PAPER" , "true" ).lower () == "true"
1011
1112
1213def 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 } " )
You can’t perform that action at this time.
0 commit comments