Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

stocks.h

Go to the documentation of this file.
00001 /* libstocks - Library to get current stock quotes from Yahoo Finance
00002  *
00003  * Copyright (C) 2000 Eric Laeuffer
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public
00016  * License along with this library; if not, write to the
00017  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018  * Boston, MA 02111-1307, USA.
00019  */
00020 
00021 #ifndef __STOCKS_H__
00022 #define __STOCKS_H__
00023 
00024 /* Defines for prototypes */
00025 #ifndef __LISTS_C__
00026 #define _LISTS_C_EXT extern
00027 #else
00028 #define _LISTS_C_EXT
00029 #endif /* __LISTS_C__ */
00030 
00031 #ifndef __STOCKS_C__
00032 #define _STOCKS_C_EXT extern
00033 #else
00034 #define _STOCKS_C_EXT
00035 #endif /* __STOCKS_C__ */
00036 
00037 #ifndef __HTTP_C__
00038 #define _HTTP_C_EXT extern
00039 #else
00040 #define _HTTP_C_EXT
00041 #endif /* __HTTP_C__ */
00042 
00043 #ifndef __CURRENCY_C__
00044 #define _CURRENCY_C_EXT extern
00045 #else
00046 #define _CURRENCY_C_EXT
00047 #endif /* __CURRENCY_C__ */
00048 
00049 #ifndef __HISTORY_C__
00050 #define _HISTORY_C_EXT extern
00051 #else
00052 #define _HISTORY_C_EXT
00053 #endif /* __HISTORY_C__ */
00054 
00055 typedef struct stockstruct stock;
00056 
00057 struct stockstruct {
00058   char  *Symbol;
00059   char  *Name;
00060   char  *Time;
00061   char  *Date;
00062   float CurrentPrice;
00063   float LastPrice;
00064   float OpenPrice;
00065   float MinPrice;
00066   float MaxPrice;
00067   float Variation;
00068   float Pourcentage;
00069   int   Volume;
00070   stock *PreviousStock;
00071   stock *NextStock;
00072 };
00073 
00074 /* Errors generates by the library */
00075 typedef enum {
00076   NOERR   = 0,  /* No error */
00077   ERRHOST = 1,  /* No such host */
00078   ERRSOCK = 2,  /* Can't create socket */
00079   ERRCONN = 3,  /* Can't connect to host */
00080   ERRWHEA = 4,  /* Write error on socket while writing */
00081   ERRRHEA = 5,  /* Cannot find header in http response */
00082   ERRPAHD = 7,  /* Invalid answer from data server */
00083   ERRPCSV = 8,  /* Error in parsing csv file */
00084   ERRPROX = 20, /* Bad proxy url */
00085   ERRDATE = 30, /* Bad date format */
00086   ERRDATA = 40, /* No data available */
00087   ERRRANG = 50  /* No prices for this date range */
00088 
00089 } libstocks_return_code;
00090 
00091 _LISTS_C_EXT  stock *next_stock(stock *);
00092 _LISTS_C_EXT  stock *previous_stock(stock *);
00093 _LISTS_C_EXT  void free_stocks(stock *);
00094 _LISTS_C_EXT  stock *find_stock(stock *stocks, char *);
00095 
00096 _STOCKS_C_EXT libstocks_return_code get_stocks(const char *, stock **);
00097 
00098 _HTTP_C_EXT   libstocks_return_code set_proxy(char *);
00099 
00100 
00101 _CURRENCY_C_EXT libstocks_return_code get_currency_exchange(char *, 
00102                   char *, 
00103                   float *);
00104 
00105 _HISTORY_C_EXT libstocks_return_code get_history_csv(char *, 
00106                  char *, 
00107                  char *, 
00108                  char **);
00109 
00110 _HISTORY_C_EXT libstocks_return_code get_stock_history(char *, 
00111                    char *, 
00112                    char *, 
00113                    stock **);
00114 
00115 
00116 #endif /* __STOCKS_H__ */

Generated on Sat Nov 5 16:18:00 2005 for OPIE by  doxygen 1.4.2