diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2021-05-31 06:11:22 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2021-05-31 06:11:22 -0700 |
commit | 18bde7391efb9c6bd6ea7846891ab5d16276a809 (patch) | |
tree | 237cc152edbdf934ed32e4c8c54c5ce97535e57f /assets.h | |
download | stonks-18bde7391efb9c6bd6ea7846891ab5d16276a809.tar.gz stonks-18bde7391efb9c6bd6ea7846891ab5d16276a809.tar.xz |
A bit messy and missing error handling in some places.
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 |