Exemple #1
0
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    watchlists = stocktwits.watchlists(path='watchlists')
    print('\n\n'.join([watchlist.name for watchlist in watchlists]))
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    user = stocktwits.friendships(path='destroy', id='1511554')
    print(user.name)
Exemple #3
0
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    cursor, messages = stocktwits.deletions(path='messages')
    print('\n\n'.join([message.body for message in messages]))
Exemple #4
0
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    user = stocktwits.account(path='verify')
    print("Verified {}".format(user.name))
Exemple #5
0
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    cursor, users = stocktwits.deletions(path='users')
    print('\n\n'.join([user.name for user in users]))
Exemple #6
0
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    cursor, symbols = stocktwits.graph(path='symbols')
    print('\n\n'.join([symbol.title for symbol in symbols]))
Exemple #7
0
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    user = stocktwits.account(path='update', name='MarketBeaterKing')
    print("Verified {}".format(user.name))
Exemple #8
0
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    symbols = stocktwits.trending(path='symbols/equities')
    print('\n\n'.join([symbol.title for symbol in symbols]))
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    stocktwits.messages(path='like', id=125715135)
    stocktwits.messages(path='unlike', id=125715135)
Exemple #10
0
def main():

    access_token = 'TOKEN'  # This would also work without passing token.
    stocktwits = pytwits.StockTwits(access_token=access_token)

    message = stocktwits.messages(path='show', id=125712744)
    print('Message text: {}\n\n'.format(message.body))
def check_ticker_posts(ticker):
    stocktwits = pytwits.StockTwits(
    )  # access_token=access_token <-- parameter if authorized account made
    symbol, cursor, messages = stocktwits.streams(path='symbol',
                                                  id=ticker,
                                                  limit=30)
    predictions = analyze_posts(messages, None)
Exemple #12
0
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    cursor, users = stocktwits.graph(path='blocking')
    print('\n\n'.join([user.name for user in users]))
Exemple #13
0
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    watchlist = stocktwits.watchlists(path='show', id='1391129')
    print('\n\n'.join([symbol['symbol'] for symbol in watchlist.symbols]))
Exemple #14
0
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    watchlist = stocktwits.watchlists(path='create',
                                      name='Super Secret Watchlist')
    print(watchlist.name)
Exemple #15
0
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    watchlist = stocktwits.watchlists(path='destroy',
                                      id='1400357')
    print(watchlist.name)
def getTrending():
    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(
    )  # access_token=access_token <-- parameter if authorized account made
    symbols = stocktwits.trending(path='symbols')
    symbol_list = []
    for symbol in symbols:
        symbol_list.append(symbol.symbol)
    return symbol_list
Exemple #17
0
def main():

    access_token = 'TOKEN'  # This would also work without passing token.
    stocktwits = pytwits.StockTwits(access_token=access_token)

    symbols = stocktwits.search(path='search/symbols', q='AAPL')

    aapl = symbols[0]
    print("Symbol: {} - Title: {}".format(aapl.symbol, aapl.title))
Exemple #18
0
def main():

    access_token = 'TOKEN'  # This would also work without passing token.
    stocktwits = pytwits.StockTwits(access_token=access_token)

    cursor, messages = stocktwits.streams(path='charts', limit=1)
    response = requests.get(messages[0].entities['chart']['original'])
    img = Image.open(BytesIO(response.content))
    img.show()
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    user = stocktwits.blocks(path='create', id='391833')
    print("Blocked {}".format(user.name))

    user = stocktwits.blocks(path='destroy', id='391833')
    print("Unblocked {}".format(user.name))
Exemple #20
0
def main():

    access_token = 'TOKEN'  # This would also work without passing token.
    stocktwits = pytwits.StockTwits(access_token=access_token)

    user, cursor, messages = stocktwits.streams(path='user',
                                                id='investinghaven')

    print('Messages for user: {}\n\n'.format(user.name))
    print('\n\n'.join([message.body for message in messages]))
Exemple #21
0
def main():

    access_token = 'TOKEN'  # This would also work without passing token.
    stocktwits = pytwits.StockTwits(access_token=access_token)

    users = stocktwits.search(path='search/users',
                              q='deviltraders')

    user = users[0]
    print("Username: {} - Name: {}".format(user.username, user.name))
