Exemplo n.º 1
0
def totDJI(ticks):
    tot = 0
    for tick in ticks:
        tot = tot + appAuth.getPercDiff(tick, 7)
    return tot
Exemplo n.º 2
0

    while True:  # Run the bot for all time (or until program exited)

        tweets_done = False

        tcur = datetime.utcnow().replace(tzinfo = pytz.utc)  # get the current time (UTC)
        print("Checking current time...")

        # 2.5 hours pre-trading day in UCT
        if (not tweets_done and (tcur.hour >= 11 and tcur.hour < 13) or (tcur.hour == 13 and tcur.minute < 30)):

            print("Entering Pre-trading operations...")

            totdji = totDJI(ticks)
            dif = [appAuth.getPercDiff(t, 7) for t in ticks]

            # Append *special* Dow Jones composite
            dif.append(totdji)
            ticks.append("DJI")

            # Clear/Create Twitter Generator
            twitGen = twitpost.TweetGenerator(dif, ticks)

            # Generate Tweets
            twitGen.generateTweets()

            # Get the list of tweets
            tweets_list = twitGen.getTweetList()

            # Assign Tweets to friends