aboutsummarylogtreecommitdiffstats
path: root/api.h
diff options
context:
space:
mode:
Diffstat (limited to 'api.h')
-rw-r--r--api.h53
1 files changed, 45 insertions, 8 deletions
diff --git a/api.h b/api.h
index 4000c1ebbbf0..3e6bb5e54166 100644
--- a/api.h
+++ b/api.h
@@ -1,32 +1,59 @@
/**
- * API data is taken from IEX Trading, Morningstar, Coinmarketcap, and News API.
+ * API data is taken from IEX Trading, Morningstar, Coinmarketcap.
* https://iextrading.com/developer/docs/
* http://www.morningstar.com/
* https://coinmarketcap.com/api/
- * https://newsapi.org/docs
*/
#ifndef API_H
#define API_H
+#define QUARTERS 4
#define DATE_MAX_LENGTH 16
#define SYMBOL_MAX_LENGTH 32
#define URL_MAX_LENGTH 2048
+#define INFO_TEXT_MAX 2048
#define EMPTY (-999)
#include <stddef.h>
#include <curl/curl.h>
#include <json-c/json_tokener.h>
+#include <pthread.h>
#include "string-tick.h"
typedef struct info {
- char name[SYMBOL_MAX_LENGTH]; // Name of security (ex. Apple Inc.)
+ /* Company */
char symbol[SYMBOL_MAX_LENGTH]; // Symbol of security (ex. AAPL)
+ char name[INFO_TEXT_MAX]; // Name of security (ex. Apple Inc.)
+ char industry[INFO_TEXT_MAX];
+ char website[URL_MAX_LENGTH];
+ char description[INFO_TEXT_MAX]; // Description of company
+ char ceo[INFO_TEXT_MAX];
+ char issue_type[3];
+ char sector[INFO_TEXT_MAX];
+
+ /* Quote */
+ int64_t intraday_time; // unix time
double price; // Current price of security in USD (ex. 174.54)
- double change_1d, change_7d, change_30d; // Percent change in the past x days (ex. -7.49)
+ int64_t marketcap; // Market cap in USD (ex. 890489000000)
+ int64_t volume_1d; // Volume in shares of security (ex. 33812360)
+ double pe_ratio;
+
+ /* Stats */
double div_yield; // Percent dividend yield (ex. 1.46)
- long marketcap; // Market cap in USD (ex. 890489000000)
- long volume_1d; // Volume in shares of security (ex. 33812360)
+ int64_t revenue;
+ int64_t gross_profit;
+ int64_t cash;
+ int64_t debt;
+
+ /* Earnings */
+ double eps[QUARTERS];
+ char fiscal_period[QUARTERS][DATE_MAX_LENGTH];
+ double eps_year_ago[QUARTERS];
+
+ /* Chart */
+ double change_1d, change_7d, change_30d; // Percent change in the past x days (ex. -7.49)
+ double* points; // 5y
} Info;
/**
@@ -72,6 +99,16 @@ double* api_get_current_price(const char* symbol);
*/
double* iex_get_price(const char* symbol);
+void* iex_store_company(void* vpInfo);
+
+void* iex_store_quote(void* vpInfo);
+
+void* iex_store_stats(void* vpInfo);
+
+void* iex_store_earnings(void* vpInfo);
+
+void* iex_store_chart(void* vpInfo);
+
/**
* Returns current and yesterday's price of a mutual fund with data from Morningstar
* Tested for MUTF and OTCMKTS listed securities.
@@ -125,10 +162,10 @@ void api_print_info(const char* ticker_name_string);
/**
* Returns a pointer to an Info object containing info pertaining
* to the given symbol with data from IEX.
- * @param ticker_name_string stock/etf symbol
+ * @param symbol stock/etf symbol
* @return Info object
*/
-Info* iex_get_info(const char* ticker_name_string);
+Info* iex_get_info(const char* symbol);
/**
* Returns a pointer to an Info object containing info pertaining