def price_buy_strategy():
    logger = setup_logger("price_buy_strategy")
    buy_assets = [
        BuyAsset(exchange, 'STORJ', 0.00001545, 0.00001400, 0.00002640, 96,
                 15),
        BuyAsset(exchange, 'CELR', 0.00000081, 0.00000075, 0.00000174, 96, 15),
        BuyAsset(exchange, 'ONE', 0.00000102, 0.00000096, 0.00000179, 96, 15),
        BuyAsset(exchange, 'MATIC', 0.00000101, 0.00000096, 0.00000212, 96,
                 15),
        BuyAsset(exchange, 'FTM', 0.00000159, 0.00000149, 0.00000271, 96, 15),
        BuyAsset(exchange, 'HOT', 0.00000010, 0.00000008, 0.00000026, 96, 15),
        BuyAsset(exchange, 'DOGE', 0.00000018, 0.00000016, 0.00000046, 96, 15)
    ]
    btc_value = get_remaining_btc_binance()
    adjust_buy_asset_btc_volume(buy_assets, btc_value)
    check_buy_assets(buy_assets)
    logger.info("{} -- Starting price_buy_strategy :\n{}".format(
        exchange, '\n'.join(
            map(
                lambda _a: "{}\tbuy : {}\tstop : {}\tprofit : {}".format(
                    _a.name, price_to_string(_a.price),
                    price_to_string(_a.stop_loss_price),
                    price_to_string(_a.price_profit)), buy_assets))))
    observe_lower_price_binance(buy_assets)
    logger.info("price_buy_strategy -- has finished")
    logger.info("Stop-loss and taking profits in progress only...")
Пример #2
0
def price_observer_strategy():
    logger = setup_logger("price_observer_strategy")
    buy_assets = [
        ObserveAsset('STORJ', 0.00002137, 0.00002080, 0.00004036, 15)
    ]
    check_observe_assets(buy_assets)
    logger.info("Starting price_observer_strategy :\n{}".format(
        '\n'.join(map(lambda _a: "{}\tbuy : {}\tstop : {}\tprofit : {}".format(_a.name, price_to_string(_a.buy_price),
                                                                               price_to_string(_a.stop_loss_price),
                                                                               price_to_string(_a.price_profit)),
                      buy_assets))))
    for buy_asset in buy_assets:
        ObserverStrategy(buy_asset).run()

    logger.info("price_observer_strategy -- has finished")
    logger.info("Stop-loss and taking profits in progress only...")
Пример #3
0
def price_buy_strategy():
    logger = setup_logger("price_buy_strategy")
    buy_assets = [
        BuyAsset(exchange, 'CHR', 0.00000274, 0.00000250, 0.00000294, 96, 15),
        BuyAsset(exchange, 'VRA', 0.0000000959, 0.0000000939, 0.0000000989, 96, 15),
    ]
    btc_value = get_remaining_btc_kucoin()
    adjust_buy_asset_btc_volume(buy_assets, btc_value)
    check_buy_assets(buy_assets)
    logger.info("{} -- Starting price_buy_strategy :\n{}".format(exchange,
        '\n'.join(map(lambda _a: "{}\tbuy : {}\tstop : {}\tprofit : {}".format(_a.name, price_to_string(_a.price),
                                                                               price_to_string(_a.stop_loss_price),
                                                                               price_to_string(_a.price_profit)),
                      buy_assets))))
    observe_lower_price_kucoin(buy_assets)
    logger.info("price_buy_strategy -- has finished")
    logger.info("Stop-loss and taking profits in progress only...")
Пример #4
0
authorize()

while 1:
    assets = create_observe_assets()
    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):