Exemple #1
0
def schedulejobs(job_queue):
    logger.info("Scheduling jobs..")
    db.deleteevents()
    job_queue.run_repeating(callback=ipos, interval=12 * 60 * 60, first=datetime.datetime.now())
    job_queue.run_repeating(callback=events, interval=12 * 60 * 60, first=datetime.datetime.now())

    return None
Exemple #2
0
def startstreaming(notifyalert):
    global fnnotifyalert
    fnnotifyalert = notifyalert

    kws.on_tick = on_tick
    kws.on_connect = on_connect
    db.updatealerts()

    kws.enable_reconnect(reconnect_interval=5, reconnect_tries=50)
    logger.info('Started streaming..')
    kws.connect()
Exemple #3
0
    def on_status(self, status):
        """Called when a new status arrives"""
        # print(status)
        try:
            if not hasattr(
                    status,
                    'retweeted_status') and not status.in_reply_to_status_id:
                tweet = gettweet(status)
                # print(tweet['user'])
                send_tweet(tweet)
            else:
                logger.info('Not sending.. ')
        except:
            logger.error("Error handling status", sys.exc_info()[0])

        return
Exemple #4
0
def startstreaming(notifyalert=None):
    if config['telegram']['channel']:
        global fnnotifyalert
        fnnotifyalert = notifyalert
        logger.info('Listening to twitter..')
        l = TweetListener()
        auth = OAuthHandler(consumer_key, consumer_secret)
        auth.set_access_token(access_token, access_token_secret)
        # api = API(auth)
        #

        # users=api.lookup_users(screen_names=['in_tradingview','Brainandmoney'])
        # for user in users:
        #     print(user.id,user.name )

        stream = Stream(auth, l)

        # This line filter tweets from the words.
        stream.filter(follow=['114968505'], languages=['en'], async=True)
Exemple #5
0
def deleteportfolio(symbol, chatid):
    logger.info('Deleting portfolio... ' + symbol)
    rowcount = Calls.delete().where((Calls.sym == symbol) & (
        Calls.chatid == chatid) & (Calls.type == PORTFOLIO_TYPE)).execute()
    return rowcount
Exemple #6
0
def deletewatchlist(symbol, chatid):
    logger.info('Deleting watchlist... ' + symbol)
    rowcount = Calls.delete().where((Calls.sym == symbol)
                                    & (Calls.chatid == chatid)
                                    & (Calls.type == WATCH_TYPE)).execute()
    return rowcount
Exemple #7
0
def deletecall(symbol, userid, chatid):
    logger.info('Deleting call... ' + symbol)
    rowcount = Calls.delete().where((Calls.sym == symbol)
                                    & (Calls.chatid == chatid)).execute()
    return rowcount
Exemple #8
0
def deletealert(symbol, chatid, operation):
    logger.info('Deleting Alert... ' + symbol + " " + chatid + " " + operation)
    Alert.delete().where((Alert.sym == symbol) & (Alert.op == operation)
                         & (Alert.chatid == chatid)).execute()
    updatealerts()