Esempio n. 1
0
def main():
    # Get currency pairs sorted by 24-hour volume
    polo = poloniex.Poloniex(timeout=10, coach=True)
    sorted_tickers = sorted(polo.returnTicker().items(),
                            key=lambda x: float(x[1]['baseVolume']),
                            reverse=True)
    currency_pairs = [(k, float(v['baseVolume'])) for k, v in sorted_tickers
                      if 'BTC_' in k or k == 'USDT_BTC']

    volume_texts = []
    for currency_pair, volume_24h in currency_pairs[0:DISPLAY_NUMS]:
        print("currency_pair={}".format(currency_pair))
        volume_texts.append(
            get_volumes(currency_pair, volume_24h, MINUTES, TICKS))

    body = textwrap.dedent(u"""
    Date  : {date}
    Ticks : {minutes} mins x {ticks}

    {volume_texts}
    """).format(
        date=datetime.now().strftime('%Y/%m/%d %H:%M'),
        minutes=MINUTES,
        ticks=TICKS,
        volume_texts='\n\n'.join(volume_texts),
    ).strip()

    print('----------')
    print(body)
    print('----------')

    email_client = EmailClient()
    # Send an email to myself
    email_client.send_test_email(u"Poloniex trade volumes", body)
Esempio n. 2
0
class MyListener(tweepy.StreamListener):
    def __init__(self):
        super(MyListener, self).__init__()
        self.email_client = EmailClient()

    def on_status(self, status):
        if str(status.user.id) in FOLLOW_IDS.keys():
            print('------------------------------')
            print('status={}'.format(status))
            logger.debug('CC official tweeted. user.id={}'.format(
                status.user.id))
            symbol = FOLLOW_IDS[str(status.user.id)]
            is_retweet = hasattr(status, 'retweeted_status')
            is_reply = (status.in_reply_to_user_id is not None)

            subject = u'[CC] Official Tweet Notification ({})'.format(symbol)
            body = textwrap.dedent(u"""
            Date     : {date}
            Name     : {name} (@{screen_name})
            Symbol   : {symbol}
            Followers count : {followers_count}
            Tweet count : {tweet_count}
            Retweet? : {is_retweet}
            Reply?   : {is_reply}
            ==========
            {text}
            ==========
            URL      : https://bittrex.com/Market/Index?MarketName=BTC-{symbol}
            """).format(
                date=datetime.now().strftime('%Y/%m/%d %H:%M:%S'),
                name=status.user.name,
                screen_name=status.user.screen_name,
                symbol=symbol,
                followers_count='{:,}'.format(status.user.followers_count),
                tweet_count='{:,}'.format(status.user.statuses_count),
                is_retweet=is_retweet,
                is_reply=is_reply,
                text=status.text,
            ).strip()
            self.email_client.send_test_email(subject, body)

    def on_error(self, status_code):
        print('Got an error with status code: {}'.format(status_code))
        logger.error('Got an error with status code: {}'.format(status_code))
        if status_code == 420:
            return False

    # See: https://stackoverflow.com/questions/14177327/tweepy-stops-after-a-few-hours
    def on_disconnect(self, notice):
        print('Got a disconnect signal with notice: {}'.format(notice))
        logger.error('Got a disconnect signal with notice: {}'.format(notice))
        return False
Esempio n. 3
0
def main():
    # Get currency pairs sorted by 24-hour volume
    polo = poloniex.Poloniex(timeout=10, coach=True)
    sorted_tickers = sorted(polo.returnTicker().items(),
                            key=lambda x: float(x[1]['baseVolume']),
                            reverse=True)
    currency_pairs = [k for k, v in sorted_tickers if 'BTC_' in k]

    chart_texts = []
    for currency_pair in currency_pairs[0:DISPLAY_NUMS]:
        print("currency_pair={}".format(currency_pair))
        data = get_chart_data(currency_pair, MINUTES_PER_TICK, TICKS)
        chart_texts.append(
            textwrap.dedent(u"""
        {currency_pair}
        Latest price      : {latest_price} ({price_rate} from highest)
        Latest timestamp  : {latest_timestamp}
        Highest price     : {highest_price}
        Highest timestamp : {highest_timestamp} ({timestamp_diff} before)
        Price up-downs    : {price_up_downs} (past 3 ticks)
        Price deviations  : {deviations_by_sigma} (σ)
        1 sigma price     : {sigma_percent}
        Latest volumes    : {latest_volumes} (past 3 ticks, {latest_volumes_rate} of total)
        Volume up-downs   : {volume_up_downs} (past 3 ticks)
        """).strip().format(**data))

    body = textwrap.dedent(u"""
    Date  : {date}
    Ticks : {minutes} mins x {ticks} ({hours} hours)

    {chart_texts}
    """).format(
        date=datetime.now().strftime('%Y/%m/%d %H:%M:%S'),
        minutes=MINUTES_PER_TICK,
        ticks=TICKS,
        hours=TARGET_HOURS,
        chart_texts='\n\n'.join(chart_texts),
    ).strip()

    # print('----------')
    # print(body)
    # print('----------')

    email_client = EmailClient()
    # Send an email to myself
    email_client.send_test_email(u"Poloniex high break (and sigma)", body)
