Plotting
PlanarOptim.Plotting.balloons — Method
Plots all trades for a single asset instance.
balloons(
s::PlanarCore.Strategies.Strategy,
ii::PlanarCore.Instances.InstrumentInstance;
tf,
force
) -> Makie.Figure
This function plots all trades for a single asset instance, aggregating data to the provided timeframe. It generates OHLCV data for trades, checks the size of the dataframe, prepares the figure for trade plotting, and creates triangles for IncreaseTrade and ReduceTrade. The function returns the figure.
PlanarOptim.Plotting.balloons — Method
Plots all trades for all strategy assets.
balloons(
s::PlanarCore.Strategies.Strategy;
benchmark,
tf,
force
) -> Makie.Figure
This function plots all trades for all strategy assets, aggregating data to the provided timeframe. The benchmark parameter determines the data over which to plot trades. The function returns the figure.
PlanarOptim.Plotting.channel_indicator! — Method
Adds channel indicators to a given figure.
channel_indicator!(
fig::Makie.Figure,
lines...;
df,
opacity,
row
)
The function channel_indicator! takes a Figure object and one or more line data arrays as arguments. It first checks if the size of each line matches the number of candles in the figure. Then, it creates a new axis in the figure at the specified row and links it with the price axis. For each pair of lines, it generates a random color and adds a band plot to the axis with a tooltip showing the values of the upper and lower bounds at each point. The opacity of the band can be adjusted with the opacity keyword argument.
PlanarOptim.Plotting.channel_indicator — Method
Creates a figure with channel indicators from a DataFrame.
channel_indicator(
df::DataFrames.AbstractDataFrame,
lines...;
opacity,
row
) -> Makie.Figure
The function channel_indicator takes an AbstractDataFrame and one or more line data arrays as arguments. It first creates a figure using the ohlcv function with the DataFrame. Then, it calls the channel_indicator! function to add channel indicators to the figure. The function returns the figure with the added channel indicators.
PlanarOptim.Plotting.line_indicator! — Method
Adds line indicators to a given figure.
line_indicator!(fig::Makie.Figure, lines...; df, row)
The function line_indicator! takes a Figure object and one or more line data arrays as arguments. It first checks if the size of each line matches the number of candles in the figure. Then, it creates a new axis in the figure at the specified row and links it with the price axis. For each line, it generates a random color and adds a line plot to the axis with a tooltip showing the value of the line at each point.
PlanarOptim.Plotting.line_indicator — Method
Creates a figure with line indicators from a DataFrame.
line_indicator(
df::DataFrames.AbstractDataFrame,
lines...;
row
) -> Makie.Figure
The function line_indicator takes an AbstractDataFrame and one or more line data arrays as arguments. It first creates a figure using the ohlcv function with the DataFrame. Then, it calls the line_indicator! function to add line indicators to the figure. The function returns the figure with the added line indicators.
PlanarOptim.Plotting.ohlcv — Function
Plots ohlcv data from dataframe df, resampling to tf
ohlcv(df::DataFrames.AbstractDataFrame; ...) -> Makie.Figure
ohlcv(
df::DataFrames.AbstractDataFrame,
tf;
fig_kwargs...
) -> Makie.Figure
The function takes a dataframe df and a time frame tf as parameters. If tf is not nothing, the dataframe is resampled according to the time frame. Defaults to the dataframe's native timeframe (inferred from its metadata/timestamps). Figure-level keyword arguments (e.g. size=(w, h)) are forwarded to makefig.
PlanarOptim.Plotting.ohlcv! — Function
Plots ohlcv data from dataframe df, resampling to tf on an existing figure
ohlcv!(
fig::Makie.Figure,
df::DataFrames.AbstractDataFrame
) -> Makie.Figure
ohlcv!(
fig::Makie.Figure,
df::DataFrames.AbstractDataFrame,
tf
) -> Makie.Figure
The function takes a figure fig, a dataframe df, and a time frame tf as parameters. If tf is not nothing, the dataframe is resampled according to the time frame. The function then plots the ohlcv data on the provided figure.
PlanarOptim.Plotting.plot_results — Method
plot_results(ii::InstrumentInstance; kwargs...)Create a plot for a single instrument instance.
PlanarOptim.Plotting.plot_results — Method
plot_results(s::Strategy; kwargs...)Create a comprehensive plot of strategy results including OHLCV candles, trade markers, and optional indicators.
Arguments
s::Strategy: The strategy instance containing universe, trade history, and OHLCV data.
Keyword Arguments
asset::Union{Symbol,InstrumentInstance,Int}=1: Which asset to plot (index, symbol, or instance).tf::TimeFrame=timeframe(first(s.universe)): Timeframe for the plot (defaults to smallest available).indicators::Vector=[]: Vector of indicator arrays to plot as lines.channels::Vector=[]: Vector of channel indicator pairs (lower, upper) to plot as bands.show_trades::Bool=true: Whether to show trade entry/exit markers.show_balance::Bool=true: Whether to show balance curve.force::Bool=false: Skip the 100k candle limit check.
Returns
Makie.Figure: The figure containing all plots.
PlanarOptim.Plotting.tradesticks — Function
Plots a subset of trades history of an asset instance.
tradesticks(
s::PlanarCore.Strategies.Strategy;
...
) -> Makie.Figure
tradesticks(
s::PlanarCore.Strategies.Strategy,
fig::Makie.Figure,
args...;
kwargs...
) -> Makie.Figure
This function plots a subset of trades history of an asset instance. It takes a Strategy and an InstrumentInstance as parameters and optionally a Figure and additional arguments. It returns the result of the base tradesticks! function.
PlanarOptim.Plotting.tradesticks! — Function
Plots trades on a figure for a given asset instance.
tradesticks!(
fig::Makie.Figure,
ii::PlanarCore.Instances.InstrumentInstance;
...
) -> Makie.Figure
tradesticks!(
fig::Makie.Figure,
ii::PlanarCore.Instances.InstrumentInstance,
tf;
from,
to,
force
) -> Makie.Figure
This function plots trades on a figure for a given asset instance. It generates OHLCV data for trades, checks the size of the dataframe, prepares the figure for trade plotting, and creates triangles for IncreaseTrade and ReduceTrade. The function returns the figure.