Re: Market Prices
Posted: August 6th, 2021, 10:56 am
wauw. i realy like this skin. thanks
Terrific work, although i have a question concerning conversions.
thanks for the help and input. i've so busy at work haven't had a chance to check it out.
The MyPortfolio skin does not perform any form of currency conversion so the price you see is the price in whatever currency it says at the top of the page. Obviously the daily and overall Gain/Loss values are going to be a mess if they combine shares that were bought and are quoted in different currencies. It would be possible to incorporate some sort of exchange rate conversion in the MyPortfolio skin but let's try a quick and dirty fix first.Alienmoon wrote: ↑August 6th, 2021, 6:15 pm I live in the UK and therefore use sterling GBP, I currently have 4 Ericsson (ERIC) shares and it doesn't convert the Swiss Franc into sterling.
I don't have many shares in ERIC and only just bought them and have to buy a few each month.
... the current value of the 4.23 shares is £35.23, yet the skin shows as 5.208.
Code: Select all
Symbol3 = ERIC
;-[ The number of units you hold
Units3 = 4.23
;-[ Your Buy price in GBP = 35.23 / 4.23 = 8.3286052 GBP / unit
BuyPrice3 = 8.3286052
;-[ Convervsion of the quoted Price to GBP = 0.72 GBP/USD
Convert3 = 0.72
Code: Select all
[cDayLossGain3]
Measure=Calc
;xxxxx Formula= ( mIndex3_Change * #Units3# )
Formula= ( mIndex3_Change * #Convert3# * #Units3# )
RegExpSubstitute=1
Substitute="\-":"","^(\d{1,3})(\d{3})(\d{3})$":"\1,\2,\3","^(\d{1,3})(\d{3})$":"\1,\2"
DynamicVariables=1
[cChangeFromBuyPrice3]
Measure=Calc
;xxxxx Formula= ( mIndex3_Price - #BuyPrice3# )
Formula= ( ( mIndex3_Price * #Convert3# ) - #BuyPrice3# )
IfCondition=(#CURRENTSECTION# > 0)
IfTrueAction=[!SetVariable "OverallColor3" "#ColorUp#"]
IfCondition2=(#CURRENTSECTION# = 0)
IfTrueAction2=[!SetVariable "OverallColor3" "#ColorSteady#"]
IfCondition3=(#CURRENTSECTION# <0 )
IfTrueAction3=[!SetVariable "OverallColor3" "#ColorDown#"]
OnChangeAction=[!ShowMeterGroup OverallGroup3] [!UpdateMeterGroup OverallGroup3] [!Redraw]
DynamicVariables=1
All are in GBP except ERIC, as you say, the numbers are all messed up.
Code: Select all
Symbol4=ERIC
Units4=4.23
BuyPrice4=11.53
Code: Select all
Symbol4 = ERIC
;-[ The number of units you hold
Units3 = 4.23
;-[ Your Buy price in GBP = 35.23 / 4.23 = 8.3286052 GBP / unit
BuyPrice3 = 8.3286052
;-[ Convervsion of the quoted Price to GBP = 0.72 GBP/USD
Convert3 = 0.72
Code: Select all
Symbol4=ERIC
BuyPrice3 = 8.3286052
Convert3 = 0.72
Please note that all the Variable names MUST end in the same number which in my example is number three (3). So following my example the entry for Stock No. 3 should be:Mordasius wrote: ↑August 7th, 2021, 5:07 am
1) Edit the appropriate entry in Mystockcodes.inc to:Code: Select all
Symbol3 = ERIC ;-[ The number of units you hold Units3 = 4.23 ;-[ Your Buy price in GBP = 35.23 / 4.23 = 8.3286052 GBP / unit BuyPrice3 = 8.3286052 ;-[ Convervsion of the quoted Price to GBP = 0.72 GBP/USD Convert3 = 0.72
Code: Select all
Symbol3 = ERIC
Units3 = 4.23
BuyPrice3 = 8.3286052
Convert3 = 0.72
Code: Select all
[cDayLossGain3]
Measure=Calc
Formula= ( mIndex3_Change * #Convert3# * #Units3# )
RegExpSubstitute=1
Substitute="\-":"","^(\d{1,3})(\d{3})(\d{3})$":"\1,\2,\3","^(\d{1,3})(\d{3})$":"\1,\2"
DynamicVariables=1
[cChangeFromBuyPrice3]
Measure=Calc
Formula= ( ( mIndex3_Price * #Convert3# ) - #BuyPrice3# )
IfCondition=(#CURRENTSECTION# > 0)
IfTrueAction=[!SetVariable "OverallColor3" "#ColorUp#"]
IfCondition2=(#CURRENTSECTION# = 0)
IfTrueAction2=[!SetVariable "OverallColor3" "#ColorSteady#"]
IfCondition3=(#CURRENTSECTION# <0 )
IfTrueAction3=[!SetVariable "OverallColor3" "#ColorDown#"]
OnChangeAction=[!ShowMeterGroup OverallGroup3] [!UpdateMeterGroup OverallGroup3] [!Redraw]
DynamicVariables=1
Yes, i added the 4 in my post for ERIC as it was 4th in the list, however, I have done as you instructed and it would seem I have done something wrong. As you can see the overall Gain / loss in the 3rd row is broken.Mordasius wrote: ↑August 8th, 2021, 6:34 am Please note that all the Variable names MUST end in the same number which in my example is number three (3). So following my example the entry for Stock No. 3 should be:
Save the files you have edited and hit Refresh. Now have a look at entry number 3 in your portfolio. It should be for LM Ericsson Telefon and show the corrected values for amount invested, daily gain and overall gain/loss in GBP (assuming 1 USD = 0.72 GBP). How does it look now?
Also please note that you will have to reapply the cut/paste at line 191 in AddMoreStocks.inc everytime you add or remove new stocks. This is because the file AddMoreStocks.inc is over-written every time you change the NumberOfStocks.
Code: Select all
[Variables]
;-------- Enter the number of stocks you want to track below -------------
NumberOfStocks=12
; #### Symbols -----------------------------------
; Find Symbols by going to http://www.cnbc.com then entering the stock/index name you want in the search box. When the page opens look in the top-left address window and make a note of EXACTLY what comes after https://www.cnbc.com/quotes/ If there is a Period "." after the backslash "/" you must include it. or it will not work.
;eg https://www.cnbc.com/quotes/TSLA --> Symbol1=TSLA -----------------
; Units = Number of Units held
; BuyPrice = Per Unit Price of stock when bought
Symbol1=BT.A-GB
Units1=5
BuyPrice1=185.02
;----------------------------------
Symbol2=UKW-GB
Units2=80
BuyPrice2=134.39
;----------------------------------
Symbol3 = ERIC
Units3 = 4.23
BuyPrice3 = 8.3286052
Convert3 = 0.72
;----------------------------------
Symbol4=ORIT-GB
Units4=75
BuyPrice4=108.22
;----------------------------------
Symbol5=JAY-GB
Units5=4
BuyPrice5=11.18
;-----------------------------------
Symbol6=AWE-GB
Units6=12
BuyPrice6=458.85
;-----------------------------------
Symbol7=DARK-GB
Units7=11
BuyPrice7=621.45
;------------------------------------
Symbol8=SSIT-GB
Units8=0
BuyPrice8=113.25
;------------------------------------
Symbol9=TRIG-GB
Units9=0
BuyPrice9=133.00
;------------------------------------
Symbol10=DRX-GB
Units10=0
BuyPrice10=403.80
;------------------------------------
Symbol11=NOKIA-IT
Units11=0
BuyPrice11=5.26
;------------------------------------
Symbol12=GSF-GB
Units12=0
BuyPrice12=112.00
Thanks for the clarification, i will add them as its supposed to be as you advice, I don't suppose I could just change the decimal location then?Mordasius wrote: ↑August 9th, 2021, 3:57 pm I'm sorry to say that this skin is not capable of doing what you expect it to do - at least not in the way you are trying to use it.
Without wasting our time on the details of each stock you are trying to track let's just say that:
1) The BuyPrice you use must be in the same units as those quoted for the price on CNBC.com. So if CBNC quotes the price of Greencoat in GBP you need to specify the BuyPrice2 in GBP/unit (not pence per unit as you seem to have done).
2) This skin can not handle multiple buy prices. The skin is made for people that buy so many units at a price of XX and that is that. If, as you appear to be doing, you are buying a few units at price x and a few more units at price y this skin is never going to work without a lot of averaging on your part. Either that or you would have to add each batch of buys as a separate 'stock' which would be cumbersome at best.
The only way to fix your decimal place issue is by setting the BuyPrice in the same units used by CNBC.com when quoting the current share price. If you bought shares at 25 pence each and CNBC quotes the current price in GBP simply change your BuyPrice to 0.25 and the total Invested, Daily Gain/Loss and Overall Gain/Loss should show the correct values in GBP.