Esempio 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
Esempio n. 2
0
def test_extract_tickers_with_question():
    a = "Thoughts on $CLOV?"
    b = parser.extract_tickers(a)
    assert (b == ['CLOV'])
Esempio 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'])
Esempio n. 4
0
def test_extract_tickers_with_parentheses():
    a = "Clover Health ($CLOV) will moon soon"
    b = parser.extract_tickers(a)
    assert (b == ['CLOV'])
Esempio 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 == [])
Esempio 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'])
Esempio n. 7
0
def test_mutliple_extract_tickers():
    a = "buy GME and PLTR"
    b = parser.extract_tickers(a)
    assert (b == ['GME', 'PLTR'])
Esempio n. 8
0
def test_single_extract_tickers():
    a = "buy GME"
    b = parser.extract_tickers(a)
    assert (b == ['GME'])