-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinit_lister.py
78 lines (56 loc) · 2.24 KB
/
init_lister.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import sys
import os.path
import urllib2
import TerminalColors
tcol = TerminalColors.bcolors()
from stockspotter.lister.TickerLister import TickerLister
from stockspotter.db.SourceWSJ import SourceWSJ
from stockspotter.db.SourceWSJ import URLFactoryWSJ
def print_y( msg ):
print tcol.WARNING, msg, tcol.ENDC
def print_g( msg ):
print tcol.OKGREEN, msg, tcol.ENDC
print_y( '-------------------------------------------------')
print_g( ' Initialize Stock Lists from Official sources' )
print_y( '-------------------------------------------------')
lister = TickerLister('equities_db/lists/', 0)
print_y( 'Init HKEX' )
full_list_hkex = lister.list_full_hkex(False)
print 'HKEX: %d stocks' %(len(full_list_hkex))
print_g( 'Done!')
print_y( 'Init India Exchanges - BSE, NSE' )
full_list_bse = lister.list_full_bse(False)
full_list_nse = lister.list_full_nse(False)
print 'BSE: %d stocks' %(len(full_list_bse))
print 'NSE: %d stocks' %(len(full_list_nse))
print_g( 'Done!')
print_y( 'Init USA Exchanges - NYSE, NASDAQ, AMEX')
full_list_nyse = lister.list_full_nyse(False)
full_list_nasdaq = lister.list_full_nasdaq(False)
full_list_amex = lister.list_full_amex(False)
print 'NYSE: %d stocks' %(len(full_list_nyse))
print 'NASDAQ: %d stocks' %(len(full_list_nasdaq))
print 'AMEX: %d stocks' %(len(full_list_amex))
print_g( 'Done!')
print_y( 'Init Japanese Exchange (Tokyo)')
full_list_tyo = lister.list_full_tyo( False )
print 'TYO: %d stocks' %(len(full_list_tyo))
print_g( 'Done!')
print_y( 'Init China Exchanges - Shanghai (SH), Shenzen (SZ)' )
full_list_sse = lister.list_full_sse(False) #issue with excel file
full_list_szse = lister.list_full_szse( False )
print 'SH: %d stocks' %(len(full_list_sse))
print 'SZ: %d stocks' %(len(full_list_szse))
print_g( 'Done!')
# full_list = full_list_bse[0:3] + full_list_nse[0:3] + full_list_hkex[0:3]
# print full_list
# for l in full_list_nse[0:3]:
# print l
# s_wsj = SourceWSJ( ticker=l.ticker, stock_prefix='equities_db/data__i/'+l.ticker, verbosity=1 )
# s_wsj.download_url()
# s_wsj.parse()
# s_wsj = SourceWSJ( ticker='AARVEEDEN.NSE', stock_prefix='equities_db/data__i/AARVEEDEN.NSE', verbosity=1 )
# s_wsj.download_url()
# s_wsj.parse()
# import pprint
# pprint.pprint( s_wsj.load_json_profile() )