コード例 #1
0
ファイル: elephant.py プロジェクト: ossan0120/flyerbots
                                   limit=int(bid[1]),
                                   minute_to_expire=1)
                    restrict_range[target] = bid[2]
                else:
                    strategy.cancel(bid[0])

            logger.info(
                f'{delay} {buy_vol_avg:.1f}({buy_vol_std:.1f})/{sell_vol_avg:.1f}({sell_vol_std:.1f})/'
            )
        else:
            strategy.cancel_order_all()
            strategy.close_position()


if __name__ == "__main__":
    import settings
    import logging
    import logging.config

    logging.config.dictConfig(settings.loggingConf('elephant.log'))
    logger = logging.getLogger("elephant")

    bot = elephant()
    strategy = Strategy(yourlogic=bot.loop, yoursetup=bot.setup, interval=5)
    strategy.settings.apiKey = settings.apiKey
    strategy.settings.secret = settings.secret
    strategy.settings.disable_rich_ohlcv = True
    strategy.settings.max_ohlcv_size = 10 * 3
    strategy.risk.max_position_size = 0.1
    strategy.start()
コード例 #2
0
            'buy/sell {bid_20pct}/{ask_20pct} bid/ask {bid}/{ask}({spr})'.
            format(**locals()))

        qty_lot = 1
        strategy.entry('L',
                       'buy',
                       qty=qty_lot,
                       limit=bid_20pct,
                       minute_to_expire=1)
        strategy.entry('S',
                       'sell',
                       qty=qty_lot,
                       limit=ask_20pct,
                       minute_to_expire=1)


if __name__ == "__main__":
    import settings
    import logging
    import logging.config

    logging.basicConfig(level=logging.INFO)
    logger = logging.getLogger("LossCut")

    strategy = Strategy(LossCut().loop, 60)
    strategy.settings.symbol = 'BTCJPY28DEC2018'
    strategy.settings.apiKey = settings.apiKey
    strategy.settings.secret = settings.secret
    strategy.risk.max_position_size = 1
    strategy.start()
コード例 #3
0
                strategy.cancel('L' + str(no))
                strategy.cancel('S' + str(no))
            if strategy.position_size > 0:
                strategy.order('L close', 'sell', qty=strategy.position_size)
            elif strategy.position_size < 0:
                strategy.order('S close', 'buy', qty=-strategy.position_size)


if __name__ == "__main__":
    import settings
    import argparse
    import logging
    import logging.config
    import signal

    def handle_pdb(sig, frame):
        import pdb
        pdb.Pdb().set_trace(frame)

    signal.signal(signal.SIGUSR1, handle_pdb)

    logging.config.dictConfig(settings.loggingConf('mmbot.log'))
    logger = logging.getLogger("mmbot")

    strategy = Strategy(mmbot().loop, 5)
    strategy.settings.apiKey = settings.apiKey
    strategy.settings.secret = settings.secret
    strategy.settings.show_last_n_orders = 10
    strategy.risk.max_position_size = 0.05
    strategy.start()
コード例 #4
0
                        strategy.order(sellid,
                                       'sell',
                                       qty=sellsize,
                                       limit=int(mid + width + ofs),
                                       seconds_to_keep_order=period,
                                       minute_to_expire=1)
                        sellmax -= sellsize
                    else:
                        strategy.cancel(sellid)
        else:
            strategy.cancel_order_all()
            strategy.close_position()


if __name__ == "__main__":
    import settings
    import argparse
    import logging
    import logging.config

    logging.config.dictConfig(settings.loggingConf('simple_market_maker.log'))
    logger = logging.getLogger("simple_market_maker")

    strategy = Strategy(simple_market_maker().loop, 5)
    strategy.settings.apiKey = settings.apiKey
    strategy.settings.secret = settings.secret
    strategy.settings.max_ohlcv_size = 12 * 10
    strategy.settings.disable_rich_ohlcv = True
    strategy.risk.max_position_size = 0.02
    strategy.start()