Esempio n. 4
0
def main():
    now = datetime.now()

    # Get all markets
    res = requests.get('https://api.coinmarketcap.com/v1/ticker/')
    markets = res.json()
    print('Number of markets={}'.format(len(markets)))
    # Pop base currency and USDT (Tether)
    symbols = ['{}/{}'.format(x['symbol'], BASE_CURRENCY) for x in markets if x['symbol'] not in (BASE_CURRENCY, 'USDT')]
    print(symbols)
    # TODO: ZRX
    symbols.append('ZRX/{}'.format(BASE_CURRENCY))

    symbol_texts = []
    for symbol in symbols[:DISPLAY_NUMBER_OF_ALTCOINS]:
        ex_count = 0
        max_bid = 0
        max_bid_ex_name = ''
        max_bid_ex_url = ''
        max_bid_volume = 0
        min_ask = float('inf')
        min_ask_ex_name = ''
        min_ask_ex_url = ''
        min_ask_volume = 0
        for ex, ex_url in EXCHANGES:
            try:
                ex_ticker = ex.fetch_ticker(symbol)
            # TODO: Also catch urllib.error.HTTPError?
            except ccxt.errors.RequestTimeout:
                continue
            except TypeError:
                # Looks not to deal in this exchange
                continue
            except Exception as e:
                logger.warning(e)
                continue
            ex_count += 1
            ex_ask = ex_ticker.get('ask') or 0
            ex_bid = ex_ticker.get('bid') or 0
            ex_volume = ex_ticker.get('quoteVolume') or 0  # Volume
            # print('-' * 30)
            # print('{}'.format(ex.name))
            # print('Ask: {:.8f}'.format(ex_ask))
            # print('Bid: {:.8f}'.format(ex_bid))
            # print('Volume: {:.1f}'.format(ex_volume))
            if MIN_VOLUME < ex_volume:
                # Price to sell
                if max_bid < ex_bid:
                    max_bid = ex_bid
                    max_bid_ex_name = ex.name
                    max_bid_ex_url = ex_url
                    max_bid_volume = ex_volume
                # Price to buy
                if ex_ask < min_ask:
                    min_ask = ex_ask
                    min_ask_ex_name = ex.name
                    min_ask_ex_url = ex_url
                    min_ask_volume = ex_volume

        profit = max_bid - min_ask
        profit_rate = (profit / min_ask) if min_ask != 0 else 0  # TODO: else float('inf') ?
        if profit_rate >= PROFIT_RATE_THRESHOLD:
            symbol_text = textwrap.dedent(u"""
            {symbol} ({ex_count})
            --------------------
            Sell at : {max_bid_ex_name:10} {max_bid_ex_url}
            Buy  at : {min_ask_ex_name:10} {min_ask_ex_url}
            Bid     : {max_bid:.8f} ({max_bid_volume:.1f} {base_currency}/day)
            Ask     : {min_ask:.8f} ({min_ask_volume:.1f} {base_currency}/day)
            Profit  : {profit:.8f} ({profit_rate:+.1%})
            """).format(
                symbol=symbol,
                base_currency=BASE_CURRENCY.lower(),
                ex_count=ex_count,
                max_bid_ex_name=max_bid_ex_name,
                max_bid_ex_url=max_bid_ex_url.format(*symbol.split('/')),
                max_bid=max_bid,
                max_bid_volume=max_bid_volume,
                min_ask_ex_name=min_ask_ex_name,
                min_ask_ex_url=min_ask_ex_url.format(*symbol.split('/')),
                min_ask=min_ask,
                min_ask_volume=min_ask_volume,
                profit=profit,
                profit_rate=profit_rate,
            ).strip()
            # print('=' * 40)
            # print(symbol_text)
            symbol_texts.append((symbol_text, profit_rate))

    # Sort by profit rate
    symbol_texts = [x[0] for x in sorted(symbol_texts, key=lambda x: x[1], reverse=True)]

    body = textwrap.dedent(u"""
    Date  : {date}
    Top {number_of_altcoins} Currencies from {number_of_exchanges} Exchanges
    Volume Threshold : {min_volume} {base_currency}/day

    {symbol_text}
    """).format(
        date=now.strftime('%Y/%m/%d %H:%M:%S'),
        number_of_altcoins=DISPLAY_NUMBER_OF_ALTCOINS,
        number_of_exchanges=len(EXCHANGES),
        min_volume=MIN_VOLUME,
        base_currency=BASE_CURRENCY.lower(),
        symbol_text='\n\n'.join(symbol_texts),
    ).strip()
    print(body)

    email_client = EmailClient()
    # Send an email to myself
    email_client.send_test_email(u'[CC] Check Price Difference (by {})'.format(BASE_CURRENCY), body)
Esempio n. 5
0
def main():
    now = datetime.now()

    # Get markets
    exchange = ccxt.bittrex()
    markets = exchange.fetch_tickers()
    print('Number of markets={}'.format(len(markets)))
    # Altcoins
    altcoins = [
        dict(v, symbol=k.split('/')[0]) for k, v in markets.items()
        if '/BTC' in k
    ]
    # Sort by baseVolume (Note: baseVolume might be None, so 'or 0')
    altcoins.sort(key=lambda x: float(x['quoteVolume'] or 0), reverse=True)
    print('Number of altcoins={}'.format(len(altcoins)))
    print([x['symbol'] for x in altcoins])

    # Get altcoin data from MongoDB
    collection = MongoClient().bittrex['tickers']
    chart_texts = []
    for i, symbol in enumerate(
        [x['symbol'] for x in altcoins[:DISPLAY_NUMBER_OF_ALTCOINS]]):
        print('==========')
        print(symbol)
        tickers = list(
            collection.find(
                {
                    'symbol': symbol,
                    'timestamp': {
                        '$gte': now - timedelta(minutes=TARGET_MINUTES)
                    }
                },
                {
                    '_id': False
                },
            ).sort('timestamp', ASCENDING))
        # pprint(tickers)

        chart_dict = tickers_to_chart_dict(tickers)

        chart_text = textwrap.dedent(u"""
            {i}. {symbol}
            -----------------
            Latest price     : {latest_price:.8f} ({price_diff_rate:+.1%} from highest)
            Highest price    : {highest_price:.8f} ({highest_timestamp_diff} before)
            Price up-downs   : {price_up_downs}
            Price deviations : {price_diff_by_sigma} (σ)
            1 sigma price    : {sigma_percent:.1%}
        """).format(
            i=i + 1,
            symbol=symbol,
            latest_price=chart_dict['latest_price'],
            highest_price=chart_dict['highest_price'],
            highest_timestamp=chart_dict['highest_timestamp'].strftime(
                '%m/%d %H:%M'),
            price_up_downs=', '.join(
                ['{:+.1%}'.format(v) for v in chart_dict['price_up_downs']]),
            highest_timestamp_diff=chart_dict['highest_timestamp_diff'],
            price_diff_rate=(chart_dict['latest_price'] -
                             chart_dict['highest_price']) /
            chart_dict['highest_price'],
            price_diff_by_sigma=', '.join([
                '{:.2f}'.format(v) for v in chart_dict['price_diff_by_sigma']
            ]),
            sigma_percent=chart_dict['sigma_percent'],
        ).strip()
        print('----------')
        print(chart_text)
        chart_texts.append(chart_text)

    body = textwrap.dedent(u"""
    Date  : {date}
    Ticks : {minutes} mins x {ticks:,.0f} ({hours:,.0f} hours)

    {chart_texts}
    """).format(
        date=now.strftime('%Y/%m/%d %H:%M:%S'),
        minutes=MINUTES_PER_TICK,
        ticks=TARGET_MINUTES / MINUTES_PER_TICK,
        hours=TARGET_MINUTES / 60,
        chart_texts='\n\n'.join(chart_texts),
    ).strip()
    print('==========')
    print(body)

    email_client = EmailClient()
    # Send an email to myself
    email_client.send_test_email(u'[CC] Bittrex Tickers', body)
Esempio n. 6
0
def main():
    now = datetime.now()

    # Symbols
    db_symbols = MongoClient().cctweet['symbols']
    symbols = list(
        db_symbols.find({'time': {
            '$exists': False
        }}, {'_id': False},
                        sort=[('count', DESCENDING)]))
    for symbol in symbols:
        # TODO: Need fix? INTERVAL_MINUTES * 1.5
        prev = db_symbols.find_one(
            {
                'key': symbol['key'],
                'time': {
                    '$gte': now - timedelta(minutes=INTERVAL_MINUTES * 1.5)
                }
            },
            sort=[('time', DESCENDING)])
        if prev is not None:
            symbol.update({
                'diff':
                float(symbol['count'] - prev['count']) / float(prev['count'])
            })
        else:
            symbol.update({'diff': float('inf')})
    # Hashtags
    db_hashtags = MongoClient().cctweet['hashtags']
    hashtags = list(
        db_hashtags.find({'time': {
            '$exists': False
        }}, {'_id': False},
                         sort=[('count', DESCENDING)]))
    for hashtag in hashtags:
        # TODO: Need fix? INTERVAL_MINUTES * 1.5
        prev = db_hashtags.find_one(
            {
                'key': hashtag['key'],
                'time': {
                    '$gte': now - timedelta(minutes=INTERVAL_MINUTES * 1.5)
                }
            },
            sort=[('time', DESCENDING)])
        if prev is not None:
            hashtag.update({
                'diff':
                float(hashtag['count'] - prev['count']) / float(prev['count'])
            })
        else:
            hashtag.update({'diff': float('inf')})

    # Update time
    db_symbols.update({'time': {
        '$exists': False
    }}, {'$set': {
        'time': now
    }},
                      multi=True)
    db_hashtags.update({'time': {
        '$exists': False
    }}, {'$set': {
        'time': now
    }},
                       multi=True)

    # Cleanup
    db_symbols.remove({'time': {'$lt': now - timedelta(hours=24)}})
    db_hashtags.remove({'time': {'$lt': now - timedelta(hours=24)}})

    body = textwrap.dedent(u"""
    Date     : {date}

    $ Top Symbols
    =============
    {top_symbols}

    # Top Hashtags
    ==============
    {top_hashtags}
    """).format(
        date=now.strftime('%Y/%m/%d %H:%M'),
        top_symbols='\n'.join([
            u'{}: {} ({})'.format(d['key'], d['count'],
                                  '{:+.0%}'.format(d['diff']))
            for d in symbols[0:SYMBOL_DISPLAY_SIZE]
        ]),
        top_hashtags='\n'.join([
            u'{}: {} ({})'.format(d['key'], d['count'],
                                  '{:+.0%}'.format(d['diff']))
            for d in hashtags[0:HASHTAG_DISPLAY_SIZE]
        ]),
    ).strip()

    email_client = EmailClient()
    email_client.send_test_email(u'CC Tweet Summary', body)
