Ejemplo n.º 1
0
    for raw_name in flatten(read_collections_file()):
        collection_root_name, exchange = extract_collection_name(raw_name)
        for ticker in tickers:
            collection_name = f"{collection_root_name}{ticker}"
            collection = db.get_collection(collection_name,
                                           codec_options=codec_options)
            record = get_last_db_record(collection)
            _current_time = datetime.datetime.now().timestamp() * 1000
            _time_gap = 12 * 60 * 60 * 1000
            if ticker == "1d" or ticker == "12h":
                _time_gap = 3 * 12 * 60 * 60 * 1000
            if ticker == "8h":
                _time_gap = 24 * 60 * 60 * 1000
            if ticker == "15m" or ticker == "30m":
                _time_gap = 8 * 60 * 60 * 1000

            if exchange == "binance":
                if _current_time - record['timestamp'] > _time_gap:
                    outdated.append(collection_name)
            elif exchange == "kucoin":
                _time_gap /= 1000
                _current_time /= 1000
                if _current_time - int(record['timestamp']) > _time_gap:
                    outdated.append(collection_name)

    if len(outdated) > 0:
        mail_content = '<BR/>'.join(outdated)
        send_mail(f"OOO CANDLE CRAWL FAILS OOO", mail_content)
    sleep(6 * 60 * 60)
Ejemplo n.º 2
0
def notify_when_break_down(_url, _level):
    _btcd = get_current_cmc_cap(_url)
    if _btcd < _level:
        send_mail(f"ZZZ BTC.D level {_level} BREAK DOWN ZZZ",
                  f"Current BTC.D : {_btcd} < observed : {_level}")
Ejemplo n.º 3
0
    try:
        mail_content = MailContent('')

        _24_hours_old = datetime.datetime.now().timestamp(
        ) - markets_obj.timestamp > 24 * 60 * 60
        if _24_hours_old:
            logger.info(
                f"Markets older than 24 hours {datetime.datetime.now().timestamp()} <- now : {markets_obj.timestamp} <- markets"
            )
            markets_obj = Markets(binance_vol_filter, kucoin_vol_filter)

        exchange = "binance"
        ticker = BinanceClient.KLINE_INTERVAL_1HOUR
        market_entries = analyze_40ma("exclude-markets-binance", exchange,
                                      ticker, "1 week ago", markets_obj)
        process_entries(market_entries, exchange, collection, ticker,
                        mail_content)

        if len(mail_content.content) > 0:
            send_mail(f"EEE Market Entry Found EEE", mail_content.content)

        time.sleep(3600)

    except Exception as err:
        if isinstance(err, requests.exceptions.ConnectionError) or isinstance(
                err, requests.exceptions.ReadTimeout):
            logger.error("Connection problem...")
        else:
            traceback.print_tb(err.__traceback__)
            logger.exception(err.__traceback__)
Ejemplo n.º 4
0
binance_ticker = "1w"
kucoin_ticker = "1week"

binance_vol_filter = 50.0
kucoin_vol_filter = 20.0

mail_content = MailContent('')
markets_obj = Markets(binance_vol_filter, kucoin_vol_filter)

market_setups_binance_raw = analyze_valuable_alts("exclude-markets-binance",
                                                  "binance", binance_ticker,
                                                  "30 weeks ago", markets_obj)
market_setups_kucoin_raw = analyze_valuable_alts(
    "exclude-markets-kucoin", "kucoin", kucoin_ticker,
    get_kucoin_interval_unit(kucoin_ticker, 30), markets_obj)

market_setups_binance = sorted(market_setups_binance_raw,
                               key=lambda x: x[1],
                               reverse=True)
market_setups_kucoin = sorted(market_setups_kucoin_raw,
                              key=lambda x: x[1],
                              reverse=True)

process_valuable_alts(market_setups_binance, "binance", binance_ticker,
                      mail_content)
process_valuable_alts(market_setups_kucoin, "kucoin", binance_ticker,
                      mail_content)

send_mail("QQQ Valuable Alts Found QQQ", mail_content.content)
Ejemplo n.º 5
0
def notify_when_break_up(_url, _level):
    _btcd = round(get_current_cmc_cap(_url), 3)
    if _btcd > _level:
        send_mail(f"ZZZ BTC.D level {_level} BREAK UP ZZZ",
                  f"Current BTC.D : {_btcd} > observed : {_level}")
