def application_context_builder():

    #tickerRateService = TickerRateService('google')
    rsquareHighlighter = RSquareHighlighter()
    tickerRateService = TickerRateService('yahoo')
    tickerNameService = TickerInfoService('resources/secwiki_tickers.csv')
    parameterService = ParameterService(10)
    tickerAnalysisService = TickerAnalysisService()
    bullishVsBearishAnalysisService = BullishVsBearishAnalysisService()
    linearRegressionSerice = LinearRegressionSerice(rsquareHighlighter)
    volatilityAnalysisService = VolatilityAnalysisService()
    plottingUtilService = PlottingUtilServce()
    optionSuggestionService = OptionSuggestionService()

    connectionFactory = ConnectionFactory("../db/testflasky/flaskysqlite.db")
    db_utils = Utils()

    stockGameDbService = StockGameDbService(connectionFactory,db_utils)
    visitorDbService = VisitorDbService(connectionFactory,db_utils)
    industryDbService = IndustryDbService(connectionFactory,db_utils)
    industryRelationsDbService = IndustryRelationsDbService(connectionFactory,db_utils)
    industryCrosstableDefaultTemplateService = IndustryCrosstableDefaultTemplateService()
    industryCrosstableService = IndustryCrosstableService(industryDbService,industryRelationsDbService)

    dataftameColumnInserterService = DataftrameColumnInserterService()
    optionImpliedVolatilityService = OptionImpliedVolatilityService(optionSuggestionService,dataftameColumnInserterService)
    optionSuggestionColumnLabelingService = OptionSuggestionColumnLabelingService()

    priceChangeAnalysisService = PriceChangeAnalysisService(volatilityAnalysisService)
    priceChangeSimulationService = PriceChangeSimulationService(volatilityAnalysisService,plottingUtilService)

    rawDataController = RawDataController(parameterService,tickerRateService,tickerAnalysisService, tickerNameService, "raw_data.html")
    summaryAnalysisController = SummaryAnalysisController(parameterService,tickerRateService,tickerAnalysisService,
                                            bullishVsBearishAnalysisService, linearRegressionSerice,
                                            priceChangeAnalysisService, "summary_analysis.html")

    summaryAnalysisRecommendationController = SummaryAnalysisRecommendationController(parameterService, tickerRateService, tickerAnalysisService,
                                            bullishVsBearishAnalysisService, linearRegressionSerice,
                                            priceChangeAnalysisService, "recommendation.html")

    predictionController = PredictionController(parameterService,tickerRateService,tickerAnalysisService,priceChangeSimulationService, "prediction.html")
    downloadController = DownloadController(parameterService,tickerRateService)
    optionsController = OptionsController(parameterService,optionSuggestionService,optionImpliedVolatilityService,
                                          optionSuggestionColumnLabelingService,"options.html")
    profitController = ProfitController("profit.html")

    industryController = IndustryController(industryCrosstableService,visitorDbService,industryCrosstableDefaultTemplateService,"industry.html")

    stockGameService = StockGameService(parameterService,tickerRateService,tickerAnalysisService,priceChangeSimulationService,linearRegressionSerice,rsquareHighlighter)
    stockGameController = StockGameController(stockGameService,stockGameDbService,visitorDbService,"stock_game.html")

    return rawDataController , summaryAnalysisController , summaryAnalysisRecommendationController,\
           predictionController , downloadController,optionsController, profitController , industryController, stockGameController
Пример #2
0
from services.db.connection_factory import ConnectionFactory
from services.db.utils import Utils
factory = ConnectionFactory("../db/flaskysqlite.db")
utils = Utils()
connection = factory.get_connection()

print(connection)

sqls = [
    "select * from stock_game_ticker",
    "update stock_game_ticker set user_id = -6 where user_id = 6"
]

for sql in sqls:
    print("running", sql)
    result = utils.get_as_dictionary_list(connection, sql)
    for entry in result:
        print(entry)
connection.commit()