Ejemplo n.º 1
0
 def run(self):
     proc_name = self.name
     logging.debug(f"Starting {proc_name}")
     while True:
         post = self.task_queue.get()
         if post is None:
             logging.debug('%s: Exiting' % proc_name)
             self.task_queue.task_done()
             break
         extracted_tickers = parser.extract_tickers(post)
         for ticker in extracted_tickers:
             self.ticker_result_queue.put(ticker)
             ticker_post = [ticker, post]
             self.posts_result_queue.put(ticker_post)
         if (run_company_match):
             company_name_matches = parser.match_company_name_to_ticker(
                 post)
             for ticker in company_name_matches:
                 self.ticker_result_queue.put(ticker)
                 ticker_post = [ticker, post]
                 self.posts_result_queue.put(ticker_post)
         self.task_queue.task_done()
     return
Ejemplo n.º 2
0
def test_extract_tickers_with_question():
    a = "Thoughts on $CLOV?"
    b = parser.extract_tickers(a)
    assert (b == ['CLOV'])
Ejemplo n.º 3
0
def test_extract_tickers_with_multiple_matches_and_parentheses():
    a = "Defense Stocks (LMT, RTX, NOC, GD, BA) should I invest in them OR GME?"
    b = parser.extract_tickers(a)
    assert (b == ['LMT', 'RTX', 'NOC', 'GD', 'BA', 'GME'])
Ejemplo n.º 4
0
def test_extract_tickers_with_parentheses():
    a = "Clover Health ($CLOV) will moon soon"
    b = parser.extract_tickers(a)
    assert (b == ['CLOV'])
Ejemplo n.º 5
0
def test_extract_tickers_no_matchs():
    a = "ETF Data center REIT surefire or am I wrong?"
    b = parser.extract_tickers(a)
    assert (b == [])
Ejemplo n.º 6
0
def test_extract_tickers_with_excludsions():
    a = "Complete PLTR DD ahead of Demo Day (Valuation Included)"
    b = parser.extract_tickers(a)
    assert (b == ['PLTR'])
Ejemplo n.º 7
0
def test_mutliple_extract_tickers():
    a = "buy GME and PLTR"
    b = parser.extract_tickers(a)
    assert (b == ['GME', 'PLTR'])
Ejemplo n.º 8
0
def test_single_extract_tickers():
    a = "buy GME"
    b = parser.extract_tickers(a)
    assert (b == ['GME'])