# I have missing data on my portfolio weightings but it can be solved through stock prices - how can I code to find this? [closed]

firstly I would like to say sorry for the title - its not the best. In fact its crap.

Here is my problem (I am new to coding btw - still learning)

I am using Python on my MacBook - using Terminal.

1. I have a portfolio of stocks with their weightings but at random periods. E.g. 2/Jan/2018 - Company X - 3%, Company Y - 4% etc. On 15/Feb/2018, I readjusted the weights to: Company X - 4% , Company Y - 5% etc. But for the period between 2/Jan to 15/Feb - I have no weightings for the stocks.

I want to fill in the gap - so between 2 Jan and 15 Feb 2018. I know we can easily do this by using the daily stock prices. What code can I use to to build daily weightings between 2 Jan 2018 to 15 Feb? So, if Company X price jump between 2nd of Jan to 3rd of Jan by some %, I would see the weighting get adjusted on 3rd Jan for Company X?

Much appreciated. PS I'm a novice at this.. so go easy on me!

• many thanks. I am sorry I should have been more specific in terms of what I was asking. I want to know what kind of code would I need to use to answer my question? I have installed numpy, panda into my MacBook Book - using the Terminal. I googled it and found something about apply a loop? I am a novice coder but will to do the leg work if someone can help me out on what code, syntax I would need to build a code that will solve my answer Commented Sep 11, 2020 at 10:37