Exemplo n.º 1
0
def getWatchlistTickerSummary():
    try:
        return json_response(stockTableData=YahooFinance.getTickerSummary(
            request.args.get('symbol')))
    except Exception as e:
        print(e)
        raise JsonError(status=400, error='Could not find summary for ticker')
Exemplo n.º 2
0
def getChartDataWithPeriod():
    try:
        symbol = request.args.get('symbol')
        period = request.args.get('period')
        return json_response(
            chartData=YahooFinance.getChartDataWithPeriod(symbol, period))
    except Exception as e:
        print(e)
        raise JsonError(status=500, error='Error while finding chart data')
Exemplo n.º 3
0
def getMostActive():
    try:
        return json_response(mostActive=YahooFinance.getMostActive())
    except Exception as e:
        print(e)
        raise JsonError(status=500, error='Failed to get most active')
Exemplo n.º 4
0
def getTopLosers():
    try:
        return json_response(topLosers=YahooFinance.getTopLosers())
    except Exception as e:
        print(e)
        raise JsonError(status=500, error='Failed to get top losers')
Exemplo n.º 5
0
def getTopCrypto():
    try:
        return json_response(topCrypto=YahooFinance.getTopCrypto())
    except Exception as e:
        print(e)
        raise JsonError(status=500, error='Failed to get top crypto')
Exemplo n.º 6
0
from flask import Flask, request
from flask_json import FlaskJSON, JsonError, json_response
from flask_cors import CORS
#custom imports
from ExternalAPI import EconomicNews, YahooFinance, Finhub, Twelvedata
from Services import StockDetailsService

#yf.pdr_override()
app = Flask(__name__)
FlaskJSON(app)
CORS(app, resources={r"/api/*": {"origins": "*"}})

# CUSTOM singleton
StockNews = EconomicNews.EconomicNews()
YahooFinance = YahooFinance.YahooFinance()
Finhub = Finhub.Finhub()
Twelvedata = Twelvedata.Twelvedata()
stockDetails = StockDetailsService.StockDetailsService()


#-----------------------------------
#Economic data
@app.route('/api/economics/news')
def getEconomicNews():
    try:
        return json_response(economicNews=StockNews.getJsonDataFromFile())
    except Exception as e:
        print(e)
        raise JsonError(status=500, error='Failed to get economic news')

Exemplo n.º 7
0
import alpaca_trade_api as tradeapi
from requests import get
from yahoo_fin import stock_info as si
from ExternalAPI import EconomicNews, YahooFinance, Finhub, Twelvedata
from Services import StockDetailsService, FirestoreService
import requests
import time
from firebase_admin import firestore
from threading import Thread
import queue
from private_data import enviroments

from datetime import datetime

StockNews = EconomicNews.EconomicNews()
YahooFinanceGlobal = YahooFinance.YahooFinance()
Finhub = Finhub.Finhub()
Twelvedata = Twelvedata.Twelvedata()

stockDetailsService = StockDetailsService.StockDetailsService()
'''


res = db.collection('users').where('displayName' , '==','admin').get()
print(res)


'''

start_time = time.time()
 def __init__(self):
     self.yahooFinance = YahooFinance.YahooFinance()
     self.yahooFinanceDataModification = YahooFinance.YahooFinanceDataModification(
     )
     self.finhub = Finhub.Finhub()
     self.db = FirestoreService.FirestoreService().initFirestore()