Exemple #22
0
def main():

    access_token = 'TOKEN'  # This would also work without passing token.
    stocktwits = pytwits.StockTwits(access_token=access_token)

    symbol, cursor, messages = stocktwits.streams(path='symbol',
                                                  id='AAPL',
                                                  limit=5)

    print('Messages for symbol: {} - {}\n\n'.format(symbol.symbol,
                                                    symbol.title))
    print('\n\n'.join([message.body for message in messages]))
Exemple #23
0
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    message = "Another test message with: $AAPL $MSFT"
    sentiment = "bullish"

    message = stocktwits.messages(path='create',
                                  body=message,
                                  sentiment=sentiment)

    print('Message text: {}\n\n'.format(message.body))
Exemple #24
0
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    symbols = stocktwits.watchlists(path='symbols/create',
                                    id='1391129',
                                    symbols='ORCL')

    print('\n\n'.join([symbol.symbol for symbol in symbols]))

    symbols = stocktwits.watchlists(path='symbols/create',
                                    id='1391129',
                                    symbols='FB, UBER')

    print('\n\n'.join([symbol.symbol for symbol in symbols]))
Exemple #25
0
def main():

    access_token = 'TOKEN'
    stocktwits = pytwits.StockTwits(access_token=access_token)

    user, cursor, messages = stocktwits.streams(path='user', id='deviltraders')

    symbol, cursor, messages = stocktwits.streams(path='symbol', id='MSFT')

    cursor, messages = stocktwits.streams(path='friends')

    cursor, messages = stocktwits.streams(path='mentions')

    cursor, messages = stocktwits.streams(path='direct')

    cursor, messages = stocktwits.streams(path='direct_sent')

    cursor, messages = stocktwits.streams(path='direct_received')

    watchlist, cursor, messages = stocktwits.streams(path='watchlist',
                                                     id='WATCHLISTID')

    cursor, messages = stocktwits.streams(path='all')

    cursor, messages = stocktwits.streams(path='charts')

    cursor, messages = stocktwits.streams(path='equities')

    cursor, messages = stocktwits.streams(path='forex')

    cursor, messages = stocktwits.streams(path='futures')

    cursor, messages = stocktwits.streams(path='private_companies')

    cursor, messages = stocktwits.streams(path='suggested')

    cursor, symbols, messages = stocktwits.streams(path='symbols',
                                                   symbols=['AAPL', 'MSFT'])

    cursor, messages = stocktwits.streams(path='trending')

    cursor, messages = stocktwits.streams(path='sectors',
                                          sector_path='healthcare')

    cursor, parent, messages = stocktwits.streams(path='conversation')

    print("hello")
Exemple #26
0
    def __init__(self, ticker, name=None, price=None):

        self.ticker = ticker.upper()

        # Retrieve company name using Stocktwits api
        try:

            stocktwits = pytwits.StockTwits(access_token=None)
            info = stocktwits.search(path='search/symbols', q=self.ticker)
            self.name = info[0].title

            # Retrieve some data (price, etc.) using finviz
            # Price
            stock_data = Screener(tickers=[self.ticker])
            self.price = stock_data[0]['Price']

            # Other data

        # Ticker doesn't exist
        except:

            print('Please enter a valid ticker symbol')
            exit()
Exemple #27
0
import pytwits
import pandas as pd
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer as SentimentAnalyzer

## Scraping tweets from StockTwits with API authentication
tweets = []
tickers = []
access_token = '123456789'
stocktwits = pytwits.StockTwits(
    access_token=access_token)  # This would also work without passing token.


def t_sentiment(comp):
    if comp > 0:
        return "Positive"
    elif comp < 0:
        return "Negative"
    else:
        return "Neutral"


def t_polarity(tweet):
    analyze = SentimentAnalyzer()
    return analyze.polarity_scores(tweet)['compound']


def GetTweetSentiment(stocks):
    for stock in stocks:
        symbol, cursor, messages = stocktwits.streams(
            path='symbol',
            id=stock)  # set limit on messages by limit = __, max = 30)
def check_user_posts(username):
    stocktwits = pytwits.StockTwits(
    )  # access_token=access_token <-- parameter if authorized account made
    user, cursor, messages = stocktwits.streams(path='user', id=username)
    predictions = analyze_posts(messages, username)