Coder Social home page Coder Social logo

Comments (16)

Kaligula0 avatar Kaligula0 commented on June 2, 2024 1

Because of this, the module uses a hash to map extensions to currencies. The .L maps to GBP.

Wait wait. I don't use AlphaVantage.pm and am out of home now so can't check it, but this seems like a bad idea. Look at the MVOL.L or ISLN.L – they are in USD!

from finance-quote.

bpschuck avatar bpschuck commented on June 2, 2024

It would be extremely helpful to include example securities to be used to test any changes.
Thank you.

from finance-quote.

Wm-X avatar Wm-X commented on June 2, 2024

No, just fix it. It used to work, someone broke it. No need for discussion

from finance-quote.

bpschuck avatar bpschuck commented on June 2, 2024

Issue placed on hold until further details are supplied.

from finance-quote.

Wm-X avatar Wm-X commented on June 2, 2024

I have proposed fixing it before and got ignored. I did all the homework then. I hate lazy people

from finance-quote.

Wm-X avatar Wm-X commented on June 2, 2024

Why on hold? IT IS BROKEN

from finance-quote.

Wm-X avatar Wm-X commented on June 2, 2024

If something is broken, why don't you just fix it?

from finance-quote.

bpschuck avatar bpschuck commented on June 2, 2024

On hold because I had a simple request, "It would be extremely helpful to include example securities to be used to test any changes."
Perhaps you need to be reminded that no one is paid to contribute to F::Q. Most, if not all, volunteer their free time to fix bugs, add features, etc.
So instead of just indicating a few symbols to test with, you want to act like a 5 year old child having a tantrum because mommy won't buy you a toy.
Me, I have a simple adage when it comes to people requesting help, "help me help you". If I need assistance I help those I ask help me.

from finance-quote.

bpschuck avatar bpschuck commented on June 2, 2024

Introduced in commits bfb7cf2 and e323365.

Part of v1.45 release.

commit d31457890638c52f038a05f8014890d070f0aca4
Author: Erik Colson <[email protected]>
Date:   Wed Nov 8 21:36:41 2017 +0100

    v1.45

            * alphavantage
              * more suffix - currency pairs added
              * GBP and GBX divided by 100

from finance-quote.

bpschuck avatar bpschuck commented on June 2, 2024

I don't believe it ever worked. As the AlphaVantage module was added around the time of the above commits after the Google JSON API went dark.

Why did I want examples, so not being familiar with UK securities I didn't have waste time looking for examples to see what the AlphaVantage API returns. For example the symbols GBP.L and GBPG.L. The AlphaVantage API (https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=GBPG.L&apikey=XXXXXXXX) does not include a currency in the output as seen here:

% curl "https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=GBPG.L&apikey=${ALPHAVANTAGE_API_KEY}"
{
    "Global Quote": {
        "01. symbol": "GBPG.L",
        "02. open": "43.1900",
        "03. high": "43.1900",
        "04. low": "43.0840",
        "05. price": "43.0950",
        "06. volume": "23330",
        "07. latest trading day": "2023-05-26",
        "08. previous close": "43.0675",
        "09. change": "0.0275",
        "10. change percent": "0.0639%"
    }
}

Because of this, the module uses a hash to map extensions to currencies. The .L maps to GBP. The problem is that GBPG.L is traded in GBP, and GBP.L is GBp (aka GBX). A fix is more than changing one line. It would necessitate also calling AV's SYMBOL_SEARCH API which returns the currency for a given symbol:

% curl 'https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=GBP.L&apikey=FOOBAR&datatype=json'
{
    "bestMatches": [
        {
            "1. symbol": "GBP.LON",
            "2. name": "Global Petroleum Limited",
            "3. type": "Equity",
            "4. region": "United Kingdom",
            "5. marketOpen": "08:00",
            "6. marketClose": "16:30",
            "7. timezone": "UTC+01",
            "8. currency": "GBX",
            "9. matchScore": "1.0000"
        }
    ]
}

That introduces its own problem as the AV module is forced to throttle API calls to 5 per minute because of the AlphaVantage's limitations on using the free API key. For UK securities that would need 2 queries per symbol, that comes down to just 2 stocks per minute.

