Spaces:
Running
Running
File size: 833 Bytes
a9384ce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# from subs.orderdict import orderByValue
import requests
import json
import streamlit as st
import pandas as pd
from environs import Env
env = Env()
env.read_env()
# @st.cache
def get_tickerlist():
response = requests.get(f"{env('HOST')}/Tickerlist_provider?datatype=tickerlist")
response_json = response.json()
companyTicker = pd.read_json(response_json["myData"])
return companyTicker
# @st.cache
def get_plot(selection: str, plottype: str):
assert plottype in ["scatter", "returns", "histogram"]
response = requests.get(
f"{env('HOST')}/Stockticker_provider?plottype={plottype}&selection={selection}"
)
blub = response.json()
fig = json.loads(blub["plot"])
return fig
if __name__ == "__main__":
print(get_tickerlist())
print(get_plot("ADS.DE", "scatter"))
|