Giter Club home page Giter Club logo

demmings / cachefinance Goto Github PK

View Code? Open in Web Editor NEW
30.0 6.0 3.0 858 KB

A custom function to supplement GOOGLEFINANCE so data is always available and unsupported stocks can get price/name/yield data. As you can guess from the name, data is cached so when '#N/A' appears it does not mess up your asset history logging/graphing.

License: GNU General Public License v3.0

JavaScript 100.00%
cache googlefinance cachefinance google sheets google-apps-script apps-script

cachefinance's Introduction

Hi My name is Chris Demmings

Sheets Custom Function Developer

Retired from programming server side applications in the school notifications industry. (your kid was absent (or will be absent) messages via phone, email, text...)

  • ๐ŸŒย  I'm based in Greater Toronto Area (GTA).
  • ๐Ÿ–ฅ๏ธ See my portfolio at My Home Page
  • ๐Ÿš€ย  I'm currently working on gsSQL
  • ๐Ÿง ย  I'm learning Google Sheets Javascript

Skills

JavaScript MySQL NodeJS

Socials

Badges

My GitHub Stats

demmings's GitHub stats

GitHub Commits Graph

Top Repositories








cachefinance's People

Contributors

demmings avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cachefinance's Issues

Throttling Requests to third party finance sites.

Some sites (like Finnhub, AlphaVantage,...) have limits - especially for free API access. So making any requests after reaching a specific limit is just wasting time and another site should be queried instead.

There are limits like:

  • Max requests per second
  • Max requests per minute
  • Max requests per day
  • Max requests per month.

We may need to implement some kind of locking when updating the stats for each data supplier, but v1 will not implement this feature.
It would also be nice to be able to query the internal stats so we can see the requests per time period - and also the retrieval failures.
We should also adjust data lookups if the fastest site starts giving periodic or sustained failures.

Optimize 3rd Party Website Searching

  • Currently there is no optimization for doing any website lookups when looking for some finance data.
  • Some websites just never work for certain symbols
  • Some website take much longer than others to do a lookup.
  • When a lookup is required, we should look at what approach was optimal the last time it was done.
  • If this symbol has not been recently search for, we should try each provider and determine which works and which works fastest. Then record which service to use for the attribute we are looking for.
  • We should also probably note any info required needed to do the lookup fastest. For example, some sites have different URLs for ETF and STOCK searches. Since we are not sure what the symbol is for, we should remember any of this extra info needed for the lookup.
  • We should also note, the next optimal site to use, just in case in a future lookup, that site is down.
  • We should also note the number of failures in a row, so we would at some point completely remove that provider to use. This could also happen when the site changes and our extraction from the site (regex) fails.
  • We should also just do a lookup on all sites after a period of time, just in case the optimial site changes.
  • It would also be nice to have a custom function to be able to report on our lookup status/failures so we know if changes are required or new sites should be used.

More supported attributes

Currently supported: attribute - three supported attributes for now "price", "yieldpct", "name".

If I understood the script flow correctly, firstly it is attempted to use GOOGLEFINANCE and if that fails, scripts will try cache, than other resources.

I understand, that other sources require implementations for more than 3 listed attributes, but not sure why further GOOGLEFINANCE attributes are not available, namely: low52, high52, pe, eps ?
Trying to use cachefinance() with one of these attributes renders error "invalid attribute" as script tries to pull it from yahoo, but I am not sure if there was attempt to get it from GOOGLEFINANCE first. My impression is that it goes first to yahoo, as using cachefinance with low52 always returns error, but with googlefinance directly, at the moment of my tests it gets the values.

Could you please confirm this, maybe my logic is wrong?
My current workaround is to use it as:
=CACHEFINANCE("Ticker", "low52", GOOGLEFINANCE("Ticker", "low52"))

Thanks

Monitor Process Needed

The current design of each cachefinance thread that updates a specific attribute (price, name, yield...) relies on the fact that Google Sheets will not take minutes to perform a basic function that most of the time takes a few seconds at worst. This however is a bad assumption. So the problem is that the trigger itself creates the next trigger to be run when it is done. If it had not finished its current update, it would schedule another trigger soon and pick up where it left off - OR would create a trigger in the next time slot based on the schedule for that attribute.
So, if Google Sheets just decides to freeze up for very long periods of time, the trigger is aborted and the new trigger is not created - this is a problem.
A new monitor process needs to monitor triggers that are scheduled and will create ones that have died.

Why new permissions are needed?

First of all thanks for sharing this, it is very appreciated.

Could you please add permission explanation to the readme, which permissions are necessary and why exactly?
Is there an alternative to give permission? Could we limit the scope and how we could make users feel safer?
Thanks a lot

Trigger Setup Issues

  1. Adding a new stock symbol into the list of stocks to update (price, name, yieldpct), may take a long time to update - depending on what the refresh interval is set in the trigger setup panel (a range on a sheet that requires specific info about what, when, where to update)
  2. If you insert/remove rows into the list of stocks to update and forget to update the range in the trigger setup data area - data may not update OR data may be overwritten. Maybe we need a START/END flag for the column? UP for debate.

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.