Trading bot for BitMex.
BitMex用トレーディングボットプログラム。
The author is not responsible for any damage caused by this software.
作者は本ソフトウェアによって生じる一切の損害について責任を負いません。
- Swithable strategy
- Back test
- Connect testnet
- Stub trading
- Channel Breakout
- Cross SMA
- RCI
- Open Close Cross Strategy
- Trading View Strategy
- Python: 3.6.5
$ brew install ta-lib
$ git clone https://github.com/noda-sin/ebisu.git
$ cd ebisu/
$ pip install -r requirements.txt
$ wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
$ tar xvzf ta-lib-0.4.0-src.tar.gz
$ cd ta-lib/
$ ./configure --prefix=/usr
$ make
$ sudo make install
$ git clone https://github.com/noda-sin/ebisu.git
$ cd ebisu/
$ pip install -r requirements.txt
Set BitMex's API key with the environment variables BITMEX_APIKEY
and BITMEX_SECRET
as shown below.
$ vi ~/.bash_profile
export BITMEX_APIKEY=***********
export BITMEX_SECRET=***********
If you want to notify LINE, set LINE's API key to the environment variable LINE_APIKEY
.
$ vi ~/.bash_profile
export LINE_APIKEY=***********
$ python main.py --strategy STRATEGY
By changing the value of STRATEGY
you can switch strategies to use.
$ python main.py --strategy Doten
$ python main.py --strategy Doten
It is possible to trade with testnet.
$ python main.py --demo --strategy Doten
$ python main.py --test --strategy Doten
$ python main.py --hyperopt --strategy Doten
$ python main.py --stub --strategy Doten
You can add strategy by creating a new class in src / strategy.py
as follows.
For example, this is a random entry implementation.
class Sample(Bot):
def __init__(self):
Bot.__init__(self, '1m', 10)
def options(self):
return {}
def strategy(self, open, close, high, low):
lot = self.exchange.get_lot()
which = random.randrange(2)
if which == 0:
self.exchange.entry("Long", True, lot)
else:
self.exchange.entry("Short", False, lot)
If you specify the strategy class name with the --strategy
argument as shown below, you can run the bot with the added strategy.
$ python main.py --strategy Sample
- 戦略切替機能
- バックテスト機能
- テストネット取引機能
- 本番スタブ取引機能
- チャネルブレイクアウト戦略
- SMAのクロス戦略
- Rci戦略
- Open Close Cross戦略
- Trading View戦略
- Python: 3.6.5
$ brew install ta-lib
$ git clone https://github.com/noda-sin/ebisu.git
$ cd ebisu/
$ pip install -r requirements.txt
$ wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
$ tar xvzf ta-lib-0.4.0-src.tar.gz
$ cd ta-lib/
$ ./configure --prefix=/usr
$ make
$ sudo make install
$ git clone https://github.com/noda-sin/ebisu.git
$ cd ebisu/
$ pip install -r requirements.txt
以下のように環境変数 BITMEX_APIKEY
, BITMEX_SECRET
で BitMex のAPIキーを設定します。
$ vi ~/.bash_profile
export BITMEX_APIKEY=***********
export BITMEX_SECRET=***********
LINEへの通知がしたい場合は、環境変数 LINE_APIKEY
に LINE のAPIキーを設定します。
$ vi ~/.bash_profile
export LINE_APIKEY=***********
$ python main.py --strategy STRATEGY
STRATEGY
の箇所を変えることで、利用する戦略を切り替えることができます。
$ python main.py --strategy Doten
--strategy
引数のみを設定することで、本稼働での取引を行えます。
$ python main.py --strategy Doten
--demo
引数を追加することで、testnet での取引を行えます。
$ python main.py --demo --strategy Doten
--test
引数を追加することで、戦略のバックテストを行えます。テスト結果後には、グラフが表示されます。
$ python main.py --test --strategy Doten
--hyperopt
引数を追加することで、Hyperoptを使ったパラメータ最適化を行えます。
$ python main.py --hyperopt --strategy Doten
--stub
引数を追加することで、架空の口座を使ったリアルなテストが行えます。
このモードの動作は、あまりテストしていません。。。
$ python main.py --stub --strategy Doten
こちらに記載しています。
以下のように、src/strategy.py
に新しいクラスを作成してください。
これは、ランダムにエントリーする実装です。
class Sample(Bot):
def __init__(self):
# 第一引数: 戦略で使う足幅
# 第二引数: 戦略で使うデータ期間
# 1分足で直近10期間の情報を戦略で必要とする場合
Bot.__init__(self, '1m', 10)
def options(self):
return {}
def strategy(self, open, close, high, low):
lot = self.exchange.get_lot()
which = random.randrange(2)
if which == 0:
self.exchange.entry("Long", True, lot)
else:
self.exchange.entry("Short", False, lot)
以下のように --strategy
引数で戦略クラス名を指定すると、追加した戦略でBotを稼働させることができます。
$ python main.py --strategy Sample
ご支援いただける方は、以下のWalletにBTCを送付ください。
1GPjM5AkdBDJnCouQ9AcS4mhUhdysXYCW1
質問・バグ報告・機能追加・戦略の実装依頼などは、issueもしくは、Twitterアカウント@noda_sinにDMでお問い合わせください。 ing View戦略の利用について