Skip to content

Commit aa24bff

Browse files
authored
Update config.py
1 parent 0a626be commit aa24bff

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

config.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# Configurations for the Schwab API client
1+
import os
2+
from dotenv import load_dotenv
23

3-
# Base URLs for different parts of the Schwab API
4-
API_BASE_URL = "https://api.schwabapi.com"
5-
TRADER_BASE_URL = f"{API_BASE_URL}/trader/v1"
6-
MARKET_DATA_BASE_URL = f"{API_BASE_URL}/marketdata/v1"
7-
ORDER_BASE_URL = f"{API_BASE_URL}/accounts"
4+
load_dotenv()
85

9-
# Potential other configuration settings
10-
REQUEST_TIMEOUT = 30 # Timeout for API requests in seconds
11-
RETRY_STRATEGY = {
12-
'total': 3, # Total number of retries to allow
13-
'backoff_factor': 1 # Factor by which the delay between retries will increase
14-
}
15-
16-
# Security settings (such as token refresh thresholds, etc.)
17-
TOKEN_REFRESH_THRESHOLD_SECONDS = 300 # Time in seconds before token expiration to attempt refresh
18-
19-
# Developer specific settings, like debug modes or log configurations
20-
DEBUG_MODE = False
21-
LOGGING_CONFIG = {
22-
'level': 'INFO',
23-
'format': '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
24-
}
6+
class APIConfig:
7+
API_BASE_URL = "https://api.schwabapi.com"
8+
TRADER_BASE_URL = f"{API_BASE_URL}/trader/v1"
9+
MARKET_DATA_BASE_URL = f"{API_BASE_URL}/marketdata/v1"
10+
ORDER_BASE_URL = f"{API_BASE_URL}/accounts"
11+
REQUEST_TIMEOUT = 30 # Timeout for API requests in seconds
12+
RETRY_STRATEGY = {
13+
'total': 3, # Total number of retries to allow
14+
'backoff_factor': 1 # Factor by which the delay between retries will increase
15+
}
16+
TOKEN_REFRESH_THRESHOLD_SECONDS = 300 # Time in seconds before token expiration to attempt refresh
17+
DEBUG_MODE = False
18+
LOGGING_CONFIG = {
19+
'level': 'INFO',
20+
'format': '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
21+
}
22+
APP_KEY = os.getenv('APP_KEY')
23+
APP_SECRET = os.getenv('APP_SECRET')
24+
CALLBACK_URL = os.getenv('CALLBACK_URL')

0 commit comments

Comments
 (0)