Esempio n. 1
0
 def get_share_list():
     getLSEList(collection=Stock)
Esempio n. 2
0
warnings.filterwarnings("ignore", category=exceptions.RuntimeWarning, module='django.db.backends.sqlite3.base', lineno=53)

if __name__ == '__main__':
    path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../MADjangoProject'))
    if not path in sys.path:
        sys.path.insert(1, path)
    del path

    os.environ['DJANGO_SETTINGS_MODULE'] = 'MADjangoProject.settings'
    django.setup()

    from market.models import Stock, StockHistory, SectorHistory
    sec_dict = get_sector_dict()

    print 'Fethcing Indices...'
    ALL_Stocks = getLSEList(collection=Stock)

    def get_share_info():
        for share in ALL_Stocks:
            print 'Fetching info of ' + share['name']
            info = getLSEInfo(share['query'], share['symbol'],collection=Stock, sector_dict=sec_dict)


    import threading
    print 'Distributing Jobs ...'
    threads = []
    # callables = [get_nt]
    callables = [get_share_info]
    for f in callables:
        t = threading.Thread(target=f)
        t.setDaemon(True)
Esempio n. 3
0
 def get_share_list():
     getLSEList(collection=Stock)