# openjdk install
!apt-get update
!apt-get install -y unzip openjdk-8-jre-headless xvfb libxi6 libgconf-2-4
# Install Chrome.
!apt-get -y install wget
!wget http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-beta/google-chrome-beta_91.0.4472.27-1_amd64.deb
!apt -y install ./google-chrome-beta_91.0.4472.27-1_amd64.deb
# Install ChromeDriver.
!wget -N https://chromedriver.storage.googleapis.com/79.0.3945.36/chromedriver_linux64.zip -P ~/
!unzip ~/chromedriver_linux64.zip -d ~/
!rm ~/chromedriver_linux64.zip
!mv -f ~/chromedriver /usr/local/bin/chromedriver
!chown root:root /usr/local/bin/chromedriver
!chmod 0755 /usr/local/bin/chromedriver
# Install Selenium
!pip install selenium==3.141.0
!pip install chromedriver-py==91.0.4472.19
!pip install beautifulsoup4
!pip install ipdb
!pip install pystan==2.19.1.1
!pip install prophet
!pip install anvil-uplink
!pip install cvxpy
!pip install cvxopt
!pip install PyPortfolioOpt
Hit:1 http://security.debian.org/debian-security buster/updates InRelease
Hit:2 http://deb.debian.org/debian buster InRelease
Hit:3 http://deb.debian.org/debian buster-updates InRelease
Get:4 http://dl.google.com/linux/chrome/deb stable InRelease [1,811 B]
Get:5 http://dl.google.com/linux/chrome/deb stable/main amd64 Packages [1,092 B]
Fetched 2,903 B in 1s (3,464 B/s)
Package openjdk-8-jre-headless is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'openjdk-8-jre-headless' has no installation candidate
wget is already the newest version (1.20.1-1.1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
--2021-10-25 03:06:35-- http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-beta/google-chrome-beta_91.0.4472.27-1_amd64.deb
Resolving dl.google.com (dl.google.com)... 142.250.188.46, 2607:f8b0:4004:82a::200e
Connecting to dl.google.com (dl.google.com)|142.250.188.46|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 80906960 (77M) [application/x-debian-package]
Saving to: ‘google-chrome-beta_91.0.4472.27-1_amd64.deb.1’
google-chrome-beta_ 100%[===================>] 77.16M 23.6MB/s in 3.3s
2021-10-25 03:06:39 (23.6 MB/s) - ‘google-chrome-beta_91.0.4472.27-1_amd64.deb.1’ saved [80906960/80906960]
Note, selecting 'google-chrome-beta' instead of './google-chrome-beta_91.0.4472.27-1_amd64.deb'
google-chrome-beta is already the newest version (91.0.4472.27-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
--2021-10-25 03:06:41-- https://chromedriver.storage.googleapis.com/79.0.3945.36/chromedriver_linux64.zip
Resolving chromedriver.storage.googleapis.com (chromedriver.storage.googleapis.com)... 172.217.1.208, 2607:f8b0:4004:c06::80
Connecting to chromedriver.storage.googleapis.com (chromedriver.storage.googleapis.com)|172.217.1.208|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4875160 (4.6M) [application/zip]
Saving to: ‘/root/chromedriver_linux64.zip’
chromedriver_linux6 100%[===================>] 4.65M --.-KB/s in 0.05s
2021-10-25 03:06:41 (86.3 MB/s) - ‘/root/chromedriver_linux64.zip’ saved [4875160/4875160]
Archive: /root/chromedriver_linux64.zip
inflating: /root/chromedriver
Requirement already satisfied: selenium==3.141.0 in /root/venv/lib/python3.7/site-packages (3.141.0)
Requirement already satisfied: urllib3 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from selenium==3.141.0) (1.26.7)
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command.
Requirement already satisfied: chromedriver-py==91.0.4472.19 in /root/venv/lib/python3.7/site-packages (91.0.4472.19)
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command.
Requirement already satisfied: beautifulsoup4 in /root/venv/lib/python3.7/site-packages (4.10.0)
Requirement already satisfied: soupsieve>1.2 in /root/venv/lib/python3.7/site-packages (from beautifulsoup4) (2.2.1)
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command.
Requirement already satisfied: ipdb in /root/venv/lib/python3.7/site-packages (0.13.9)
Requirement already satisfied: ipython>=7.17.0 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipdb) (7.28.0)
Requirement already satisfied: decorator in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipdb) (5.1.0)
Requirement already satisfied: setuptools in /root/venv/lib/python3.7/site-packages (from ipdb) (58.1.0)
Requirement already satisfied: toml>=0.10.2 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from ipdb) (0.10.2)
Requirement already satisfied: matplotlib-inline in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=7.17.0->ipdb) (0.1.3)
Requirement already satisfied: pexpect>4.3 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=7.17.0->ipdb) (4.8.0)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=7.17.0->ipdb) (3.0.20)
Requirement already satisfied: pygments in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=7.17.0->ipdb) (2.10.0)
Requirement already satisfied: traitlets>=4.2 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=7.17.0->ipdb) (4.3.3)
Requirement already satisfied: backcall in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=7.17.0->ipdb) (0.2.0)
Requirement already satisfied: jedi>=0.16 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=7.17.0->ipdb) (0.17.2)
Requirement already satisfied: pickleshare in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from ipython>=7.17.0->ipdb) (0.7.5)
Requirement already satisfied: parso<0.8.0,>=0.7.0 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from jedi>=0.16->ipython>=7.17.0->ipdb) (0.7.1)
Requirement already satisfied: ptyprocess>=0.5 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from pexpect>4.3->ipython>=7.17.0->ipdb) (0.7.0)
Requirement already satisfied: wcwidth in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=7.17.0->ipdb) (0.2.5)
Requirement already satisfied: six in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from traitlets>=4.2->ipython>=7.17.0->ipdb) (1.16.0)
Requirement already satisfied: ipython-genutils in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from traitlets>=4.2->ipython>=7.17.0->ipdb) (0.2.0)
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command.
Requirement already satisfied: pystan==2.19.1.1 in /root/venv/lib/python3.7/site-packages (2.19.1.1)
Requirement already satisfied: Cython!=0.25.1,>=0.22 in /root/venv/lib/python3.7/site-packages (from pystan==2.19.1.1) (0.29.24)
Requirement already satisfied: numpy>=1.7 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from pystan==2.19.1.1) (1.19.5)
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command.
Requirement already satisfied: prophet in /root/venv/lib/python3.7/site-packages (1.0.1)
Requirement already satisfied: Cython>=0.22 in /root/venv/lib/python3.7/site-packages (from prophet) (0.29.24)
Requirement already satisfied: cmdstanpy==0.9.68 in /root/venv/lib/python3.7/site-packages (from prophet) (0.9.68)
Requirement already satisfied: pystan~=2.19.1.1 in /root/venv/lib/python3.7/site-packages (from prophet) (2.19.1.1)
Requirement already satisfied: numpy>=1.15.4 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from prophet) (1.19.5)
Requirement already satisfied: pandas>=1.0.4 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from prophet) (1.2.5)
Requirement already satisfied: matplotlib>=2.0.0 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from prophet) (3.4.3)
Requirement already satisfied: LunarCalendar>=0.0.9 in /root/venv/lib/python3.7/site-packages (from prophet) (0.0.9)
Requirement already satisfied: convertdate>=2.1.2 in /root/venv/lib/python3.7/site-packages (from prophet) (2.3.2)
Requirement already satisfied: holidays>=0.10.2 in /root/venv/lib/python3.7/site-packages (from prophet) (0.11.3.1)
Requirement already satisfied: setuptools-git>=1.2 in /root/venv/lib/python3.7/site-packages (from prophet) (1.2)
Requirement already satisfied: python-dateutil>=2.8.0 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from prophet) (2.8.2)
Requirement already satisfied: tqdm>=4.36.1 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from prophet) (4.62.3)
Requirement already satisfied: ujson in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from cmdstanpy==0.9.68->prophet) (4.2.0)
Requirement already satisfied: pymeeus<=1,>=0.3.13 in /root/venv/lib/python3.7/site-packages (from convertdate>=2.1.2->prophet) (0.5.11)
Requirement already satisfied: pytz>=2014.10 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from convertdate>=2.1.2->prophet) (2021.3)
Requirement already satisfied: hijri-converter in /root/venv/lib/python3.7/site-packages (from holidays>=0.10.2->prophet) (2.2.2)
Requirement already satisfied: korean-lunar-calendar in /root/venv/lib/python3.7/site-packages (from holidays>=0.10.2->prophet) (0.2.1)
Requirement already satisfied: ephem>=3.7.5.3 in /root/venv/lib/python3.7/site-packages (from LunarCalendar>=0.0.9->prophet) (4.1)
Requirement already satisfied: cycler>=0.10 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from matplotlib>=2.0.0->prophet) (0.10.0)
Requirement already satisfied: pillow>=6.2.0 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from matplotlib>=2.0.0->prophet) (8.3.2)
Requirement already satisfied: kiwisolver>=1.0.1 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from matplotlib>=2.0.0->prophet) (1.3.2)
Requirement already satisfied: pyparsing>=2.2.1 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from matplotlib>=2.0.0->prophet) (2.4.7)
Requirement already satisfied: six in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from cycler>=0.10->matplotlib>=2.0.0->prophet) (1.16.0)
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command.
Requirement already satisfied: anvil-uplink in /root/venv/lib/python3.7/site-packages (0.3.40)
Requirement already satisfied: ws4py in /root/venv/lib/python3.7/site-packages (from anvil-uplink) (0.5.1)
Requirement already satisfied: future in /shared-libs/python3.7/py/lib/python3.7/site-packages (from anvil-uplink) (0.18.2)
Requirement already satisfied: six in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from anvil-uplink) (1.16.0)
Collecting argparse
Using cached argparse-1.4.0-py2.py3-none-any.whl (23 kB)
Installing collected packages: argparse
Successfully installed argparse-1.4.0
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command.
Requirement already satisfied: cvxpy in /root/venv/lib/python3.7/site-packages (1.1.15)
Requirement already satisfied: scs>=1.1.6 in /root/venv/lib/python3.7/site-packages (from cvxpy) (2.1.4)
Requirement already satisfied: ecos>=2 in /root/venv/lib/python3.7/site-packages (from cvxpy) (2.0.7.post1)
Requirement already satisfied: numpy>=1.15 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from cvxpy) (1.19.5)
Requirement already satisfied: osqp>=0.4.1 in /root/venv/lib/python3.7/site-packages (from cvxpy) (0.6.2.post0)
Requirement already satisfied: scipy>=1.1.0 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from cvxpy) (1.7.1)
Requirement already satisfied: qdldl in /root/venv/lib/python3.7/site-packages (from osqp>=0.4.1->cvxpy) (0.1.5.post0)
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command.
Requirement already satisfied: cvxopt in /root/venv/lib/python3.7/site-packages (1.2.7)
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command.
Requirement already satisfied: PyPortfolioOpt in /root/venv/lib/python3.7/site-packages (1.5.1)
Requirement already satisfied: scipy<2.0,>=1.3 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from PyPortfolioOpt) (1.7.1)
Requirement already satisfied: pandas>=0.19 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from PyPortfolioOpt) (1.2.5)
Requirement already satisfied: numpy<2.0,>=1.12 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from PyPortfolioOpt) (1.19.5)
Requirement already satisfied: cvxpy<2.0.0,>=1.1.10 in /root/venv/lib/python3.7/site-packages (from PyPortfolioOpt) (1.1.15)
Requirement already satisfied: ecos>=2 in /root/venv/lib/python3.7/site-packages (from cvxpy<2.0.0,>=1.1.10->PyPortfolioOpt) (2.0.7.post1)
Requirement already satisfied: scs>=1.1.6 in /root/venv/lib/python3.7/site-packages (from cvxpy<2.0.0,>=1.1.10->PyPortfolioOpt) (2.1.4)
Requirement already satisfied: osqp>=0.4.1 in /root/venv/lib/python3.7/site-packages (from cvxpy<2.0.0,>=1.1.10->PyPortfolioOpt) (0.6.2.post0)
Requirement already satisfied: qdldl in /root/venv/lib/python3.7/site-packages (from osqp>=0.4.1->cvxpy<2.0.0,>=1.1.10->PyPortfolioOpt) (0.1.5.post0)
Requirement already satisfied: pytz>=2017.3 in /shared-libs/python3.7/py/lib/python3.7/site-packages (from pandas>=0.19->PyPortfolioOpt) (2021.3)
Requirement already satisfied: python-dateutil>=2.7.3 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from pandas>=0.19->PyPortfolioOpt) (2.8.2)
Requirement already satisfied: six>=1.5 in /shared-libs/python3.7/py-core/lib/python3.7/site-packages (from python-dateutil>=2.7.3->pandas>=0.19->PyPortfolioOpt) (1.16.0)
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/root/venv/bin/python -m pip install --upgrade pip' command.
from chromedriver_py import binary_path
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import os
import shutil
import pandas as pd
from bs4 import BeautifulSoup
import requests
import time
import glob
import matplotlib.pyplot as plt
import numpy as np
import sys
import plotly.express as px
import plotly.graph_objs as go
from prophet import Prophet
from prophet.plot import plot_plotly, plot_components_plotly
import plotly.tools as tls
import json
filepath = 'data'
dest = 'data'
url_path = 'urls.csv'
mse_a = pd.read_csv(url_path)
mse_a.head()
def get_data():
for url in mse_a['URL']:
chrome_options = webdriver.ChromeOptions()
prefs = {"download.default_directory" : 'data',
"download.prompt_for_download": False,
"download.directory_upgrade": True}
chrome_options.add_experimental_option("prefs",prefs)
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--window-size=1280x1696')
chrome_options.add_argument('--user-data-dir=/tmp/user-data')
chrome_options.add_argument('--hide-scrollbars')
chrome_options.add_argument('--enable-logging')
chrome_options.add_argument('--log-level=0')
chrome_options.add_argument('--v=99')
chrome_options.add_argument('--single-process')
chrome_options.add_argument('--data-path=/tmp/data-path')
chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.add_argument('--homedir=/tmp')
chrome_options.add_argument('--disk-cache-dir=/tmp/cache-dir')
chrome_options.add_argument('user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36')
driver = webdriver.Chrome(executable_path = binary_path,options=chrome_options)
try:
page_response = requests.get(url, timeout=15)
soup = BeautifulSoup(page_response.content)
symbol = soup.find(id="trade_chart").h1.string.split('(')[-1].split(')')[0]
driver.get(url)
down_arrow = driver.find_element_by_xpath('//*[@id="chartdiv"]/div/div[2]/ul/li/a')
save_as = driver.find_element_by_xpath('//*[@id="chartdiv"]/div/div[2]/ul/li/ul/li[2]/a')
button = driver.find_element_by_xpath('//*[@id="chartdiv"]/div/div[2]/ul/li/ul/li[2]/ul/li[1]/a')
ActionChains(driver).move_to_element(down_arrow).move_to_element(save_as).click(button).perform()
time.sleep(10)
driver.close()
list_of_files = glob.glob(filepath + '/*') # * means all if need specific format then *.csv
latest_file = max(list_of_files, key=os.path.getctime)
os.rename(latest_file, dest + '/' + symbol + '.csv')
time.sleep(10)
except:
print('error on: ' + url)
get_data()
## Momentum Strategy
def buy_sell(data):
sigPriceBuy = []
sigPriceSell = []
flag = -1
for i in range(len(data)):
if data['SMA30'][i] > data['SMA100'][i]:
if flag != 1:
sigPriceBuy.append(data['value'][i])
sigPriceSell.append(np.nan)
flag = 1
else:
sigPriceBuy.append(np.nan)
sigPriceSell.append(np.nan)
elif data['SMA30'][i] < data['SMA100'][i]:
if flag != 0:
sigPriceBuy.append(np.nan)
sigPriceSell.append(data['value'][i])
flag = 0
else:
sigPriceBuy.append(np.nan)
sigPriceSell.append(np.nan)
else:
sigPriceBuy.append(np.nan)
sigPriceSell.append(np.nan)
return (sigPriceBuy, sigPriceSell)
import anvil.server
import anvil.mpl_util
anvil.server.connect("GVJYCJ6HX42BEZG6FR2FQBEN-UB3GQ5B2IA2KQ32O")
@anvil.server.callable
def load_data(symbol):
df= pd.read_csv('data/'+symbol+'.csv')
df['SMA30'] = df['value'].rolling(window = 30).mean()
df['SMA100'] = df['value'].rolling(window = 100).mean()
bs = buy_sell(df)
df['Buy_Signal_Price'] = bs[0]
df['Sell_Signal_Price'] = bs[1]
array = df.to_numpy()
date = array[:,0]
value = array[:,1]
SMA30 = array[:,3]
SMA100 = array[:,4]
buy_signal = array[:,5]
sell_signal = array[:,6]
return date, value, SMA30, SMA100, buy_signal, sell_signal
Connecting to wss://anvil.works/uplink
Anvil websocket open
Connected to "Default environment" as SERVER
from pypfopt.efficient_frontier import EfficientFrontier
from pypfopt import risk_models
from pypfopt import expected_returns
from pypfopt.discrete_allocation import DiscreteAllocation, get_latest_prices
from functools import reduce
@anvil.server.callable
def optimize(symbols,investment):
df_merged = pd.DataFrame(columns = ['date'])
df_merged = df_merged.set_index('date')
for item in symbols:
temp_df = pd.read_csv('data/'+item+'.csv')
temp_df = temp_df.set_index('date')
temp_df = temp_df.drop(columns = {'volume'}).rename(columns = {'value': item})
df_merged = pd.merge(df_merged, temp_df, how='outer', on='date')
#df_merged = df_merged.dropna()
#portfolio:
mu = expected_returns.mean_historical_return(df_merged)
S = risk_models.sample_cov(df_merged)
ef = EfficientFrontier(mu,S)
ef.add_constraint(lambda w: sum(w) == 1)
weights = ef.max_sharpe()
var = ef.portfolio_performance(verbose=True)
#Allocation
latest_prices = get_latest_prices(df_merged)
da = DiscreteAllocation(weights,latest_prices,total_portfolio_value = investment)
allocation,leftover = da.lp_portfolio()
return var,weights, allocation, leftover
a = dict(optimize(['APU','LEND'],20000)[1])
a
Expected annual return: 51.8%
Annual volatility: 42.1%
Sharpe Ratio: 1.18
b = optimize(['APU','LEND'],20000)[2]
b
Expected annual return: 51.8%
Annual volatility: 42.1%
Sharpe Ratio: 1.18
def mergeDict(dict1, dict2):
''' Merge dictionaries and keep values of common keys in list'''
dict3 = {**dict1, **dict2}
for key, value in dict3.items():
if key in dict1 and key in dict2:
dict3[key] = {value , dict1[key]}
return dict3
c = mergeDict(a,b)
@anvil.server.callable
def prophet_data(symbol):
data = pd.read_csv('data/'+symbol+'.csv')
data['date'] = pd.to_datetime(data['date'])
data = data.drop(columns = ['volume']).rename(columns={"date": "ds", "value": "y"})
data = data[data['ds'].dt.dayofweek < 5]
m = Prophet(interval_width=0.95, weekly_seasonality= False)
m.add_seasonality(name = 'monthly', period=30.5, fourier_order=5)
m.fit(data)
future = m.make_future_dataframe(periods=365)
forecast = m.predict(future)
#the main one
fig = plot_plotly(m,forecast,xlabel = 'Огноо',ylabel = 'Хувьцааны үнэ (₮)', trend =True )
fig1 = fig.to_json()
fig_data = json.loads(fig1)['data']
fig_layout = json.loads(fig1)['layout']
#the seasonality
sea = m.plot_components(forecast).savefig(os.devnull)
return fig1,fig_data, fig_layout, anvil.mpl_util.plot_image()