Ejemplo n.º 6
0
 log_assets(assets)
 mail_content = None
 found_assets = []
 for asset in assets:
     try:
         klines = get_klines_asset(asset)
         horizon = check_horizontal_price_level(asset, asset.horizon, klines)
         slope = check_price_slope(asset, klines)
         mas = check_mas(asset, klines)
         if mas:
             i = 1
         breakout_type = filter(lambda x: x, [("horizon", price_to_string(asset.buy_price), asset.horizon) if horizon else False,
                                              ("slope", asset.line.type) if slope else False])
         if horizon or slope or mas:
             closing_price = get_last_closing_price(asset)
             types = ' '.join([i for sub in breakout_type for i in sub])
             if mas:
                 mas_type = ' '.join([str(x) for x in mas])
                 types = f"{types} {mas_type}"
             found_assets.append(f"{asset.name} : {price_to_string(closing_price)} BTC --- ticker : {asset.ticker} --- type : {types}")
     except Exception as err:
         if isinstance(err, requests.exceptions.ConnectionError) or isinstance(err, requests.exceptions.ReadTimeout):
             logger.error("Connection problem...")
         else:
             traceback.print_tb(err.__traceback__)
             logger.exception(err.__traceback__)
 if len(found_assets):
     mail_content = '<BR/>'.join(found_assets)
     send_mail(f"QQQ Binance Pattern Found QQQ", mail_content)
     logger.info('\n'.join(found_assets))
 time.sleep(3600*4-60*5)
Ejemplo n.º 7
0
t1 = 600
cycle = 0
phrase = 'community coin vote round'


def get_response(_req):
    with urllib.request.urlopen(_req) as response:
        _page_content = response.read()
        _content = pattern_s.sub(" ", str(_page_content).lower())
        return _content


while 1:
    _content_twitter = get_response(req_twitter)
    _content_blog = get_response(req_blog)
    if phrase in _content_twitter + _content_blog:
        cnt += 1
        send_mail("QQQ Community Coin Vote Round FOUND!!!", url_twitter)
        logger.info("Community Coin Vote Round -- found")
        time.sleep(t1)
        if cnt == 3:
            t1 *= 6
            cnt = 0
            cycle += 1
        if cycle == 3:
            cycle = 0
            cnt = 0
            t1 = 600
            time.sleep(1209600)  # 14 days of sleeping, and we start from the beginning
    time.sleep(60)
Ejemplo n.º 8
0
                )
                markets_obj = Markets(binance_vol_filter, kucoin_vol_filter)
            market_setups_binance = analyze_markets("exclude-markets-binance",
                                                    _binance_ticker,
                                                    "1600 hours ago",
                                                    "binance", markets_obj)
            market_setups_kucoin = analyze_markets(
                "exclude-markets-kucoin", _kucoin_ticker,
                get_kucoin_interval_unit(_kucoin_ticker, 1600), "kucoin",
                markets_obj)
            setup_tuples = [(market_setups_binance, "binance"),
                            (market_setups_kucoin, "kucoin")]
            process_setups(setup_tuples, collection, _binance_ticker,
                           mail_content)

        if len(mail_content.content) > 0:
            send_mail(f"WWW Market Setup Found ({type_of_scan.upper()}) WWW",
                      mail_content.content)

        if type_of_scan == "long":
            time.sleep(3600 * 4 - 900)
        elif type_of_scan == "short":
            time.sleep(3600 - 900)
    except Exception as err:
        if isinstance(err, requests.exceptions.ConnectionError) or isinstance(
                err, requests.exceptions.ReadTimeout):
            logger.error("Connection problem...")
        else:
            traceback.print_tb(err.__traceback__)
            logger.exception(err.__traceback__)
def notify_when_break_up(_level):
    _btcd = get_current_btcd()
    if _btcd > _level:
        send_mail(f"ZZZ BTC.D level {_level} BREAK UP ZZZ", f"Current BTC.D : {_btcd} > observed : {_level}")
                ticker=BinanceClient.KLINE_INTERVAL_5MINUTE,
                stop_loss=False)
buy2 = BuyAsset("binance",
                "CHR",
                100 * sat,
                191 * sat,
                265 * sat,
                kucoin_side=side,
                ticker=BinanceClient.KLINE_INTERVAL_5MINUTE,
                stop_loss=False)
buy3 = BuyAsset("binance",
                "COTI",
                100 * sat,
                232 * sat,
                298 * sat,
                kucoin_side=side,
                ticker=BinanceClient.KLINE_INTERVAL_5MINUTE,
                stop_loss=False)

assets = [buy1, buy2, buy3]

adjust_purchase_fund(assets)
set_kucoin_buy_orders(assets)

bought_asset = watch_orders(assets)
bought_asset.limit_hidden_order(is_profit=True)
if wait_until_order_is_filled(bought_asset):
    mail_content = f"XXX {bought_asset.market} Took Profit XXX", f"{bought_asset.size_profit} {bought_asset.name} @ {get_format_price(bought_asset.price_profit)} BTC : {get_format_price(bought_asset.adjusted_size * bought_asset.price_profit)} BTC"
    send_mail(mail_content)
    sys.exit(0)