59 lines
2.1 KiB
Python
59 lines
2.1 KiB
Python
import streamlit as st
|
|
import pandas as pd
|
|
from datetime import datetime
|
|
import pytz
|
|
from db.db_connection import create_client
|
|
from pages.journal.trading_journal_page import trading_journal_page, format_datetime
|
|
from pages.screener.technical_scanner_page import technical_scanner_page
|
|
from pages.trading.trading_system_page import trading_system_page
|
|
from pages.trading.trading_plan_page import trading_plan_page
|
|
from pages.backtesting.backtesting_page import backtesting_page
|
|
from trading.journal import (
|
|
create_trades_table, get_open_trades, get_trade_history,
|
|
get_latest_portfolio_value, update_portfolio_value
|
|
)
|
|
from trading.trading_plan import (
|
|
create_trading_plan_table,
|
|
)
|
|
from pages.rules.strategy_guide_page import strategy_guide_page
|
|
from pages.screener.canslim_screener_page import canslim_screener_page, load_scanner_reports
|
|
|
|
def init_session_state():
|
|
"""Initialize session state variables"""
|
|
if 'page' not in st.session_state:
|
|
st.session_state.page = 'Trading Journal'
|
|
|
|
def main():
|
|
st.set_page_config(page_title="Trading System", layout="wide")
|
|
init_session_state()
|
|
|
|
# Sidebar navigation
|
|
st.sidebar.title("Navigation")
|
|
st.session_state.page = st.sidebar.radio(
|
|
"Go to",
|
|
["Strategy Guide", "Trading Journal", "Technical Scanner", "CANSLIM Screener", "Trading System", "Trading Plans", "Backtesting"]
|
|
)
|
|
|
|
# Create necessary tables
|
|
create_trades_table()
|
|
create_trading_plan_table()
|
|
|
|
# Display selected page
|
|
if st.session_state.page == "Strategy Guide":
|
|
strategy_guide_page()
|
|
elif st.session_state.page == "Trading Journal":
|
|
trading_journal_page()
|
|
elif st.session_state.page == "Technical Scanner":
|
|
technical_scanner_page()
|
|
elif st.session_state.page == "CANSLIM Screener":
|
|
canslim_screener_page()
|
|
elif st.session_state.page == "Trading System":
|
|
trading_system_page()
|
|
elif st.session_state.page == "Trading Plans":
|
|
trading_plan_page()
|
|
elif st.session_state.page == "Backtesting":
|
|
backtesting_page()
|
|
|
|
if __name__ == "__main__":
|
|
main()
|