0
Python for Finance Code Repo 11.2
Could someone please comment the answer for this question please? There’s a character limit for this post so I’ll use the comment section for space please check :) Let's continue with our Bitcoin calculations. You decide to invest $1000 in Bitcoin in 2018, at the price in the declared array: $3869.47. 1. Calculate how much your investment is worth at the end of each year using the prices denoted in the code. 2. Draw a chart to showcase how much your $1000 investment changes in value each year.
7 Antworten
+ 1
--
If you have mentioned Code Repo 11.2 then no need to post full description people can go and see.
Have you tried to solve if yes then show us.
0
First, calculate how many Bitcoins you will have at the start by dividing your investment by the cost of Bitcoin in the first year (the first element of the given array). Then multiply the entire array of the prices by that number to get the value for each year. Use np.multiply(array, number) to multiply an array with a number.
0
Don't forget to import the matplotlib.pyplot package under the name "plt" to draw the chart using plt.plot() function.
Add the plt.savefig() function (using the name of the chart as an argument) at the end of the code to draw the chart in the CodePlayground.
0
I posted a discussion without the description before but someone asked to post it. I’ved tried to solve it but it’s basically nothing :( have no clue
0
There’s a code someone posted on the ‘Code’ section but it doesn’t work. Below is the code that someone posted.
https://code.sololearn.com/cv335YU63k18/?ref=app
0
I think this one is correct.
https://code.sololearn.com/cv335YU63k18/?ref=app
but on the line 13, it should be np.multiply not np.mulitply
0
Hey,
This topic really hits home for me as I've been diving into Python for Finance myself. The journey has been a roller coaster of emotions, but oh boy, the learnings have been invaluable!
Regarding the question, it's all about tracking that Bitcoin investment, right? The code seems to be set up for some real data crunching. You start with $1000 and track its value over the years based on the given prices. This kind of stuff truly showcases the power of programming in finance. For example, I would recommend reading more here: https://www.finsmes.com/2023/08/ecosystem-thinking-in-the-world-of-finance.html
As for a solution, I'd suggest using a loop to iterate through the years and perform the calculations. You'll need to multiply the initial investment by the price factor for each year to get the updated value. And for drawing the chart, libraries like Matplotlib can come to the rescue. Visualizing your investment's journey could give you insights you never thought of!
My personal experience? Well, it's been both thrilling and nerve-wracking. Finance + coding might seem intimidating, but once you get the hang of it, it's like discovering a new dimension.
My advice: Embrace the challenge, don't shy away from asking questions, and remember, every piece of code you write is a step toward mastering this exciting fusion of finance and Python.