summaryrefslogtreecommitdiff
path: root/assets.h
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2021-05-31 06:11:22 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2021-05-31 06:11:22 -0700
commit18bde7391efb9c6bd6ea7846891ab5d16276a809 (patch)
tree237cc152edbdf934ed32e4c8c54c5ce97535e57f /assets.h
downloadstonks-master.tar.gz
stonks-master.tar.xz
initial importHEADmaster
A bit messy and missing error handling in some places.
Diffstat (limited to 'assets.h')
-rw-r--r--assets.h36
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