stock.h 576 Bytes
#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