/[drupal]/contributions/modules/stockapi/stockapi.install
ViewVC logotype

Diff of /contributions/modules/stockapi/stockapi.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3, Tue May 20 16:34:23 2008 UTC revision 1.4, Mon Jul 21 05:25:56 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id: stockapi.install,v 1.3 2008/05/20 16:34:23 kbahey Exp $
3    
4  /*  /*
5   * Implementation of hook_schema   * Implementation of hook_schema
6   */   */
7  function stockapi_schema() {  function stockapi_schema() {
8      $schema['stockapi'] = array(    $schema['stockapi'] = array(
9          'description' => t('A table to store stock information'),      'description' => t('A table to store stock information'),
10        'fields' => array(
11          'fields' => array(        'symbol' => array(
12              'symbol' => array(          'description' => t('Symbol'),
13                  'description' => t('Stock symbol'),          'type' => 'varchar',
14                  'type' => 'varchar',          'length' => 12,
15                  'length' => 10,          'not null' => TRUE,
16                  'not null' => TRUE,          'default' => '',
17                  'default' => '',          'yahoo' => 's'),
18              ),        'name' => array(
19            'description' => t('Company Name'),
20              'name' => array(          'type' => 'varchar',
21                  'description' => t('Company symbol'),          'length' => 64,
22                  'type' => 'varchar',          'not null' => TRUE,
23                  'length' => 50,          'default' => '',
24                  'not null' => TRUE,          'yahoo' => 'n'),
25                  'default' => '',        'last_trade_with_time' => array(
26              ),          'description' => t('Last Trade (With Time)'),
27            'type' => 'varchar',
28              'current_price' => array(          'length' => 75,
29                  'description' => t('Current price'),          'not null' => TRUE,
30                  'type' => 'float',          'default' => '',
31                  'not null' => TRUE,          'yahoo' => 'l'),
32                  'default' => 0.0,        'last_trade_price_only' => array(
33              ),          'description' => t('Last Trade (Price Only)'),
34            'type' => 'float',
35              'change_amt' => array(          'not null' => TRUE,
36                  'description' => t('% Change'),          'default' => 0,
37                  'type' => 'float',          'yahoo' => 'l1'),
38                  'not null' => TRUE,        'last_trade_date' => array(
39                  'default' => 0.0,          'description' => t('Last Trade Date'),
40              ),          'type' => 'varchar',
41            'length' => 75,
42              'opening' => array(          'not null' => TRUE,
43                  'description' => t('Opening price'),          'default' => '',
44                  'type' => 'float',          'yahoo' => 'd1'),
45                  'not null' => TRUE,        'last_trade_time' => array(
46                  'default' => 0.0,          'description' => t('Last Trade Time'),
47              ),          'type' => 'varchar',
48            'length' => 75,
49              'high' => array(          'not null' => TRUE,
50                  'description' => t('High price'),          'default' => '',
51                  'type' => 'float',          'yahoo' => 't1'),
52                  'not null' => TRUE,        'last_trade_size' => array(
53                  'default' => 0.0,          'description' => t('Last Trade Size'),
54              ),          'type' => 'varchar',
55            'length' => 75,
56              'low' => array(          'not null' => TRUE,
57                  'description' => t('Low price'),          'default' => '',
58                  'type' => 'float',          'yahoo' => 'k3'),
59                  'not null' => TRUE,        'chg_and_pct_chg' => array(
60                  'default' => 0.0,          'description' => t('Change and Percent Change'),
61              ),          'type' => 'varchar',
62            'length' => 75,
63              'volume' => array(          'not null' => TRUE,
64                  'description' => t('Volume'),          'default' => '',
65                  'type' => 'int',          'yahoo' => 'c'),
66                  'not null' => TRUE,        'chg' => array(
67                  'unsigned' => TRUE,          'description' => t('Change'),
68                  'default' => 0,          'type' => 'float',
69              ),          'not null' => TRUE,
70            'default' => 0,
71              'last_date' => array(          'yahoo' => 'c1'),
72                  'description' => t('Last date updated'),        'pct_chg' => array(
73                  'type' => 'varchar',          'description' => t('Change in Percent'),
74                  'length' => 10,          'type' => 'varchar',
75                  'not null' => TRUE,          'length' => 75,
76                  'default' => 0,          'not null' => TRUE,
77              ),          'default' => '',
78            'yahoo' => 'p2'),
79              'last_time' => array(        'ticker_trend' => array(
80                  'description' => t(''),          'description' => t('Ticker Trend'),
81                  'type' => 'int',          'type' => 'varchar',
82                  'unsigned' => TRUE,          'length' => 75,
83                  'not null' => TRUE,          'not null' => TRUE,
84                  'default' => 0,          'default' => '',
85              ),          'yahoo' => 't7'),
86          'volume' => array(
87              'updated' => array(          'description' => t('Volume'),
88                  'description' => t(''),          'type' => 'float',
89                  'type' => 'int',          'length' => 25,
90                  'unsigned' => TRUE,          'not null' => TRUE,
91                  'not null' => TRUE,          'default' => 0,
92                  'default' => 0,          'yahoo' => 'v'),
93              )        'avg_daily_volume' => array(
94            'description' => t('Average Daily Volume'),
95          ),          'type' => 'float',
96          'primary key' => array('symbol')          'length' => 25,
97            'not null' => TRUE,
98            'default' => 0,
99            'yahoo' => 'a2'),
100          'more_info' => array(
101            'description' => t('More Info'),
102            'type' => 'varchar',
103            'length' => 255,
104            'not null' => TRUE,
105            'default' => '',
106            'yahoo' => 'i'),
107          'trade_links' => array(
108            'description' => t('Trade Links'),
109            'type' => 'varchar',
110            'length' => 255,
111            'not null' => TRUE,
112            'default' => '',
113            'yahoo' => 't6'),
114          'bid' => array(
115            'description' => t('Bid'),
116            'type' => 'float',
117            'not null' => TRUE,
118            'default' => 0,
119            'yahoo' => 'b'),
120          'bid_size' => array(
121            'description' => t('Bid Size'),
122            'type' => 'varchar',
123            'length' => 50,
124            'not null' => TRUE,
125            'default' => '',
126            'yahoo' => 'b6'),
127          'ask' => array(
128            'description' => t('Ask'),
129            'type' => 'float',
130            'not null' => TRUE,
131            'default' => 0,
132            'yahoo' => 'a'),
133          'ask_size' => array(
134            'description' => t('Ask Size'),
135            'type' => 'varchar',
136            'length' => 50,
137            'not null' => TRUE,
138            'default' => '',
139            'yahoo' => 'a5'),
140          'previous_close' => array(
141            'description' => t('Previous Close'),
142            'type' => 'float',
143            'not null' => TRUE,
144            'default' => 0,
145            'yahoo' => 'p'),
146          'open' => array(
147            'description' => t('Open'),
148            'type' => 'float',
149            'not null' => TRUE,
150            'default' => 0,
151            'yahoo' => 'o'),
152          'days_range' => array(
153            'description' => t('Day\'s Range'),
154            'type' => 'varchar',
155            'length' => 75,
156            'not null' => TRUE,
157            'default' => '',
158            'yahoo' => 'm'),
159          '52_week_range' => array(
160            'description' => t('52-week Range'),
161            'type' => 'varchar',
162            'length' => 75,
163            'not null' => TRUE,
164            'default' => '',
165            'yahoo' => 'w'),
166          'chg_52_week_low' => array(
167            'description' => t('Change From 52-week Low'),
168            'type' => 'varchar',
169            'length' => 75,
170            'not null' => TRUE,
171            'default' => '',
172            'yahoo' => 'j5'),
173          'pct_chg_from_52_wk_low' => array(
174            'description' => t('Percent Change From 52-wk Low'),
175            'type' => 'varchar',
176            'length' => 75,
177            'not null' => TRUE,
178            'default' => '',
179            'yahoo' => 'j6'),
180          'chg_from_52_wk_high' => array(
181            'description' => t('Change From 52-wk High'),
182            'type' => 'varchar',
183            'length' => 75,
184            'not null' => TRUE,
185            'default' => '',
186            'yahoo' => 'k4'),
187          'pct_chg_from_52_wk_high' => array(
188            'description' => t('Percent Change From 52-wk High'),
189            'type' => 'varchar',
190            'length' => 75,
191            'not null' => TRUE,
192            'default' => '',
193            'yahoo' => 'k5'),
194          'eps' => array(
195            'description' => t('Earnings/Share'),
196            'type' => 'float',
197            'not null' => TRUE,
198            'default' => 0,
199            'yahoo' => 'e'),
200          'pe_ratio' => array(
201            'description' => t('P/E Ratio'),
202            'type' => 'float',
203            'not null' => TRUE,
204            'default' => 0,
205            'yahoo' => 'r'),
206          'short_ratio' => array(
207            'description' => t('Short Ratio'),
208            'type' => 'float',
209            'not null' => TRUE,
210            'default' => 0,
211            'yahoo' => 's7'),
212          'dividend_pay_date' => array(
213            'description' => t('Dividend Pay Date'),
214            'type' => 'varchar',
215            'length' => 75,
216            'not null' => TRUE,
217            'default' => '',
218            'yahoo' => 'r1'),
219          'ex_dividend_date' => array(
220            'description' => t('Ex-Dividend Date'),
221            'type' => 'varchar',
222            'length' => 75,
223            'not null' => TRUE,
224            'default' => '',
225            'yahoo' => 'q'),
226          'dividend_per_share' => array(
227            'description' => t('Dividend/Share'),
228            'type' => 'float',
229            'not null' => TRUE,
230            'default' => 0,
231            'yahoo' => 'd'),
232          'dividend_yield' => array(
233            'description' => t('Dividend Yield'),
234            'type' => 'float',
235            'not null' => TRUE,
236            'default' => 0,
237            'yahoo' => 'y'),
238          'float_shares' => array(
239            'description' => t('Float Shares'),
240            'type' => 'varchar',
241            'length' => 75,
242            'not null' => TRUE,
243            'default' => '',
244            'yahoo' => 'f6'),
245          'market_cap' => array(
246            'description' => t('Market Capitalization'),
247            'type' => 'float',
248            'not null' => TRUE,
249            'default' => 0,
250            'yahoo' => 'j1'),
251          'one_yr_target_price' => array(
252            'description' => t('1-yr Target Price'),
253            'type' => 'float',
254            'not null' => TRUE,
255            'default' => 0,
256            'yahoo' => 't8'),
257          'eps_est_current_yr' => array(
258            'description' => t('EPS Estimate Current Year'),
259            'type' => 'float',
260            'not null' => TRUE,
261            'default' => 0,
262            'yahoo' => 'e7'),
263          'eps_est_next_year' => array(
264            'description' => t('EPS Estimate Next Year'),
265            'type' => 'float',
266            'not null' => TRUE,
267            'default' => 0,
268            'yahoo' => 'e8'),
269          'eps_est_next_quarter' => array(
270            'description' => t('EPS Estimate Next Quarter'),
271            'type' => 'float',
272            'not null' => TRUE,
273            'default' => 0,
274            'yahoo' => 'e9'),
275          'price_per_eps_est_current_year' => array(
276            'description' => t('Price/EPS Estimate Current Year'),
277            'type' => 'float',
278            'not null' => TRUE,
279            'default' => 0,
280            'yahoo' => 'r6'),
281          'price_per_eps_est_next_year' => array(
282            'description' => t('Price/EPS Est. Next Year'),
283            'type' => 'float',
284            'not null' => TRUE,
285            'default' => 0,
286            'yahoo' => 'r7'),
287          'peg_ratio' => array(
288            'description' => t('PEG Ratio'),
289            'type' => 'float',
290            'not null' => TRUE,
291            'default' => 0,
292            'yahoo' => 'r5'),
293          'book_value' => array(
294            'description' => t('Book Value'),
295            'type' => 'float',
296            'not null' => TRUE,
297            'default' => 0,
298            'yahoo' => 'b4'),
299          'price_per_book' => array(
300            'description' => t('Price/Book'),
301            'type' => 'float',
302            'not null' => TRUE,
303            'default' => 0,
304            'yahoo' => 'p6'),
305          'price_per_sales' => array(
306            'description' => t('Price/Sales'),
307            'type' => 'float',
308            'not null' => TRUE,
309            'default' => 0,
310            'yahoo' => 'p5'),
311          'ebitda' => array(
312            'description' => t('EBITDA'),
313            'type' => 'varchar',
314            'length' => 75,
315            'not null' => TRUE,
316            'default' => '',
317            'yahoo' => 'j4'),
318          '50_day_moving_average' => array(
319            'description' => t('50-day Moving Average'),
320            'type' => 'float',
321            'not null' => TRUE,
322            'default' => 0,
323            'yahoo' => 'm3'),
324          'chg_frm_50_day_ma' => array(
325            'description' => t('Change From 50-day Moving Average'),
326            'type' => 'varchar',
327            'length' => 75,
328            'not null' => TRUE,
329            'default' => '',
330            'yahoo' => 'm7'),
331          'pct_chg_frm_50_day_ma' => array(
332            'description' => t('Percent Change From 50-day Moving Average'),
333            'type' => 'varchar',
334            'length' => 75,
335            'not null' => TRUE,
336            'default' => '',
337            'yahoo' => 'm8'),
338          '200_day_moving_average' => array(
339            'description' => t('200-day Moving Average'),
340            'type' => 'float',
341            'not null' => TRUE,
342            'default' => 0,
343            'yahoo' => 'm4'),
344          'chg_frm_200_day_ma' => array(
345            'description' => t('Change From 200-day Moving Average'),
346            'type' => 'varchar',
347            'length' => 75,
348            'not null' => TRUE,
349            'default' => '',
350            'yahoo' => 'm5'),
351          'pct_chg_frm_200_day_ma' => array(
352            'description' => t('Percent Change From 200-day Moving Average'),
353            'type' => 'varchar',
354            'length' => 75,
355            'not null' => TRUE,
356            'default' => '',
357            'yahoo' => 'm6'),
358          'shares_owned' => array(
359            'description' => t('Shares Owned'),
360            'type' => 'varchar',
361            'length' => 75,
362            'not null' => TRUE,
363            'default' => '',
364            'yahoo' => 's1'),
365          'price_paid' => array(
366            'description' => t('Price Paid'),
367            'type' => 'float',
368            'not null' => TRUE,
369            'default' => 0,
370            'yahoo' => 'p1'),
371          'commission' => array(
372            'description' => t('Commission'),
373            'type' => 'varchar',
374            'length' => 75,
375            'not null' => TRUE,
376            'default' => '',
377            'yahoo' => 'c3'),
378          'holdings_value' => array(
379            'description' => t('Holdings Value'),
380            'type' => 'varchar',
381            'length' => 75,
382            'not null' => TRUE,
383            'default' => '',
384            'yahoo' => 'v1'),
385          'days_value_change' => array(
386            'description' => t('Day\'s Value Change'),
387            'type' => 'varchar',
388            'length' => 75,
389            'not null' => TRUE,
390            'default' => '',
391            'yahoo' => 'w1'),
392          'holdings_gain_pct' => array(
393            'description' => t('Holdings Gain Percent'),
394            'type' => 'varchar',
395            'length' => 75,
396            'not null' => TRUE,
397            'default' => '',
398            'yahoo' => 'g1'),
399          'holdings_gain' => array(
400            'description' => t('Holdings Gain'),
401            'type' => 'varchar',
402            'length' => 75,
403            'not null' => TRUE,
404            'default' => '',
405            'yahoo' => 'g4'),
406          'trade_date' => array(
407            'description' => t('Trade Date'),
408            'type' => 'varchar',
409            'length' => 75,
410            'not null' => TRUE,
411            'default' => '',
412            'yahoo' => 'd2'),
413          'annualized_gain' => array(
414            'description' => t('Annualized Gain'),
415            'type' => 'varchar',
416            'length' => 75,
417            'not null' => TRUE,
418            'default' => '',
419            'yahoo' => 'g3'),
420          'high_limit' => array(
421            'description' => t('Low Limit'),
422            'type' => 'varchar',
423            'length' => 75,
424            'not null' => TRUE,
425            'default' => '',
426            'yahoo' => 'l2'),
427          'notes' => array(
428            'description' => t('Notes'),
429            'type' => 'varchar',
430            'length' => 75,
431            'not null' => TRUE,
432            'default' => '',
433            'yahoo' => 'l3'),
434          'last_trade_rt' => array(
435            'description' => t('Last Trade (Real-Time) with Time'),
436            'type' => 'varchar',
437            'length' => 75,
438            'not null' => TRUE,
439            'default' => '',
440            'yahoo' => 'k1'),
441          'bid_rt' => array(
442            'description' => t('Bid (Real-Time)'),
443            'type' => 'varchar',
444            'length' => 75,
445            'not null' => TRUE,
446            'default' => '',
447            'yahoo' => 'b3'),
448          'ask_rt' => array(
449            'description' => t('Ask (Real-Time)'),
450            'type' => 'varchar',
451            'length' => 75,
452            'not null' => TRUE,
453            'default' => '',
454            'yahoo' => 'b2'),
455          'pct_chg_rt' => array(
456            'description' => t('Change Percent (Real-Time)'),
457            'type' => 'varchar',
458            'length' => 75,
459            'not null' => TRUE,
460            'default' => '',
461            'yahoo' => 'k2'),
462          'chg_rt' => array(
463            'description' => t('Change (Real-Time)'),
464            'type' => 'varchar',
465            'length' => 75,
466            'not null' => TRUE,
467            'default' => '',
468            'yahoo' => 'c6'),
469          'holdings_value_rt' => array(
470            'description' => t('Holdings Value (Real-Time)'),
471            'type' => 'varchar',
472            'length' => 75,
473            'not null' => TRUE,
474            'default' => '',
475            'yahoo' => 'v7'),
476          'days_value_chg_rt' => array(
477            'description' => t('Day\'s Value Change (Real-Time)'),
478            'type' => 'varchar',
479            'length' => 75,
480            'not null' => TRUE,
481            'default' => '',
482            'yahoo' => 'w4'),
483          'holdings_gain_pct_rt' => array(
484            'description' => t('Holdings Gain Percent (Real-Time)'),
485            'type' => 'varchar',
486            'length' => 75,
487            'not null' => TRUE,
488            'default' => '',
489            'yahoo' => 'g5'),
490          'holdings_gain_rt' => array(
491            'description' => t('Holdings Gain (Real-Time)'),
492            'type' => 'varchar',
493            'length' => 75,
494            'not null' => TRUE,
495            'default' => '',
496            'yahoo' => 'g6'),
497          'days_range_rt' => array(
498            'description' => t('Day\'s Range (Real-Time)'),
499            'type' => 'varchar',
500            'length' => 75,
501            'not null' => TRUE,
502            'default' => '',
503            'yahoo' => 'm2'),
504          'market_cap_rt' => array(
505            'description' => t('Market Cap (Real-Time)'),
506            'type' => 'varchar',
507            'length' => 75,
508            'not null' => TRUE,
509            'default' => '',
510            'yahoo' => 'j3'),
511          'pe_rt' => array(
512            'description' => t('P/E (Real-Time)'),
513            'type' => 'varchar',
514            'length' => 75,
515            'not null' => TRUE,
516            'default' => '',
517            'yahoo' => 'r2'),
518          'after_hours_change_rt' => array(
519            'description' => t('After Hours Change (Real-Time)'),
520            'type' => 'varchar',
521            'length' => 75,
522            'not null' => TRUE,
523            'default' => '',
524            'yahoo' => 'c8'),
525          'order_book_rt' => array(
526            'description' => t('Order Book (Real-Time)'),
527            'type' => 'varchar',
528            'length' => 75,
529            'not null' => TRUE,
530            'default' => '',
531            'yahoo' => 'i5'),
532          'exchange' => array(
533            'description' => t('Stock Exchange'),
534            'type' => 'varchar',
535            'length' => 16,
536            'not null' => TRUE,
537            'default' => '',
538            'yahoo' => 'x'),
539          'updated' => array(
540            'description' => t('Last Update'),
541            'type' => 'int',
542            'unsigned' => TRUE,
543            'not null' => TRUE,
544            'default' => 0),
545          ),
546          'primary key' => array('symbol')
547      );      );
548    
549      return $schema;      return $schema;
# Line 117  function stockapi_install() { Line 567  function stockapi_install() {
567   *   *
568   */   */
569  function stockapi_uninstall() {  function stockapi_uninstall() {
570      drupal_uninstall_schema('stockapi');    // Remove the table
571      drupal_uninstall_schema('stockapi');
572    
573      // Delete variables
574      variable_del('stockapi_quotetype');
575      variable_del('stockapi_fetch');
576      variable_del('stockapi_fetch_last');
577  }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.2