Example #1
0
from liualgotrader.backtester import BackTestDay, backtest
from liualgotrader.common import config, database
from liualgotrader.common.data_loader import DataLoader  # type: ignore

try:
    config.build_label = pygit2.Repository("../").describe(
        describe_strategy=pygit2.GIT_DESCRIBE_TAGS)
except pygit2.GitError:
    import liualgotrader

    config.build_label = liualgotrader.__version__ if hasattr(
        liualgotrader, "__version__") else ""  # type: ignore

nest_asyncio.apply()

loop.run_until_complete(database.create_db_connection())
st.title("Liu Algo Trading Framework")
st.markdown("## **Back-testing & Analysis tools**")

app = st.sidebar.selectbox("select app", ("back-test", "analyzer"))

new_bid: str = ""
est = pytz.timezone("America/New_York")

if app == "back-test":
    new_bid = ""
    st.text("Back-testing a past trading day, or a specific batch-id.")

    day_to_analyze = st.date_input("Pick day to analyze", value=date.today())

    selection = st.sidebar.radio(
Example #2
0
def event_loop():
    loop = asyncio.get_event_loop()
    loop.run_until_complete(create_db_connection())
    yield loop
    loop.close()
Example #3
0
def test_returns() -> bool:
    loop = asyncio.get_event_loop()
    loop.run_until_complete(create_db_connection())
    td = analysis.calc_batch_returns("0664dc2c-f126-4c7f-a069-c5dc246e2df4")
    print(td)
    return True