lavolp3 / MMM-AVStock

MagicMirror module for displaying stock price with Alphavantage API
MIT License
38 stars 18 forks source link

No data from S&P500 and DAX / Explanation to width and heigth #48

Closed Dres49 closed 3 years ago

Dres49 commented 3 years ago

Dear Lavolp3,

thanks for your work and support of this module. It would be nice if you can help me with the following questions:

Q1: I tried a lot but did not succseed in getting data for the S&P500 and the german DAX. Looking in the forum I found examples for CAC40 with the symbol ^FCHI working in the past with your module but with my script I don't get information for these index. I tried tried typical shares like Microsoft, Apple and Airbus - all work.

I changed my module and the overall language to english - no change - still no information. I deleted several options and used only a minimum of parameter - see below - still no information.

My script looks like this (I get information for apple with this script): { module: "MMM-AVStock", position: "top_bar", config: { apiKey: "xxx", symbols: ["AAPL","^GSPC","^DJI","^GDAX","^VIX"], alias: ["Apple","S&P500","DowJones","DAX",VIX"], mode: "grid", showChart: false, } }

Since the documentation is not very large from alphavantage with respect to find the right name and corresponding symbol -> Am I right that the yahoo finance search is a good solution to find name and symbol of index/shares that fit to alphavantage API? https://finance.yahoo.com/ gives for Apple the AAPL. Or do you have a good search engine to find the right symbols? (especially for index like S&P500)

Q2: I tried to change the size of the graph. Beside "null" I only get very narrow graphs if I enter numbers - could you explain in some words how the parameter of graph width and chartWidth works? (does the numbers mean % of screen width or pixel or ...?) Is there an option to change the height?

Thanks a lot for your help.

Best regards. Dres49.

lavolp3 commented 3 years ago

Hi @Dres49 to Q1:

there is a search endpoint inside the API. It seems to work with any arbitrary API key https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=dax&apikey=N5xxxxxxxxxx https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=500&apikey=N5xxxxxxxxxx

However, indexes are difficult to fetch at the moment and I didn't find a real DAX endpoint as well. Neither an S&P500 endpoint. From above results you could just try "DAX" and "SPY" which are both ETFs resembling the respective index.

to Q2: Both width and chartWidth should be given as integer as described in the readme. They will then be converted to pixels. If they are unchanged (null) they will be converted to '100%' Hence, if you set a width, the elements should all have this width, the graph as well. If you set

  width: 400,
  graphWidth: 300

you would get a table/ticker/grid with 400px width and an inline graph with 300px width.

Please note that the table can easly extend beyond the width. Then ou should use the classto give a smaller font or remove some table headers. Or just use a higher width for the modules.

Dres49 commented 3 years ago

Dear lavolp3,

thanks for you help!

Regards, Dres49.

lavolp3 commented 3 years ago

Did the symbols work?