Skip to content

Commit

Permalink
renamed function + adjusted fig size
Browse files Browse the repository at this point in the history
  • Loading branch information
EtoileScintillante committed Apr 5, 2024
1 parent 3eb434b commit d4a6fc9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/include/visualize.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void createCandle(std::string symbol, std::string duration);
/// @note Please note that using OHLCV data of a period >6 months may lead
/// to a candlestick chart and volume graph that are not clearly readable. In such cases, the candlesticks
/// and volume bars may appear very thin or small, making it hard to discern the details.
void createCandleAndVolume(std::string symbol, std::string duration);
void createCandleWithVolume(std::string symbol, std::string duration);


#endif // VISUALIZE_H
17 changes: 4 additions & 13 deletions src/visualize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ void priceGraph(std::string symbol, std::string duration, int mode)
// Create the price graph
auto fig = matplot::figure(true);
fig->quiet_mode(true);
if (dates.size() > 100)
{
fig->size(900, 600); // Bigger graph for longer periods
}
fig->size(900, 600);
matplot::hold(matplot::on);
matplot::xlim({-1, xAxis[xAxis.size()-1]+1}); // Small offset from edges of figure, to make sure the line(s) does not cross the axis

Expand Down Expand Up @@ -182,10 +179,7 @@ void createCandle(std::string symbol, std::string duration)
// Create the candlestick chart
auto fig = matplot::figure(true);
fig->quiet_mode(true);
if (dates.size() > 50)
{
fig->size(900, 600); // Bigger chart for longer periods
}
fig->size(900, 600);
matplot::hold(matplot::on);
matplot::ylim({+lowestPrice * 0.99, +highestPrice * 1.01});
matplot::xlim({-1, xAxis[xAxis.size()-1]+1}); // Small offset to make sure the first and last candles are not drawn in the axis
Expand Down Expand Up @@ -225,7 +219,7 @@ void createCandle(std::string symbol, std::string duration)
//matplot::show();
}

void createCandleAndVolume(std::string symbol, std::string duration)
void createCandleWithVolume(std::string symbol, std::string duration)
{
// Fetch data
Metrics data = fetchMetrics(symbol);
Expand Down Expand Up @@ -303,10 +297,7 @@ void createCandleAndVolume(std::string symbol, std::string duration)
// Create the candlestick chart
auto fig = matplot::figure(true);
fig->quiet_mode(true);
if (dates.size() > 50)
{
fig->size(900, 600); // Bigger chart for longer periods
}
fig->size(900, 600);
matplot::hold(matplot::on);
matplot::ylim({+lowestPrice * 0.99, +highestPrice * 1.01});
matplot::ylabel("Price in " + data.currency);
Expand Down

0 comments on commit d4a6fc9

Please sign in to comment.