I’m working on a script that I would like to exit prematurely if the current rate is not greater than zero, in order to respect breaks. I see that goals returned by the API have a rate attribute, but it’s defined as follows:

The slope of the (final section of the) yellow brick road

I don’t think that’s what I want, since I want the current rate, regardless of what the road ends up doing.

I think you need to get the roadall matrix and find the first row with date > today. Does that make sense? Possibly the API should make a common thing like that easier so it’s very good that you’re asking things like this as they come up (and other people should chime in or click too!).

road (array): Array of tuples that can be used to construct the Yellow Brick Road. This field is also known as the road matrix. Each tuple specifies 2 out of 3 of [ time , goal , rate ]. To construct the road, start with a known starting point (time, value) and then each row of the road matrix specifies 2 out of 3 of {t,v,r} which gives the segment ending at time t. You can walk forward filling in the missing 1-out-of-3 from the (time, value) in the previous row.

So I’d find the first segment with an ending time after now, and use the specified rate.

But sometimes rate isn’t specified, goal is. And I’m guessing goal is the bottom edge of the YBR at that particular moment? So, in that case, I’d have to do some sort of geometry to figure out what the rate is?

But if, for example, all the other points specify rate and not goal, then I’d have to calculate the entire YBR from the beginning in order to figure out the rate of the segment of interest, yes?

What about this so inconspicuously named attribute of the goal resource?

mathishard (array of 3 numbers): The goaldate, goalval, and rate — all filled in. (The road dial specifies 2 out of 3 and you can check this if you want Beeminder to do the math for you on inferring the third one.)

Affirmative. And “mathishard” sounds equally likely to have been me or @bee or @apb. I bet it was Andy. It’s pretty great, right? But oh my goodness does the API need a v2. So much cruft!