Blame view

src/stock.h 576 Bytes
Imanol-Mikel Barba Sabariego authored
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
#ifndef _STOCK_H_
#define _STOCK_H_

#define FETCH_TIME 60
#define ALTERNATE_TIME 5
#define MAX_UPDATE_RETRIES 5
#define ALTERNATIONS_PER_SYMBOL 4
#define API_DELAY 1

#define BASE_URL "https://finnhub.io/api/v1/quote?symbol="

typedef struct color_t {
  uint8_t r;
  uint8_t g;
  uint8_t b;
} color_t;

typedef struct stock_data {
  const char* name;
  float current;
  float delta;
  color_t color;
} stock_data;

esp_err_t init_stock();
esp_err_t update_stock_price(float current, float delta);
void display_stock_task(void* arg);
void fetch_stock_task(void* arg);

#endif