[GNC-dev] Alphavantage strategies

John Ralls jralls at ceridwen.us
Tue Jan 22 10:16:44 EST 2019



> On Jan 22, 2019, at 1:58 AM, Wm via gnucash-devel <gnucash-devel at gnucash.org> wrote:
> 
> On 21/01/2019 20:10, Derek Atkins wrote:
>> Wm via gnucash-devel <gnucash-devel at gnucash.org> writes:
>> [snip]
>>>>> Wm's suggestion
>>>>> ===============
>>>>> only collect if the most recent price is more than 1 day (or 12 hours,
>>>>> etc) old [2].  this sort of fits in with the existing post collection
>> [snip]
>>> Do you really miss the point on purposes?  If gnc collects the last
>>> price it doesn't have that is a good thing.
>> All GnuCash knows is the time of the last price it received/stored. 
> 
> Yup, it also can't know the significance of one price vs another for the user.  If you're suggesting a price priority option I'm not against that but I don't think it solves the problem you don't perceive.  It would be a lot of work UI wise and I'm pretty sure as soon as it appeared someone would strongly object.
> 
>> It
>> has to make the request to A-V to know if there is a new price. 
> 
> There is always a new price in modern markets.  That doesn't mean gnc should be requesting a price every second or millisecond.  The db design simply doesn't support that sort of trading.  There is other software for that.
> 
>> So that
>> means, by definition, GnuCash will automatically request any prices >
>> <Delta> old, whether or not there is a "new price", because GnuCash
>> can't know if there is a new price until it makes the request.
> 
> gnc can be a good citizen and not ask for a price it already has.  I am suggesting it asks for prices it doesn't have first.  Why is this suggestion so troubling to you?
> 
>> Sure, this is a "Good Thing", but it's definitely not going to limit the
>> number of price requests GnuCash makes....   Unless, of course, you're
>> assuming people are requesting prices every few minutes?
> 
> this has been done repeatedly in the user list, people *are* trying to use gnc for intra day trading and generally find it doesn't work.
> 
> I may be misreading you, Derek
> It is possible you are playing devil's advocate
> It appears to me you are against gnc (or possibly F::Q) backing off and being a good citizen or doing a good thing.

Wm,

F::Q has had a commit to add 6 seconds between requests in its git repo for almost a year, but the maintainer hasn’t been able to make time to do a new release. This has been discussed several times on the user list.

There’s also already a price-priority built into GnuCash. There are several levels, but the significant ones are transaction-creation, finance-quote, price-editor. Sources to the right can replace sources to their left and themselves but not sources to the right, so e.g. once  you’ve created a price in the price editor that’s the one for the day. 

I don’t want GnuCash to make assumptions about what F::Q does internally, so I think the algorithm you’re proposing would look like:

1 Make list of commodities to retrieve from Alphavantage
2 Check for prices for today, splitting the above list into have-price and don’t-have-price
3 Request the don’t-have-price list. If it partly fails, wait 60 seconds and return to 2.
4 Wait 60 seconds and request the have-price list. 

The code would go into libgnucash/scm/price-quotes.scm.

Regards,
John Ralls


More information about the gnucash-devel mailing list