Added initial revision of stock widget to repo.
[stockwidget] / stockgetter.h
diff --git a/stockgetter.h b/stockgetter.h
new file mode 100644 (file)
index 0000000..aacecc9
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef _STOCKGETTER_H_
+#define _STOCKGETTER_H_
+
+#include <curl/curl.h>
+
+#define SG_OK                                  +1
+#define SG_INVALID_PARAMS              -1
+#define SG_LOOKUP_FAILURE              -2
+#define SG_BAD_ALLOC                   -3
+
+typedef struct _StockBuffer
+{
+       int nCurr;
+       int nCount;
+       char *pszBuffer;
+} StockBuffer;
+
+typedef struct _SGHandle
+{
+       CURL *hCurlHandle;
+       StockBuffer sData;
+} *SGHandle;
+
+/* API */
+
+SGHandle
+InitStockGetter(void);
+
+int
+RetrieveStockPrice(SGHandle             hSG,
+                                  char                 *szTicker,
+                                  float                *pfValue,
+                                  float                *pfChangeReal,
+                                  float                *pfChangePercent);
+
+int
+FreeStockGetter(SGHandle hSG);
+
+#endif/*_STOCKGETTER_H_*/