コード例 #5
0
ファイル: spread_catcher.py プロジェクト: ossan0120/flyerbots
            if volimb>10:
                strategy.entry('L tf', 'buy', qty=qty_lot)
            elif volimb<-10:
                strategy.entry('S tf', 'sell', qty=qty_lot)
        else:
            spr_target = 50
            if spr >= spr_target or strategy.position_size < 0:
                strategy.order('L', 'buy', qty=qty_lot, limit=bid+1, minute_to_expire=1)
            else:
                strategy.cancel('L')
            if spr >= spr_target or strategy.position_size > 0:
                strategy.order('S', 'sell', qty=qty_lot, limit=ask-1, minute_to_expire=1)
            else:
                strategy.cancel('S')

if __name__ == "__main__":
    import settings
    import logging
    import logging.config

    logging.config.dictConfig(settings.loggingConf('spcatcher.log'))
    logger = logging.getLogger("spcatcher")

    strategy = Strategy(spcatcher().loop, 5)
    # strategy.settings.symbol = 'BTCJPY28DEC2018'
    strategy.settings.apiKey = settings.apiKey
    strategy.settings.secret = settings.secret
    strategy.settings.show_last_n_orders = 10
    strategy.risk.max_position_size = 0.05
    strategy.start()
コード例 #6
0
                strategy.cancel('Lc')
            if short_size >= 0.01:
                strategy.order('Sc',
                               'buy',
                               qty=short_size,
                               limit=buy,
                               minute_to_expire=1)
            else:
                strategy.cancel('Lc')
        else:
            strategy.cancel_order_all()
            strategy.close_position()


if __name__ == "__main__":
    import settings
    import logging
    import logging.config

    logging.config.dictConfig(settings.loggingConf('scalping.log'))
    logger = logging.getLogger("scalping")

    strategy = Strategy(scalping().loop, 1)
    strategy.settings.apiKey = settings.apiKey
    strategy.settings.secret = settings.secret
    strategy.settings.use_lazy_ohlcv = True
    strategy.settings.timeframe = 1
    strategy.settings.disable_rich_ohlcv = True
    strategy.risk.max_position_size = 0.05
    strategy.start()
コード例 #7
0
                            pnl = mid - price
                            if pnl <= loss or pnl >= profit:
                                strategy.order(f'C{price}', 'sell', qty=size)
                        else:
                            pnl = price - mid
                            if pnl <= loss or pnl >= profit:
                                strategy.order(f'C{price}', 'buy', qty=size)
            else:
                strategy.cancel_order_all()
                strategy.close_position()
        else:
            strategy.cancel_order_all()
            strategy.close_position()


if __name__ == "__main__":
    import settings
    import logging
    import logging.config

    logging.config.dictConfig(settings.loggingConf('fraction.log'))
    logger = logging.getLogger("fraction")

    strategy = Strategy(fraction().loop, 0.5)
    strategy.settings.apiKey = settings.apiKey
    strategy.settings.secret = settings.secret
    strategy.settings.max_ohlcv_size = 30
    strategy.settings.disable_rich_ohlcv = True
    strategy.risk.max_position_size = 0.1
    strategy.start()
コード例 #8
0
                buy = mid - pof
                sell = mid + rng*3
            elif z<-0:
                buy = mid - rng*3
                sell = mid - pof
            else:
                buy = mid - rng*3
                sell = mid + rng*3
            strategy.order('L', 'buy', qty=max(0.02 * z, 0.01), limit=int(buy), limit_mask=rng*0.5, minute_to_expire=1)
            strategy.order('S', 'sell', qty=max(0.02 * -z, 0.01), limit=int(sell), limit_mask=rng*0.5, minute_to_expire=1)
        else:
            strategy.cancel_order_all()
            strategy.close_position()


if __name__ == "__main__":
    import settings
    import logging
    import logging.config

    logging.config.dictConfig(settings.loggingConf('hft.log'))
    logger = logging.getLogger("hft")

    strategy = Strategy(hft().loop, 0.5)
    strategy.settings.apiKey = settings.apiKey
    strategy.settings.secret = settings.secret
    strategy.settings.disable_rich_ohlcv = True
    strategy.settings.max_ohlcv_size = 1000
    strategy.risk.max_position_size = 0.1
    strategy.start()
コード例 #9
0
                                   limit=sfdbid,
                                   minute_to_expire=1)
                if deltapos - lot >= -sellmax:
                    strategy.order('S',
                                   'sell',
                                   qty=lot,
                                   limit=sfdask,
                                   minute_to_expire=1)

        # logger.info(f'{spot_ltp} {spot_past_time:6.3f} {ltp_min} {ltp_max}')


