Skip to content

Instantly share code, notes, and snippets.

@KFoxder
Created November 21, 2016 18:16
Show Gist options
  • Save KFoxder/da31f1445c74cd04255903c1e829d88a to your computer and use it in GitHub Desktop.
Save KFoxder/da31f1445c74cd04255903c1e829d88a to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
# Boilerplate code to import settings w/o setting DJANGO_SETTINGS_MODULE
import logging
import django
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")))
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ycharts.settings.active')
django.setup()
logger = logging.getLogger('apps')
logger.setLevel(logging.INFO)
logger.info('Starting onetime script {0}'.format(__file__))
from apps.companies.models import Company
from apps.companies.importers.morn_equity_api import MornCompanyInstitutionalHoldingsEquityAPI,\
MornCompanyInsiderHoldingsEquityAPI, MornEmployeeCountAPI
from apps.financials.importers.morn_equity_api import MornFinancialsEquityAPI,\
MornFinancialsSharesOutstandingAPI
from apps.classifications.importers.morn_equity_api import MornSectorIndustryEquityAPI
from apps.countries.importers.morn_equity_api import MornCountrySyncEquityAPI
company = Company.objects.get(exchange_symbol='GS')
importer = MornCompanyInstitutionalHoldingsEquityAPI(company=company)
importer.import_institutional_holdings()
importer.log_final_details()
importer = MornCompanyInsiderHoldingsEquityAPI(company=company)
importer.import_insider_holdings()
importer.log_final_details()
equity_api = MornFinancialsEquityAPI(company)
equity_api.get_entire_bs('Annual', 'Restated')
equity_api.log_final_details()
importer = MornFinancialsSharesOutstandingAPI(company=company)
importer.get_shares_history()
importer.log_final_details()
importer = MornSectorIndustryEquityAPI()
importer.import_industries()
importer.import_sectors()
importer.log_final_details()
importer = MornCountrySyncEquityAPI()
importer.import_all_countries()
importer.log_final_details()
importer = MornEmployeeCountAPI(company=company)
importer.get_employee_history()
importer.log_final_details()
logger.info('Finished Running onetime script {0}'.format(__file__))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment