示例#1
0
 def send_tweet(self, bankName):
     bot = TweetBot()
     msg_body = (
         bankName.swapcase()
         + "\n Now bal = $"
         + str(self.bank["chase"]["currentBalance"])
         + "\n Est bal=$ "
         + str(self.projected_balance_amt["chase"])
     )
     bot.send_tweet(msg_body)
示例#2
0
文件: Fi.py 项目: rrahuldev/pylab
 def sendMailAlert(self):
     bot = TweetBot()
     for stock in self.active_stocks:
         sell_distance = self.active_stocks[stock]['sell_distance']
         min_days = 8
         days_accrual = (self.date_now - self.active_stocks[stock]['date'][-1]).days
         if days_accrual > min_days:
             if sell_distance > 0.01:
                 self.logger.info('Trying to send message for ' + str(stock))
                 message = '%s trading higher than target growth @ %s at %s' \
                           % (stock, self.figo.GROWTH_RATE * 100, self.active_stocks[stock]['growth_price'])
                 bot.send_tweet(message)
                 print message
示例#3
0
文件: Fi.py 项目: rrahuldev/pylab
        inflat_adj_total = share_cost * ((1 + inflat_rate) ** days_accrual)
        growth_adj_total = inflat_adj_total * ((1 + growth_rate) ** days_accrual)

        fed_tax = self.FED_TAX_BRACKET[1]
        inflat_beat_price = round(((inflat_adj_total - share_cost) / (1 - fed_tax)), 2) + share_cost + self.TRADE_COMM
        growth_beat_price = round(((growth_adj_total - share_cost) / (1 - fed_tax)), 2) + share_cost + self.TRADE_COMM
        share_price = capital + 2 * self.TRADE_COMM / (1 - fed_tax)

        return inflat_beat_price, growth_beat_price, share_price


if __name__ == "__main__":
    fi = FiPy()
    total_invested, inf_adj_total, growth_adj_total = fi.getTotalInvested()
    current_balance = float(fi.acc['currentBalance'])
    margin1 = round((current_balance / total_invested - 1) * 100, 2)
    margin2 = round((current_balance / inf_adj_total - 1) * 100, 2)
    margin3 = round((current_balance / growth_adj_total - 1) * 100, 2)

    text_msg = "Stock trading at " + str(margin1) + "% (base), " + \
                   str(margin2) + "% (inflation) " + \
                   str(margin3) + "% (growth)"

    fi.logger.info(text_msg)
    bot = TweetBot()
    bot.send_tweet(text_msg)

    fi.sendMailAlert()
    fi.writeStockEval()
    print('Kaboom')
示例#4
0
import tweepy as tp
import json
import time

from TweetBot import TweetBot

configs = {}

with open('configs/config.json', 'r') as f:
    configs = json.load(f)

# login to twitter account api
print('Load KEYS...')
auth = tp.OAuthHandler(configs['consumer_key'], configs['consumer_secret'])
auth.set_access_token(configs['access_token'], configs['access_secret'])
api = tp.API(auth)

print('Instanciate Bot...')
Bot = TweetBot(api, configs['mention'])

print('Start Bot...')
Bot.start()