Documentation
¶
Overview ¶
Package api holds the JSON types of Fundarr's read API (/api/v1, see docs/api.md), so a Go app decodes the answers straight into them, and turns a copy of the history into what pkg/model and pkg/portfolio take:
var page api.Changes // GET /api/v1/changes?after=<cursor> json.NewDecoder(resp.Body).Decode(&page) copy.Apply(page) // copy is an api.Copy, kept with page.Cursor acts, transfers := copy.Ledger() now := portfolio.Now(acts, transfers, prices, time.Now())
Index ¶
Constants ¶
View Source
const ( Upsert = "upsert" // add or replace the activity Remove = "remove" // delete it )
Change kinds.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Activity ¶
type Activity struct {
model.Activity
Source Source `json:"source"`
// Cost: what an incoming asset cost, in Currency (bought with cash,
// carried over a transfer, or valued at the day's price). Not in the
// changes feed.
Cost string `json:"cost,omitempty"`
Currency string `json:"currency,omitempty"`
// TransferWith: the other side of a move between your own accounts.
TransferWith string `json:"transferWith,omitempty"`
// Correction: made by Fundarr's balance check, not by the platform.
Correction bool `json:"correction,omitempty"`
}
Activity is an activity with what Fundarr worked out across sources, as /api/v1/activities and /api/v1/changes serve it.
type Change ¶
type Change struct {
Op string `json:"op"`
ID string `json:"id"`
Activity *Activity `json:"activity,omitempty"`
}
Change is one entry of the changes feed; Activity is nil on removals.
type Changes ¶
type Changes struct {
Changes []Change `json:"changes"`
Cursor string `json:"cursor"`
More bool `json:"more"`
}
Changes is one answer of GET /api/v1/changes: pass Cursor as after next time, and call again right away while More is true.
Click to show internal directories.
Click to hide internal directories.