Esempio n. 7
0
def main():
    # Get all markets
    res = requests.get('https://api.coinmarketcap.com/v1/ticker/')
    markets = res.json()
    print('Number of markets={}'.format(len(markets)))

    # Sort by 24h_volume_usd (Note: some 24h_volume_usd are None, so 'or 0')
    markets.sort(key=lambda x: float(x['24h_volume_usd'] or 0), reverse=True)
    # Pop BTC and USDT (Tether)
    markets = [x for x in markets if x['symbol'] not in ('BTC', 'USDT')]
    # pprint(markets)

    # Get Bitcoin market
    res = requests.get(
        'https://api.coinmarketcap.com/v1/ticker/{}/'.format('bitcoin'))
    bitcoin = res.json()[0]

    df = pd.DataFrame(markets)
    df['price_usd'] = df['price_usd'].astype(float)
    df['price_btc'] = df['price_btc'].astype(float)
    df['24h_volume_usd'] = df['24h_volume_usd'].astype(float)
    df['market_cap_usd'] = df['market_cap_usd'].astype(float)
    df['available_supply'] = df['available_supply'].astype(float)
    df['total_supply'] = df['total_supply'].astype(float)
    df['percent_change_1h'] = df['percent_change_1h'].astype(float)
    df['percent_change_24h'] = df['percent_change_24h'].astype(float)
    df['percent_change_7d'] = df['percent_change_7d'].astype(float)
    df['last_updated'] = df['last_updated'].apply(
        lambda x: datetime.fromtimestamp(float(x)))
    print(df[0:10])

    df_top10 = df[0:10]
    df_top20 = df[0:20]
    df_top30 = df[0:30]
    df_top50 = df[0:50]
    df_top51_100 = df[50:100]
    df_top100 = df[0:100]
    body = textwrap.dedent(u"""
    Bitcoin
    =======
    (1h)  price change : {bitcoin_1h_change:+.1f}%
    (24h) price change : {bitcoin_24h_change:+.1f}%
    (7d)  price change : {bitcoin_7d_change:+.1f}%
    
    Top 10 markets
    ==============
    (1h)  price up/down : {top10_1h_up} / {top10_1h_down}
    (1h)  price mean    : {top10_1h_mean:+.1f}%
    (24h) price up/down : {top10_24h_up} / {top10_24h_down}
    (24h) price mean    : {top10_24h_mean:+.1f}%
    (7d)  price up/down : {top10_7d_up} / {top10_7d_down}
    (7d)  price mean    : {top10_7d_mean:+.1f}%

    Top 20 markets
    ==============
    (1h)  price up/down : {top20_1h_up} / {top20_1h_down}
    (1h)  price mean    : {top20_1h_mean:+.1f}%
    (24h) price up/down : {top20_24h_up} / {top20_24h_down}
    (24h) price mean    : {top20_24h_mean:+.1f}%
    (7d)  price up/down : {top20_7d_up} / {top20_7d_down}
    (7d)  price mean    : {top20_7d_mean:+.1f}%

    Top 30 markets
    ==============
    (1h)  price up/down : {top30_1h_up} / {top30_1h_down}
    (1h)  price mean    : {top30_1h_mean:+.1f}%
    (24h) price up/down : {top30_24h_up} / {top30_24h_down}
    (24h) price mean    : {top30_24h_mean:+.1f}%
    (7d)  price up/down : {top30_7d_up} / {top30_7d_down}
    (7d)  price mean    : {top30_7d_mean:+.1f}%

    Top 50 markets
    ==============
    (1h)  price up/down : {top50_1h_up} / {top50_1h_down}
    (1h)  price mean    : {top50_1h_mean:+.1f}%
    (24h) price up/down : {top50_24h_up} / {top50_24h_down}
    (24h) price mean    : {top50_24h_mean:+.1f}%
    (7d)  price up/down : {top50_7d_up} / {top50_7d_down}
    (7d)  price mean    : {top50_7d_mean:+.1f}%

    Top 51-100 markets
    ==============
    (1h)  price up/down : {top51_100_1h_up} / {top51_100_1h_down}
    (1h)  price mean    : {top51_100_1h_mean:+.1f}%
    (24h) price up/down : {top51_100_24h_up} / {top51_100_24h_down}
    (24h) price mean    : {top51_100_24h_mean:+.1f}%
    (7d)  price up/down : {top51_100_7d_up} / {top51_100_7d_down}
    (7d)  price mean    : {top51_100_7d_mean:+.1f}%

    Top 100 markets
    ===============
    (1h)  price up/down : {top100_1h_up} / {top100_1h_down}
    (1h)  price mean    : {top100_1h_mean:+.1f}%
    (24h) price up/down : {top100_24h_up} / {top100_24h_down}
    (24h) price mean    : {top100_24h_mean:+.1f}%
    (7d)  price up/down : {top100_7d_up} / {top100_7d_down}
    (7d)  price mean    : {top100_7d_mean:+.1f}%
    """).format(
        bitcoin_1h_change=float(bitcoin['percent_change_1h']),
        bitcoin_24h_change=float(bitcoin['percent_change_24h']),
        bitcoin_7d_change=float(bitcoin['percent_change_7d']),
        top10_1h_up=len(df_top10[df_top10['percent_change_1h'] > 0]),
        top10_1h_down=len(df_top10[df_top10['percent_change_1h'] <= 0]),
        top10_1h_mean=df_top10.mean()['percent_change_1h'],
        top10_24h_up=len(df_top10[df_top10['percent_change_24h'] > 0]),
        top10_24h_down=len(df_top10[df_top10['percent_change_24h'] <= 0]),
        top10_24h_mean=df_top10.mean()['percent_change_24h'],
        top10_7d_up=len(df_top10[df_top10['percent_change_7d'] > 0]),
        top10_7d_down=len(df_top10[df_top10['percent_change_7d'] <= 0]),
        top10_7d_mean=df_top10.mean()['percent_change_7d'],
        top20_1h_up=len(df_top20[df_top20['percent_change_1h'] > 0]),
        top20_1h_down=len(df_top20[df_top20['percent_change_1h'] <= 0]),
        top20_1h_mean=df_top20.mean()['percent_change_1h'],
        top20_24h_up=len(df_top20[df_top20['percent_change_24h'] > 0]),
        top20_24h_down=len(df_top20[df_top20['percent_change_24h'] <= 0]),
        top20_24h_mean=df_top20.mean()['percent_change_24h'],
        top20_7d_up=len(df_top20[df_top20['percent_change_7d'] > 0]),
        top20_7d_down=len(df_top20[df_top20['percent_change_7d'] <= 0]),
        top20_7d_mean=df_top20.mean()['percent_change_7d'],
        top30_1h_up=len(df_top30[df_top30['percent_change_1h'] > 0]),
        top30_1h_down=len(df_top30[df_top30['percent_change_1h'] <= 0]),
        top30_1h_mean=df_top30.mean()['percent_change_1h'],
        top30_24h_up=len(df_top30[df_top30['percent_change_24h'] > 0]),
        top30_24h_down=len(df_top30[df_top30['percent_change_24h'] <= 0]),
        top30_24h_mean=df_top30.mean()['percent_change_24h'],
        top30_7d_up=len(df_top30[df_top30['percent_change_7d'] > 0]),
        top30_7d_down=len(df_top30[df_top30['percent_change_7d'] <= 0]),
        top30_7d_mean=df_top30.mean()['percent_change_7d'],
        top50_1h_up=len(df_top50[df_top50['percent_change_1h'] > 0]),
        top50_1h_down=len(df_top50[df_top50['percent_change_1h'] <= 0]),
        top50_1h_mean=df_top50.mean()['percent_change_1h'],
        top50_24h_up=len(df_top50[df_top50['percent_change_24h'] > 0]),
        top50_24h_down=len(df_top50[df_top50['percent_change_24h'] <= 0]),
        top50_24h_mean=df_top50.mean()['percent_change_24h'],
        top50_7d_up=len(df_top50[df_top50['percent_change_7d'] > 0]),
        top50_7d_down=len(df_top50[df_top50['percent_change_7d'] <= 0]),
        top50_7d_mean=df_top50.mean()['percent_change_7d'],
        top51_100_1h_up=len(
            df_top51_100[df_top51_100['percent_change_1h'] > 0]),
        top51_100_1h_down=len(
            df_top51_100[df_top51_100['percent_change_1h'] <= 0]),
        top51_100_1h_mean=df_top51_100.mean()['percent_change_1h'],
        top51_100_24h_up=len(
            df_top51_100[df_top51_100['percent_change_24h'] > 0]),
        top51_100_24h_down=len(
            df_top51_100[df_top51_100['percent_change_24h'] <= 0]),
        top51_100_24h_mean=df_top51_100.mean()['percent_change_24h'],
        top51_100_7d_up=len(
            df_top51_100[df_top51_100['percent_change_7d'] > 0]),
        top51_100_7d_down=len(
            df_top51_100[df_top51_100['percent_change_7d'] <= 0]),
        top51_100_7d_mean=df_top51_100.mean()['percent_change_7d'],
        top100_1h_up=len(df_top100[df_top100['percent_change_1h'] > 0]),
        top100_1h_down=len(df_top100[df_top100['percent_change_1h'] <= 0]),
        top100_1h_mean=df_top100.mean()['percent_change_1h'],
        top100_24h_up=len(df_top100[df_top100['percent_change_24h'] > 0]),
        top100_24h_down=len(df_top100[df_top100['percent_change_24h'] <= 0]),
        top100_24h_mean=df_top100.mean()['percent_change_24h'],
        top100_7d_up=len(df_top100[df_top100['percent_change_7d'] > 0]),
        top100_7d_down=len(df_top100[df_top100['percent_change_7d'] <= 0]),
        top100_7d_mean=df_top100.mean()['percent_change_7d'],
    ).strip()

    email_client = EmailClient()
    # Send an email to myself
    email_client.send_test_email(u'[CC] Entire Market Mood', body)