from finance-quote.

bpschuck avatar bpschuck commented on June 2, 2024

@Kaligula0,

Thanks for pointing that out! It sheds more light on the issue at hand.

The currency map has been in place since the module was originally written since the quote API does not include a currency. Shortly afterwards Erik added the correcting when he or someone noticed that some LSE stocks are traded in GBX/GBp and not GBP. I reached out to AlphaVantage asking if they could include the traded currency in the JSON returned by the API and their answer:

"Hi Bruce, thanks for the feature request. We will ask our upstream data partner whether they can license us to modify the JSON schema to include the currency info. Thank you!"

Unfortunately this is pretty much the same answer I was given to other requests in the past that were never fulfilled.

This goes back to my comment (#281 (comment)) where for each LSE traded sumbol, an additional lookup using the SYMBOL_SEARCH API is required to confidently set the currency used.

With API usage throttled to 5 calls per minute by AlphaVantage, this is definitely an annoyance for anyone who may use the AphaVantage module for LSE traded securities. So far the only one complaining is Wm-X. Others probably use another module to fetch pricing for those securities.

Because he/she continues to act like a 5 year old and cannot play nice, Wm-X is blocked from the F::Q repository and his last few comments have been deleted. I tried to explain, with examples, that the issue is not as simple as he thinks it is. As for the AlphaVantage module, for now I think a CAVEAT section will be added to its POD with a short description of the currency issue with LSE traded securities.

Bruce S.

from finance-quote.

Kaligula0 avatar Kaligula0 commented on June 2, 2024

Yeah, I got some spam emails since (s)he posted a few replies, that's why I came here to analyse the issue.

The complete solution would require:

  • to check which stock exchanges have securities in different currencies and mark them in module's code
  • the module to check if any securities in a call are from the exchanges mentioned above, and if yes then make an additional API call.. . which would be inconvenient, but reliable. 🤷‍♂️

from finance-quote.

bpschuck avatar bpschuck commented on June 2, 2024

to check which stock exchanges have securities in different currencies and mark them in module's code

That is much easier said than done. One would need to know all the securities available from AlphaVantage, and then for each security check the trade currency. I've only been able to find a list of all US securities available from AV.

the module to check if any securities in a call are from the exchanges mentioned above, and if yes then make an additional API call.. . which would be inconvenient, but reliable.

I'm not sure how many F::Q users may be using the AV method for fetching non-US traded securities. Effort vs reward. As I said previously, only one person thought it important enough to make a stink about it. So next time I am working on something I'll just add the CAVEAT I mentioned and be done with it. Now if someone else wants to spend the time and effort, they can have at it. That's the beauty of opensource. Seems the Wm-X person doesn't understand that. Just because I somehow became the current gatekeeper of getting F::Q releases pushed to CPAN, does not mean I am expected to fix issues reported for all the modules contributed by the community over the years. Hell, I especially don't care to even start looking at fixing AV since it may only help the person who has acted like a complete asshole. Maybe I should have said if he sends $100 in BTC to my crypto-wallet I'll be glad to work on it...

So it will sit on hold for now. Who knows, AlphaVantage may even respond again to my email indicating the currency (and exchange which isn't even in the SYMBOL_SEARCH json) are now available.

Bruce S.

from finance-quote.

bpschuck avatar bpschuck commented on June 2, 2024

If throttling was not required, then adding a second call to fetch the currency for every quote would be relatively trivial. But because of the limitations of AV's free API key, adding that second call for all or select securities means reworking the throttling mechanism.

from finance-quote.

Kaligula0 avatar Kaligula0 commented on June 2, 2024

That is much easier said than done. (...)

I completely understand that :) Just wanted to point out a possible solution for someone who will want to fix that, since that's what GitHub Issues module is for ;)

from finance-quote.

bpschuck avatar bpschuck commented on June 2, 2024

For those interested, please see the Finance::Quote - AlphaVantage Trade Currencies thread on the GnuCash-User email list. I think John R's idea of the user adding ".X" to symbols that they know AlphaVantage returns in GPb/GBX to cause the method to return the price data in GBP (GBX/100) is probably the simplest way to deal with this issue at this time. I will have a PR ready soon.

from finance-quote.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.