Diffstat (limited to 'noncore/todayplugins/stockticker/libstocks/stocks.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/todayplugins/stockticker/libstocks/stocks.h | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/noncore/todayplugins/stockticker/libstocks/stocks.h b/noncore/todayplugins/stockticker/libstocks/stocks.h new file mode 100644 index 0000000..13250ca --- a/dev/null +++ b/noncore/todayplugins/stockticker/libstocks/stocks.h | |||
@@ -0,0 +1,116 @@ | |||
1 | /* libstocks - Library to get current stock quotes from Yahoo Finance | ||
2 | * | ||
3 | * Copyright (C) 2000 Eric Laeuffer | ||
4 | * | ||
5 | * This library is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU Library General Public | ||
7 | * License as published by the Free Software Foundation; either | ||
8 | * version 2 of the License, or (at your option) any later version. | ||
9 | * | ||
10 | * This library is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | * Library General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU Library General Public | ||
16 | * License along with this library; if not, write to the | ||
17 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | * Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef __STOCKS_H__ | ||
22 | #define __STOCKS_H__ | ||
23 | |||
24 | /* Defines for prototypes */ | ||
25 | #ifndef __LISTS_C__ | ||
26 | #define _LISTS_C_EXT extern | ||
27 | #else | ||
28 | #define _LISTS_C_EXT | ||
29 | #endif /* __LISTS_C__ */ | ||
30 | |||
31 | #ifndef __STOCKS_C__ | ||
32 | #define _STOCKS_C_EXT extern | ||
33 | #else | ||
34 | #define _STOCKS_C_EXT | ||
35 | #endif /* __STOCKS_C__ */ | ||
36 | |||
37 | #ifndef __HTTP_C__ | ||
38 | #define _HTTP_C_EXT extern | ||
39 | #else | ||
40 | #define _HTTP_C_EXT | ||
41 | #endif /* __HTTP_C__ */ | ||
42 | |||
43 | #ifndef __CURRENCY_C__ | ||
44 | #define _CURRENCY_C_EXT extern | ||
45 | #else | ||
46 | #define _CURRENCY_C_EXT | ||
47 | #endif /* __CURRENCY_C__ */ | ||
48 | |||
49 | #ifndef __HISTORY_C__ | ||
50 | #define _HISTORY_C_EXT extern | ||
51 | #else | ||
52 | #define _HISTORY_C_EXT | ||
53 | #endif /* __HISTORY_C__ */ | ||
54 | |||
55 | typedef struct stockstruct stock; | ||
56 | |||
57 | struct stockstruct { | ||
58 | char *Symbol; | ||
59 | char *Name; | ||
60 | char *Time; | ||
61 | char *Date; | ||
62 | float CurrentPrice; | ||
63 | float LastPrice; | ||
64 | float OpenPrice; | ||
65 | float MinPrice; | ||
66 | float MaxPrice; | ||
67 | float Variation; | ||
68 | float Pourcentage; | ||
69 | int Volume; | ||
70 | stock *PreviousStock; | ||
71 | stock *NextStock; | ||
72 | }; | ||
73 | |||
74 | /* Errors generates by the library */ | ||
75 | typedef enum { | ||
76 | NOERR = 0, /* No error */ | ||
77 | ERRHOST = 1, /* No such host */ | ||
78 | ERRSOCK = 2, /* Can't create socket */ | ||
79 | ERRCONN = 3, /* Can't connect to host */ | ||
80 | ERRWHEA = 4, /* Write error on socket while writing */ | ||
81 | ERRRHEA = 5, /* Cannot find header in http response */ | ||
82 | ERRPAHD = 7, /* Invalid answer from data server */ | ||
83 | ERRPCSV = 8, /* Error in parsing csv file */ | ||
84 | ERRPROX = 20, /* Bad proxy url */ | ||
85 | ERRDATE = 30, /* Bad date format */ | ||
86 | ERRDATA = 40, /* No data available */ | ||
87 | ERRRANG = 50 /* No prices for this date range */ | ||
88 | |||
89 | } libstocks_return_code; | ||
90 | |||
91 | _LISTS_C_EXT stock *next_stock(stock *); | ||
92 | _LISTS_C_EXT stock *previous_stock(stock *); | ||
93 | _LISTS_C_EXT void free_stocks(stock *); | ||
94 | _LISTS_C_EXT stock *find_stock(stock *stocks, char *); | ||
95 | |||
96 | _STOCKS_C_EXT libstocks_return_code get_stocks(const char *, stock **); | ||
97 | |||
98 | _HTTP_C_EXT libstocks_return_code set_proxy(char *); | ||
99 | |||
100 | |||
101 | _CURRENCY_C_EXT libstocks_return_code get_currency_exchange(char *, | ||
102 | char *, | ||
103 | float *); | ||
104 | |||
105 | _HISTORY_C_EXT libstocks_return_code get_history_csv(char *, | ||
106 | char *, | ||
107 | char *, | ||
108 | char **); | ||
109 | |||
110 | _HISTORY_C_EXT libstocks_return_code get_stock_history(char *, | ||
111 | char *, | ||
112 | char *, | ||
113 | stock **); | ||
114 | |||
115 | |||
116 | #endif /* __STOCKS_H__ */ | ||