Initial commit: Touch & Turn Scalping Bot with fully automated execution, backtesting, and ISA screening
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import os
|
||||
import logging
|
||||
from dotenv import load_dotenv
|
||||
from src.api.client import Trading212Client
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def test_connection():
|
||||
load_dotenv()
|
||||
api_key_id = os.getenv("TRADING212_API_KEY_ID")
|
||||
api_key = os.getenv("TRADING212_API_KEY")
|
||||
base_url = os.getenv("TRADING212_BASE_URL", "https://demo.trading212.com/api/v0/")
|
||||
|
||||
if not api_key_id or not api_key:
|
||||
logger.error("API Key ID or API Key is missing in .env")
|
||||
return
|
||||
|
||||
client = Trading212Client(api_key_id, api_key, base_url)
|
||||
|
||||
try:
|
||||
logger.info(f"Connecting to Trading212 at {base_url}...")
|
||||
account_info = client.get_account_info()
|
||||
logger.info("Successfully connected!")
|
||||
logger.info(f"Account Info: {account_info}")
|
||||
except Exception as e:
|
||||
logger.error(f"Connection failed: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_connection()
|
||||
Reference in New Issue
Block a user