Spaces:
Build error
Build error
import streamlit as st | |
from datetime import datetime | |
# Streamlit app title | |
st.title("MetaTrader 5 Login") | |
# Streamlit input fields | |
login = st.number_input("Login ID", step=1) | |
password = st.text_input("Password", type="password") | |
server = st.text_input("Server") | |
# Button to initialize and log in | |
if st.button("Initialize and Log In"): | |
# Initialize MetaTrader 5 | |
initialized = mt.initialize() | |
if initialized: | |
st.success("MetaTrader 5 initialized successfully.") | |
# Attempt to log in | |
logged_in = mt.login(login=int(login), password=password, server=server) | |
if logged_in: | |
st.success(f"Logged in successfully as {login}.") | |
else: | |
st.error("Failed to log in. Please check your credentials.") | |
else: | |
st.error("Failed to initialize MetaTrader 5.") | |
# Button to shutdown MetaTrader 5 | |
if st.button("Shutdown MetaTrader 5"): | |
mt.shutdown() | |
st.success("MetaTrader 5 has been shut down.") | |