Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Term Entry] Python Plotly- graph_objects .Candlestick() #5819

Merged
merged 21 commits into from
Dec 21, 2024

Conversation

SaviDahegaonkar
Copy link
Collaborator

Description

Created a new term entry on the .Candlestick() method of the graph_objects module in Plotly, Python.

Issue Solved

#5177

Type of Change

  • Adding a new entry

Checklist

  • All writings are my own.
  • My entry follows the Codecademy Docs style guide.
  • My changes generate no new warnings.
  • I have performed a self-review of my own writing and code.
  • I have checked my entry and corrected any misspellings.
  • I have made corresponding changes to the documentation if needed.
  • I have confirmed my changes are not being pushed from my forked main branch.
  • I have confirmed that I'm pushing from a new branch named after the changes I'm making.
  • I have linked any issues that are relevant to this PR in the Issues Solved section.

@mamtawardhani mamtawardhani self-assigned this Dec 14, 2024
@mamtawardhani mamtawardhani added new entry New entry or entries status: under review Issue or PR is currently being reviewed plotly Python:Plotly entries labels Dec 14, 2024
@mamtawardhani
Copy link
Collaborator

@SaviDahegaonkar please add the output image as well

@mamtawardhani mamtawardhani added status: waiting for author and removed status: under review Issue or PR is currently being reviewed labels Dec 16, 2024
Copy link
Collaborator

@mamtawardhani mamtawardhani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @SaviDahegaonkar , thank you for contributing to Codecademy Docs, the entry is nicely written! 😄

I've suggested a few changes, could you please review and modify those at your earliest convenience? Thank you! 😃

The **`.Candlestick()`** method in the `graph_objects` module in Plotly is used to create candlestick charts widely for visualizing financial data. A candlestick chart displays four key data points for a specific period:

1. **Open** - The starting value of the asset.
2. **High** - The highest value achieved within the time period.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of within, let us use "The highest value achieved during the time period. and ":" instead of "-"


1. **Open** - The starting value of the asset.
2. **High** - The highest value achieved within the time period.
3. **Low** - The smallest value during the period.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of smallest, let us use - "The lowest value during the period."

Comment on lines 30 to 40
import plotly.graph_objects as go

fig = go.Figure(data=[go.Candlestick(
x=df['date'], # Time or date data
open=df['open'], # Opening prices
high=df['high'], # Highest prices
low=df['low'], # Lowest prices
close=df['close'] # Closing prices
)])

fig.show()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refer to this and correct the parameters and their values - https://plotly.github.io/plotly.py-docs/generated/plotly.graph_objects.Candlestick.html

Comment on lines 59 to 63
x=dates,
open=open_prices,
high=high_prices,
low=low_prices,
close=close_prices
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add comments here, like # Opening prices for each date, # highest prices for each date


## Example

The following example showcases the use of the `.candlestick()` method:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please describe the code example in a line or two

@SaviDahegaonkar
Copy link
Collaborator Author

Hey @mamtawardhani ,
Incorporated the changes as per your suggestions.

Thanks,
Savi

Copy link
Collaborator

@mamtawardhani mamtawardhani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change the syntax

Comment on lines 29 to 52
```pseudo
import plotly.graph_objects as go

fig = go.Figure(data=[go.Candlestick(
x=df['date'], # Time or date data
open=df['open'], # Opening prices
high=df['high'], # Highest prices
low=df['low'], # Lowest prices
close=df['close'], # Closing prices
increasing_line_color='green', # Color for increasing candlesticks
decreasing_line_color='red', # Color for decreasing candlesticks
increasing_fillcolor='rgba(0, 255, 0, 0.3)', # Fill color for increasing candlesticks
decreasing_fillcolor='rgba(255, 0, 0, 0.3)' # Fill color for decreasing candlesticks
)])

fig.update_layout(
title='Candlestick Chart', # Title for the chart
xaxis_title='Date', # X-axis label
yaxis_title='Price', # Y-axis label
xaxis_rangeslider_visible=False # Disables the range slider under the candlestick chart
)

fig.show()
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refer to this and correct the parameters and their values - https://plotly.github.io/plotly.py-docs/generated/plotly.graph_objects.Candlestick.html

@SaviDahegaonkar
Copy link
Collaborator Author

SaviDahegaonkar commented Dec 20, 2024 via email

@SaviDahegaonkar
Copy link
Collaborator Author

SaviDahegaonkar commented Dec 20, 2024

Hello @mamtawardhani ,
I have made the changes, I hope now it is written in the expected manner.

Thanks,
Savi

Copy link
Collaborator

@mamtawardhani mamtawardhani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entry looks good to be merged! 🚀

@mamtawardhani mamtawardhani merged commit 3dc1a36 into Codecademy:main Dec 21, 2024
6 checks passed
Copy link

👋 @SaviDahegaonkar
You have contributed to Codecademy Docs, and we would like to know more about you and your experience.
Please take a minute to fill out this four question survey to help us better understand Docs contributions and how we can improve the experience for you and our learners.
Thank you for your help!

🎉 Your contribution(s) can be seen here:

https://www.codecademy.com/resources/docs/plotly/graph-objects/candlestick

Please note it may take a little while for changes to become visible.
If you're appearing as anonymous and want to be credited, see here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new entry New entry or entries plotly Python:Plotly entries status: review 1️⃣ completed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants