INNER CODE UNIT · Python

window_size

hofmannj0n/introduction-to-quantitative-finance-in-python · autoML.py:91

            window_size = 30  # 30-day moving avearge window

            # moving average
            df['Moving_Avg'] = df[chosen_target].rolling(window=window_size).mean()

            # plot
            fig = px.line(
                df,
                y=chosen_target,
                title=f"{chosen_target} Line Chart",
                color_discrete_sequence=["#9EE6CF"],
            )

            fig.add_scatter(x=df.index, y=df['Moving_Avg'], mode='lines', name='30-day Moving Avg')
            st.plotly_chart(fig, use_container_width=True)
    else:
        st.warning("No data generated yet. Please select 'Data Selection' and generate data first.")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…