diff options
Diffstat (limited to 'assets.h')
-rw-r--r-- | assets.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/assets.h b/assets.h new file mode 100644 index 0000000..211ad66 --- /dev/null +++ b/assets.h @@ -0,0 +1,36 @@ +#ifndef ASSETS_H +#define ASSETS_H + +#include "quotes.h" + +#include <stdbool.h> + +#define FOREACH_ASSET_TYPE(M) \ + M(STOCK) \ + M(OPTION) \ + M(CRYPTO) \ + M(TOTAL) +#define GENERATE_ENUM(T) T, +#define GENERATE_STRING(T) #T, + +enum asset_type { + FOREACH_ASSET_TYPE(GENERATE_ENUM) +}; + +// FIXME PREFIX +extern char *ASSET_TYPE_NAMES[]; + +struct asset { + char *symbol; + enum asset_type type; + bool usd, btc; + double amt, usd_pr, usd_ch, usd_tot, btc_pr, btc_ch, btc_tot; +}; + +void asset_free(struct asset *a); +int asset_cmp(const void *a, const void *b); + +void add_quotes_to_assets(struct asset **, int, struct quote **, int); +int add_totals(struct asset **, int); + +#endif |