Exemplo n.º 1
0
    def test_scrape_general(self, mock_get):
        """ must call internal methods """

        with patch.object(ScrapeTradingView,
                          '_parse_tradingview') as mock_method:
            scrape = ScrapeTradingView()
            mock_method.return_value = TrendIndicator("summary", "site", "url")
            loop = asyncio.get_event_loop()
            trend = loop.run_until_complete(scrape.scrape())

            mock_method.assert_called_once_with('html')
            self.assertEqual(len(mock_get.call_args_list), 1)
            self.assertEqual("summary", trend.summary)
            self.assertEqual("site", trend.from_site)
            self.assertEqual("url", trend.from_url)
import asyncio

from example_reporting_web_services.scraping.chart.scrape_investtech import ScrapeInvesttech
from example_reporting_web_services.scraping.indicator.scrape_investing import ScrapeInvesting
from example_reporting_web_services.scraping.indicator.scrape_tradingview import ScrapeTradingView

if __name__ == '__main__':

    scrape = ScrapeTradingView()
    loop = asyncio.get_event_loop()
    trend = loop.run_until_complete(scrape.scrape())
    print("TradingView")
    print(trend.summary)
    for detail in trend.details:
        print(detail)

    scrape = ScrapeInvesting()
    trend = scrape.scrape()
    print("Investing")
    print(trend.summary)
    for detail in trend.details:
        print(detail)

    scrape_charts = ScrapeInvesttech()
    b_img_graph = scrape_charts.scrape_graph()
    b_img_rsi = scrape_charts.scrape_rsi()