summaryrefslogtreecommitdiff
path: root/assets.h
blob: 211ad66c8416abee7290b6cbcd88fb3ef41e765f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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