if __name__ == "__main__":
    import settings
    import argparse
    import logging
    import logging.config

    logging.basicConfig(level=logging.INFO)
    logging.getLogger("socketio").setLevel(logging.WARNING)
    logging.getLogger("engineio").setLevel(logging.WARNING)
    logger = logging.getLogger("SFDBot")

    sfd = SFDBot()
    strategy = Strategy(sfd.loop, 0.02, sfd.setup)
    strategy.settings.apiKey = settings.apiKey
    strategy.settings.secret = settings.secret
    strategy.settings.disable_create_ohlcv = True
    strategy.risk.max_position_size = 0.1
    strategy.start()
コード例 #10
0
ファイル: volbot.py プロジェクト: ossan0120/flyerbots
            if sell_entry and strategy.position_size >= 0:
                strategy.cancel('L exit')
                strategy.entry('S', 'sell', qty=qty_lot)
        else:
            strategy.cancel('L')
            strategy.cancel('S')
            if position.currentQty > 0:
                strategy.order('L exit suspended',
                               'sell',
                               qty=position.currentQty)
            elif position.currentQty < 0:
                strategy.order('S exit suspended',
                               'buy',
                               qty=-position.currentQty)


if __name__ == "__main__":
    import settings
    import argparse
    import logging
    import logging.config

    logging.basicConfig(level=logging.INFO)
    logger = logging.getLogger("volbot")

    strategy = Strategy(Volbot().loop, 1)
    strategy.settings.apiKey = settings.apiKey
    strategy.settings.secret = settings.secret
    strategy.risk.max_position_size = 0.01
    strategy.start()
コード例 #11
0
            if delta_pos <= -maxsize:
                sellsize = 0
            elif delta_pos > maxsize:
                sellsize = maxsize
            else:
                sellsize = (-maxsize / 4) * ((
                    (-delta_pos + maxsize) / maxsize)**2) + maxsize

            buy = ticker.best_bid
            sell = ticker.best_ask
            if buysize >= 0.01 and buychg > 500:
                strategy.order('L', 'buy', qty=buysize, limit=buy)
            if sellsize >= 0.01 and sellchg < -500:
                strategy.order('S', 'sell', qty=sellsize, limit=sell)


if __name__ == "__main__":
    import settings
    import logging
    import logging.config

    logging.config.dictConfig(settings.loggingConf('inago.log'))
    logger = logging.getLogger("inago")

    strategy = Strategy(inago().loop, 5)
    strategy.settings.apiKey = settings.apiKey
    strategy.settings.secret = settings.secret
    strategy.settings.disable_rich_ohlcv = True
    strategy.risk.max_position_size = 0.1
    strategy.start()
コード例 #12
0
                                   limit=ticker.best_bid,
                                   time_in_force='FOK')
                    self.next_order_accept_time = t + self.min_order_interval
                    showlog = True

        if showlog:
            logger.info(
                '{cur_time} {fx_delay:.4f} {btc_delay:.4f}'.format(**locals()))
            logger.info(
                'SFD {sfdpct:.4f}({sfdpct_bid:.4f}/{sfdpct_ask:.4f}) '
                'FX ltp[bid/ask] {fx_ltp} {fx_exec_side:<4}({fx_exec_cnt})[{ticker[best_bid]:.0f}({ticker[best_bid_size]:6.2f})/{ticker[best_ask]:.0f}({ticker[best_ask_size]:6.2f})] '
                'BTC ltp[bid/ask] {btc_ltp:.0f}[{ticker_btcjpy[best_bid]:.0f}/{ticker_btcjpy[best_ask]:.0f}]'
                .format(**locals()))


if __name__ == "__main__":
    import settings
    import argparse
    import logging
    import logging.config

    logging.basicConfig(level=logging.INFO)
    logger = logging.getLogger("SFDBot")

    strategy = Strategy(SFDBot().loop, 0.0)
    strategy.settings.apiKey = settings.apiKey
    strategy.settings.secret = settings.secret
    strategy.settings.disable_ohlcv = True
    strategy.risk.max_position_size = 0.01
    strategy.start()