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

[Bug]: The stock variable is not working #1897

Open
pitsi opened this issue May 3, 2024 · 3 comments
Open

[Bug]: The stock variable is not working #1897

pitsi opened this issue May 3, 2024 · 3 comments
Labels
bug Bug report or bug fix PR text Issue or PR related to `conky.text` variables

Comments

@pitsi
Copy link

pitsi commented May 3, 2024

What happened?

I am on debian testing/unstable x64 and I got the upgrade to 1.20.2 yesterday (from 1.19.6). And although I have a very specific conky layout for more than a decade now, I check for variables that may have changed or for new ones. And I came accross the stock variable, so I wanted to try it and I just put it on my .conkyrc (seen below).
https://conky.cc/variables#stock

As it seems, it does not work, because when launcing conky from the terminal, curl tries again and again to parse something that is not there.
I have no idea about programming, but I had a look at the source code and it seems this is the url it tries to parse.
http://download.finance.yahoo.com/d/quotes.csv

And it just can not open on my end. I do not know if it is geoblocked, but I asked a friend to test it with a vpn and a US ip, but it still fails.

p.s. Can someone please inform me if the weather variables have been removed? I do not want to open a new issue just for it.

Version

1.20.2

Which OS/distro are you seeing the problem on?

Debian

Conky config

conky.config = {
    alignment = 'bottom_right',
    background = true,
    border_width = 0,
    cpu_avg_samples = 2,
    default_color = 'ghost white',
    default_outline_color = 'black',
    default_shade_color = 'black',
    double_buffer = true,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    extra_newline = false,
    font = 'ITC Avant Garde Gothic Pro:size=16',
    font1 = 'ITC Avant Garde Gothic Pro:size=14',
    gap_x = 0,
    gap_y = 32,
    minimum_height = 5,
    minimum_width = 5,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_ncurses = false,
    out_to_stderr = false,
    out_to_x = true,
    own_window = true,
    own_window_class = 'Conky',
    own_window_type = 'desktop',
    own_window_transparent = true,
    own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
    show_graph_range = false,
    show_graph_scale = false,
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    use_xft = true,
}

--[[
# ${rss http://rss.accuweather.com/rss/liveweather_rss.asp?metric=1&locCode=(removed) 300 item_title 0} 
# ${rss https://weather-broker-cdn.api.bbci.co.uk/en/observation/rss/(removed) 300 item_title 0}
# ${rss https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/(removed) 300 item_title 0} 
# ${freq_g 1}G 
# ${curl https://wttr.in/(removed)?format=3}
]]


conky.text = [[
$alignr ${stock AAPL name}
$alignr ati ${hwmon 0 temp 1 1 0}C 
$alignr sdb ${hwmon 4 temp 1 1 0}C 
$alignr cores ${hwmon 1 temp 2 1 -15}C ${freq_g 1}G ${hwmon 1 temp 3 1 -15}C ${freq_g 2}G 
$alignr ${fs_bar 5,300 /} 
$alignr ${rss https://weather-broker-cdn.api.bbci.co.uk/en/observation/rss/(removed) 300 item_title 0} 
$alignr $font1 ${rss https://weather-broker-cdn.api.bbci.co.uk/en/observation/rss/(removed) 300 item_desc 0} 
]]

Stack trace

No response

Relevant log output

$ conky 
conky: desktop window (0x53a) is root window
conky: window type - desktop
conky: drawing to created window (0xe00001)
conky: drawing to double buffer
conky: forked to background, pid is 13050
conky: FOUND: console
conky: FOUND: ncurses
conky: FOUND: file
conky: FOUND: x11
conky: FOUND: wayland
conky: 'openbox' x11 session running '(null)' destop
conky: curl: could not retrieve data from server
conky: curl: could not retrieve data from server
conky: curl: could not retrieve data from server
@pitsi pitsi added bug Bug report or bug fix PR triage Issue that hasn't been verified labels May 3, 2024
@lineage-of-roots
Copy link

lineage-of-roots commented May 3, 2024

@pitsi

Google says http://download.finance.yahoo.com/d/quotes.csv has not worked since 2017...
So that code in there is old, and the info on conky.cc is out dated as well.

A kind Gentleman on the internet I found pointed out the new url and format which goes like this

https://query1.finance.yahoo.com/v7/finance/download/^GSPC?period1=1459468800&period2=1494028800&interval=1d&events=history&crumb=yt6hjEL5Tx8

That will get csv files, but I currently don't know what the period interval numbers mean.

I will see what I can do about the Conky code and also try to figure out how the period numbers correspond to dates.

(EDIT: Those are seconds since 1-1-1970. I get it now)

@pitsi
Copy link
Author

pitsi commented May 3, 2024

Yes, when you see timestamps that are more than a billion, they are on unix epoch time, which starts on that date, counts in seconds and you can get the current one with date +%s.

As for the code being old, just imagine that until less than a year ago, I was checking conky's variables and configuration settings on these pages on sourceforge! That is why I asked if the weather variable stil exists.
https://conky.sourceforge.net/variables.html
https://conky.sourceforge.net/config_settings.html

@lineage-of-roots
Copy link

Oh I knew about the epoch time.
It's just that the url the confused me.
I thought it was some fancy finance thing that accountants understood lol. (I know nothing about stocks or finance)

As for the weather variable, I am not currently seeing it anywhere in the source code. I have the latest git clone.

I did manage to get conky to retrieve the csv file from Yahoo though. The rest of the code works, just had to change the url a bit.
However, it's ugly looking right now :)

And from what I am seeing, its always the same kind of data. Can only change the time period and interval like daily or weekly. Can't seem to get the fancier stuff.
Maybe it's my lack of knowledge about this stuff...Or perhaps Yahoo only wants to show it on their website now.

@Caellian Caellian added text Issue or PR related to `conky.text` variables and removed triage Issue that hasn't been verified labels May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report or bug fix PR text Issue or PR related to `conky.text` variables
Projects
None yet
Development

No branches or pull requests

3 participants