Code Monkey home page Code Monkey logo

ebisu's Introduction

ゑびす

Trading bot for BitMex.

The author is not responsible for any damage caused by this software.

Features

  • Swithable strategy
  • Back test
  • Connect testnet
  • Stub trading

Implemented strategies

  1. Channel Breakout
  2. Cross SMA
  3. RCI
  4. Open Close Cross Strategy
  5. Trading View Strategy

Dependencies

  • Python: 3.6.5

How to install

1. Install packages

OSX

$ brew install ta-lib
$ git clone https://github.com/noda-sin/ebisu.git
$ cd ebisu/
$ pip install -r requirements.txt

LINUX

$ 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

2. Setting environment

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=***********

How to execute

$ python main.py --strategy STRATEGY

By changing the value of STRATEGY you can switch strategies to use.

例) Case of using Channel Breakout

$ python main.py --strategy Doten

Mode

1. Production Trade Mode

$ python main.py --strategy Doten

2. Demo Trade Mode

It is possible to trade with testnet.

$ python main.py --demo --strategy Doten

3. Back test Mode

$ python main.py --test --strategy Doten

4. Hyperopt Mode

$ python main.py --hyperopt --strategy Doten

5. Stub trade Mode

$ python main.py --stub --strategy Doten

How to use TV strategy

Here

How to add strategy

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

Support

if you support to me, please send BTC to me.

wallet: 1GPjM5AkdBDJnCouQ9AcS4mhUhdysXYCW1

ebisu's People

Contributors

blivesta avatar noda-sin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ebisu's Issues

invalid syntax / modulenotfounderror

python3 main.py --strategy strategy
Traceback (most recent call last):
File "/home/ooo/ta-lib/ebisu/src/factory.py", line 16, in create
cls = getattr(strategy, args.strategy)
AttributeError: module 'src.strategy' has no attribute 'strategy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 20, in <module)
bot = BotFactory.create(args)
File "/home/ooo/ta-lib/ebisu/src/factory.py", line 24, in create
raise Exception(f"Not Found Strategy : {args.strategy}")
Exception: Not Found Strategy : strategy

how can i solve this? help plz

websocket is not authenticating

:~/ebisu$ python3 main.py --strategy OCC
2020-05-05 16:50:17,347 - INFO - Bot Mode : Trade
2020-05-05 16:50:17,348 - INFO - WebSocket is not authenticating.
2020-05-05 16:50:17,350 - INFO - Starting Bot
2020-05-05 16:50:17,351 - INFO - Strategy : OCC
/home/saramg963/.local/lib/python3.6/site-packages/swagger_spec_validator/validator20.py:53: SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information. (path #/definitions/User/properties/preferences)
ref_dict['$ref'], '/'.join(path),
Traceback (most recent call last):
File "/home/saramg963/ebisu/src/init.py", line 94, in retry
/home/saramg963/.local/lib/python3.6/site-packages/swagger_spec_validator/validator20.py:53: SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information. (path #/definitions/User/properties/preferences)
ref_dict['$ref'], '/'.join(path),
ret, res = func()
File "/home/saramg963/ebisu/src/bitmex.py", line 119, in
.User.User_getMargin(currency="XBt").result())
File "/home/saramg963/.local/lib/python3.6/site-packages/bravado/http_future.py", line 271, in result
swagger_result = self._get_swagger_result(incoming_response)
File "/home/saramg963/.local/lib/python3.6/site-packages/bravado/http_future.py", line 124, in wrapper

return func(self, *args, **kwargs)

File "/home/saramg963/.local/lib/python3.6/site-packages/bravado/http_future.py", line 303, in _get_swagger_result
self.request_config.response_callbacks,
File "/home/saramg963/.local/lib/python3.6/site-packages/bravado/http_future.py", line 353, in unmarshal_response
raise_on_expected(incoming_response)
File "/home/saramg963/.local/lib/python3.6/site-packages/bravado/http_future.py", line 422, in raise_on_expected
swagger_result=http_response.swagger_result)
bravado.exception.HTTPUnauthorized: 401 Unauthorized: {'error': {'message': 'Authorization Required', 'name': 'HTTPError'}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 22, in
bot.run()
File "/home/saramg963/ebisu/src/bot.py", line 127, in run
logger.info(f"Balance : {self.exchange.get_balance()}")
File "/home/saramg963/ebisu/src/bitmex.py", line 107, in get_balance
return self.get_margin()["walletBalance"]
File "/home/saramg963/ebisu/src/bitmex.py", line 118, in get_margin
self.margin = retry(lambda: self.private_client
File "/home/saramg963/ebisu/src/init.py", line 112, in retry
raise FatalError(error)
src.FatalError: 401 Unauthorized: {'error': {'message': 'Authorization Required', 'name': 'HTTPError'}}

If I solve one thing, another problem happened....
help

CPU使用率について

@noda-sin 様 先日はありがとうございました!無事に稼働しております!

CPU稼働率についてお伺いしたいのですが、
AWSで実行時CPUが99%に張り付く感じクレジットが減り動作が重くなってしまいました。
(Nohup にしておりました)

なので、GCPだとどうなのだろうと思い移行してみましたが、

GCP (g1-small(vCPU x 1、メモリ 1.7 GB))

    • PS AUX
      root 24559 99.6 5.6 489132 96924 ? Rl 10:32 133:38 python3.6 main.py --strategy Doten

gcp

同じ感じで、モニタリングでもCPUは100%近い感じでした。

CPUクレジットが思ったより減る感じになっていたので、
なんとか回避できる技はあるのでしょうか。

Nohupでしているからこのような稼働率になってしまうのでしょうか。
もし何か思いつく事などあればお伺いしたいです!

よろしくお願いいたします。

No trades after first trade in OCC stategy

I'm testing the OCC strategy and after a trade is made, nothing changes in the log and no more trades are done. See my picture. After the trade was made and quantity has updated, nothing happens.
Can anyone help me please? Thank you

asd

KeyError: 'timestamp'

Hey
after I run python main.py --demo --strategy Doten

it indicated the following error message

2019-11-30 15:33:02,188 - INFO - Bot Mode : Back test
/Users/ywen8/.asdf/installs/python/3.6.5/lib/python3.6/site-packages/swagger_spec_validator/validator20.py:53: SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information. (path #/definitions/User/properties/preferences)
  ref_dict['$ref'], '/'.join(path),
Traceback (most recent call last):
  File "/Users/ywen8/.asdf/installs/python/3.6.5/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2897, in get_loc
    return self._engine.get_loc(key)
  File "pandas/_libs/index.pyx", line 107, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 131, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 1607, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 1614, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'timestamp'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "main.py", line 22, in <module>
    bot.run()
  File "/Users/ywen8/Documents/Projects/PyCharm/ebisu/src/bot.py", line 123, in run
    self.exchange.on_update(self.bin_size, self.strategy)
  File "/Users/ywen8/Documents/Projects/PyCharm/ebisu/src/bitmex_backtest.py", line 143, in on_update
    self.__load_ohlcv(bin_size)
  File "/Users/ywen8/Documents/Projects/PyCharm/ebisu/src/bitmex_backtest.py", line 202, in __load_ohlcv
    self.df_ohlcv = load_data(file)
  File "/Users/ywen8/Documents/Projects/PyCharm/ebisu/src/__init__.py", line 48, in load_data
    'timestamp': pd.to_datetime(source['timestamp']),
  File "/Users/ywen8/.asdf/installs/python/3.6.5/lib/python3.6/site-packages/pandas/core/frame.py", line 2995, in __getitem__
    indexer = self.columns.get_loc(key)
  File "/Users/ywen8/.asdf/installs/python/3.6.5/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2899, in get_loc
    return self._engine.get_loc(self._maybe_cast_indexer(key))
  File "pandas/_libs/index.pyx", line 107, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 131, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 1607, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 1614, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'timestamp'

I have Issue with everythings

here is my error when I did " python main.py --demo --strategy Doten "

`$ python main.py --demo --strategy Doten
2021-03-16 18:38:19,828 - INFO - Bot Mode : Trade
2021-03-16 18:38:19,828 - INFO - Starting Bot
2021-03-16 18:38:19,829 - INFO - Strategy : Doten
2021-03-16 18:38:21,377 - ERROR - error from callback <bound method BitMexWs.__on_error of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: __on_error() missing 1 required positional argument: 'message'
2021-03-16 18:38:21,377 - ERROR - error from callback <bound method BitMexWs.__on_close of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: __on_close() missing 1 required positional argument: 'ws'
C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\swagger_spec_validator\validator20.py:53: SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information. (path #/definitions/User/properties/preferences)
ref_dict['$ref'], '/'.join(path),
2021-03-16 18:38:22,340 - ERROR - error from callback <bound method BitMexWs.__on_error of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: __on_error() missing 1 required positional argument: 'message'
2021-03-16 18:38:22,340 - ERROR - error from callback <bound method BitMexWs.__on_close of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: __on_close() missing 1 required positional argument: 'ws'
2021-03-16 18:38:23,315 - ERROR - error from callback <bound method BitMexWs.__on_error of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: __on_error() missing 1 required positional argument: 'message'
2021-03-16 18:38:23,316 - ERROR - error from callback <bound method BitMexWs.__on_close of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: __on_close() missing 1 required positional argument: 'ws'
2021-03-16 18:38:24,334 - ERROR - error from callback <bound method BitMexWs.__on_error of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: __on_error() missing 1 required positional argument: 'message'
2021-03-16 18:38:24,334 - ERROR - error from callback <bound method BitMexWs.__on_close of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: _on_close() missing 1 required positional argument: 'ws'
Traceback (most recent call last):
File "C:\Users\hwang\Desktop\ebisu\src_init
.py", line 94, in retry
ret, res = func()
File "C:\Users\hwang\Desktop\ebisu\src\bitmex.py", line 119, in
.User.User_getMargin(currency="XBt").result())
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 271, in result
swagger_result = self._get_swagger_result(incoming_response)
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 124, in wrapper
return func(self, *args, **kwargs)
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 303, in _get_swagger_result
self.request_config.response_callbacks,
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 353, in unmarshal_response
raise_on_expected(incoming_response)
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 422, in raise_on_expected
swagger_result=http_response.swagger_result)
bravado.exception.HTTPUnauthorized: 401 Unauthorized: {'error': {'message': 'Invalid API Key.', 'name': 'HTTPError'}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 22, in
bot.run()
File "C:\Users\hwang\Desktop\ebisu\src\bot.py", line 127, in run
logger.info(f"Balance : {self.exchange.get_balance()}")
File "C:\Users\hwang\Desktop\ebisu\src\bitmex.py", line 107, in get_balance
return self.get_margin()["walletBalance"]
File "C:\Users\hwang\Desktop\ebisu\src\bitmex.py", line 118, in get_margin
self.margin = retry(lambda: self.private_client
File "C:\Users\hwang\Desktop\ebisu\src_init_.py", line 112, in retry
raise FatalError(error)
src.FatalError: 401 Unauthorized: {'error': {'message': 'Invalid API Key.', 'name': 'HTTPError'}}
`

AND here is my error when I did " python main.py --strategy TV "

`$ python main.py --strategy TV
2021-03-16 18:41:59,158 - INFO - Bot Mode : Trade
2021-03-16 18:41:59,158 - INFO - Starting Bot
2021-03-16 18:41:59,158 - INFO - Strategy : TV
C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\swagger_spec_validator\validator20.py:53: SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information. (path #/definitions/User/properties/preferences)
ref_dict['$ref'], '/'.join(path),
Traceback (most recent call last):
File "C:\Users\hwang\Desktop\ebisu\src_init_.py", line 94, in retry
ret, res = func()
File "C:\Users\hwang\Desktop\ebisu\src\bitmex.py", line 119, in
.User.User_getMargin(currency="XBt").result())
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 271, in result
swagger_result = self._get_swagger_result(incoming_response)
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 124, in wrapper
return func(self, *args, **kwargs)
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 303, in _get_swagger_result
self.request_config.response_callbacks,
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 353, in unmarshal_response
raise_on_expected(incoming_response)
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 422, in raise_on_expected
swagger_result=http_response.swagger_result)
bravado.exception.HTTPUnauthorized: 401 Unauthorized: {'error': {'message': 'Invalid API Key.', 'name': 'HTTPError'}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 22, in
bot.run()
File "C:\Users\hwang\Desktop\ebisu\src\strategy.py", line 221, in run
logger.info(f"Balance : {self.exchange.get_balance()}")
File "C:\Users\hwang\Desktop\ebisu\src\bitmex.py", line 107, in get_balance
return self.get_margin()["walletBalance"]
File "C:\Users\hwang\Desktop\ebisu\src\bitmex.py", line 118, in get_margin
self.margin = retry(lambda: self.private_client
File "C:\Users\hwang\Desktop\ebisu\src_init_.py", line 112, in retry
raise FatalError(error)
src.FatalError: 401 Unauthorized: {'error': {'message': 'Invalid API Key.', 'name': 'HTTPError'}}
`

everything like this error
I did "source ~/.bash_profile"
and my bash_profile is like this

export BITMEX_TEST_APIKEY=oJ8w4XXXXXXXXXXXXXXXXXXXXXXfhnQ export BITMEX_TEST_SECRET=SvlbbnXXXXXXXXXXXXXXXXXXXXXXXXL2eRI export LINE_APIKEY=Uf252XXXXXXXXXXX22c92d export [email protected]

I really wanna use this bot so can someone help me?

"ERROR - Handshake status 400 Bad Request" and then "ERROR - Handshake status 429 Too Many Requests"

2018-08-02 23:13:34,556 - ERROR - Handshake status 400 Bad Request
2018-08-02 23:13:34,558 - ERROR - Traceback (most recent call last):
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_app.py", line 236, in run_forever
host=host, origin=origin)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_core.py", line 220, in connect
self.handshake_response = handshake(self.sock, *addrs, **options)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_handshake.py", line 69, in handshake
status, resp = _get_resp_headers(sock)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_handshake.py", line 135, in _get_resp_headers
raise WebSocketBadStatusException("Handshake status %d %s", status, status_message)
websocket._exceptions.WebSocketBadStatusException: Handshake status 400 Bad Request

2018-08-02 23:13:35,536 - ERROR - Handshake status 400 Bad Request
2018-08-02 23:13:35,536 - ERROR - Traceback (most recent call last):
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_app.py", line 236, in run_forever
host=host, origin=origin)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_core.py", line 220, in connect
self.handshake_response = handshake(self.sock, *addrs, **options)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_handshake.py", line 69, in handshake
status, resp = _get_resp_headers(sock)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_handshake.py", line 135, in _get_resp_headers
raise WebSocketBadStatusException("Handshake status %d %s", status, status_message)
websocket._exceptions.WebSocketBadStatusException: Handshake status 400 Bad Request
.
.
.
(same error about 200 times in 90 seconds)
.
.
.

2018-08-02 23:15:06,825 - ERROR - Handshake status 400 Bad Request
2018-08-02 23:15:06,826 - ERROR - Traceback (most recent call last):
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_app.py", line 236, in run_forever
host=host, origin=origin)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_core.py", line 220, in connect
self.handshake_response = handshake(self.sock, *addrs, **options)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_handshake.py", line 69, in handshake
status, resp = _get_resp_headers(sock)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_handshake.py", line 135, in _get_resp_headers
raise WebSocketBadStatusException("Handshake status %d %s", status, status_message)
websocket._exceptions.WebSocketBadStatusException: Handshake status 400 Bad Request

2018-08-02 23:15:06,848 - ERROR - Handshake status 429 Too Many Requests
2018-08-02 23:15:06,849 - ERROR - Traceback (most recent call last):
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_app.py", line 236, in run_forever
host=host, origin=origin)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_core.py", line 220, in connect
self.handshake_response = handshake(self.sock, *addrs, **options)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_handshake.py", line 69, in handshake
status, resp = _get_resp_headers(sock)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_handshake.py", line 135, in _get_resp_headers
raise WebSocketBadStatusException("Handshake status %d %s", status, status_message)
websocket._exceptions.WebSocketBadStatusException: Handshake status 429 Too Many Requests

2018-08-02 23:15:06,875 - ERROR - Handshake status 429 Too Many Requests
2018-08-02 23:15:06,875 - ERROR - Traceback (most recent call last):
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_app.py", line 236, in run_forever
host=host, origin=origin)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_core.py", line 220, in connect
self.handshake_response = handshake(self.sock, *addrs, **options)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_handshake.py", line 69, in handshake
status, resp = _get_resp_headers(sock)
File "/usr/local/python3.6/lib/python3.6/site-packages/websocket/_handshake.py", line 135, in _get_resp_headers
raise WebSocketBadStatusException("Handshake status %d %s", status, status_message)
websocket._exceptions.WebSocketBadStatusException: Handshake status 429 Too Many Requests
.
.
.
(The error 429 never stopped until I kill the process)

__get_auth if len(api_key) > 0 and len(api_secret):

I have added my (testnet) APIKEY+ SECRET in .bash_profile
like so:

export BITMEX_APIKEY=xxxxxxxxxx
export BITMEX_SECRET=xxxxxxxxxxxxxxx

when i run python3 main.py --demo --strategy Doten →

2019-05-06 02:51:27,683 - INFO - Bot Mode : Trade
Traceback (most recent call last):
File "main.py", line 22, in
bot.run()
File "/Users/admin/marketmakers/bitmex/ebisu/src/bot.py", line 123, in run
self.exchange.on_update(self.bin_size, self.strategy)
File "/Users/admin/marketmakers/bitmex/ebisu/src/bitmex.py", line 616, in on_update
self.ws = BitMexWs(test=self.demo)
File "/Users/admin/marketmakers/bitmex/ebisu/src/bitmex_websocket.py", line 59, in init
header=self.__get_auth())
File "/Users/admin/marketmakers/bitmex/ebisu/src/bitmex_websocket.py", line 71, in __get_auth
if len(api_key) > 0 and len(api_secret):
TypeError: object of type 'NoneType' has no len()

any tips/suggestions?

main.py 実行時に

noda-sin様、bot公開ありがとうございます。どう動くのかワクワクします。

aws上で動かすつもりなのですが、
記載していただいた手順をふみ実行すると下記のようなエラーがでました。

`
Traceback (most recent call last):
File "main.py", line 7, in
from src.factory import BotFactory
File "/home/ubuntu/ebisu/src/factory.py", line 24
raise Exception(f"Not Found Strategy : {args.strategy}")
^
SyntaxError: invalid syntax

`

gitlab.comの方でのクローンできなかったので、githubの方でクローンさせていただきました。
実行時にpython main.py --strategy Doten 等とコマンドを打ちました。

お時間ございましたらご教授いただけると幸いです。

how can ı run with pycharm

hi how can ı run with pycharm ım sory ı dont know a lot where ı must write api key and api secret

what ı must write under
whil true:
............................

Strategy OCCについて

@noda-sin 様 いつもありがとうございます!また開発本当にお疲れ様です!ストラテジーも追加されていてとても嬉しかったです!

昨日からOCCで稼働していて先ほどLINEにエラーが出ていたので共有させていただきます!
GCPで運用してました。(エラーが出たあとは、止まらず常に吐き続けていました。)
下記にログを添付します!

Lineに送られてきたエラーです。
`
Ebisu-mex: Traceback (most recent call last):
File "/home/GCP/.pyenv/versions/3.6.5/lib/python3.6/site-packages/talib/init.py", line 20, in wrapper
for arg in chain(args, kwargs.values())
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/GCP/ebisu/src/bitmex.py", line 485, in __update_ohlcv
self.strategy(open, close, high, low, volume)
File "/home/GCP/ebisu/src/strategy.py", line 111, in strategy
dema_close = dema(close, basis_len)
File "/home/GCP/ebisu/src/strategy.py", line 109, in dema
return 2 * a - ema(a, length)
File "/home/GCP/ebisu/src/init.py", line 145, in ema
return talib.EMA(np.array(source), period)
File "/home/GCP/.pyenv/versions/3.6.5/lib/python3.6/site-packages/talib/init.py", line 24, in wrapper
return func(*args, **kwargs)
File "talib/_func.pxi", line 7091, in talib._ta_lib.EMA
`

nohup.outのlogになります。

`

2018-07-23 13:30:15,178 - ERROR - An error occurred. inputs are all NaN
2018-07-23 13:30:15,178 - ERROR - An error occurred. inputs are all NaN
2018-07-23 13:30:15,178 - ERROR - An error occurred. inputs are all NaN
2018-07-23 13:30:15,179 - ERROR - Traceback (most recent call last):
File "/home/GCP/.pyenv/versions/3.6.5/lib/python3.6/site-packages/talib/init.py", line 20, in wrapper
for arg in chain(args, kwargs.values())
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/GCP/ebisu/src/bitmex.py", line 485, in __update_ohlcv
self.strategy(open, close, high, low, volume)
File "/home/GCP/ebisu/src/strategy.py", line 111, in strategy
dema_close = dema(close, basis_len)
File "/home/GCP/ebisu/src/strategy.py", line 109, in dema
return 2 * a - ema(a, length)
File "/home/GCP/ebisu/src/init.py", line 145, in ema
return talib.EMA(np.array(source), period)
File "/home/GCP/.pyenv/versions/3.6.5/lib/python3.6/site-packages/talib/init.py", line 24, in wrapper
return func(*args, **kwargs)
File "talib/_func.pxi", line 7091, in talib._ta_lib.EMA
Exception: inputs are all NaN
2018-07-23 13:31:15,139 - ERROR - An error occurred. inputs are all NaN
2018-07-23 13:31:15,139 - ERROR - Traceback (most recent call last):
File "/home/GCP/.pyenv/versions/3.6.5/lib/python3.6/site-packages/talib/init.py", line 20, in wrapper
for arg in chain(args, kwargs.values())
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/GCP/ebisu/src/bitmex.py", line 485, in __update_ohlcv
self.strategy(open, close, high, low, volume)
File "/home/GCP/ebisu/src/strategy.py", line 111, in strategy
dema_close = dema(close, basis_len)
File "/home/GCP/ebisu/src/strategy.py", line 109, in dema
return 2 * a - ema(a, length)
File "/home/GCP/ebisu/src/init.py", line 145, in ema
return talib.EMA(np.array(source), period)
File "/home/GCP/.pyenv/versions/3.6.5/lib/python3.6/site-packages/talib/init.py", line 24, in wrapper
return func(*args, **kwargs)
File "talib/_func.pxi", line 7091, in talib._ta_lib.EMA
Exception: inputs are all NaN

`

何か参考になれば幸いです!

Truble with main.py and bot.py

here is my error when I did " python main.py --demo --strategy Doten "

`$ python main.py --demo --strategy Doten
2021-03-16 18:38:19,828 - INFO - Bot Mode : Trade
2021-03-16 18:38:19,828 - INFO - Starting Bot
2021-03-16 18:38:19,829 - INFO - Strategy : Doten
2021-03-16 18:38:21,377 - ERROR - error from callback <bound method BitMexWs.__on_error of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: __on_error() missing 1 required positional argument: 'message'
2021-03-16 18:38:21,377 - ERROR - error from callback <bound method BitMexWs.__on_close of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: __on_close() missing 1 required positional argument: 'ws'
C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\swagger_spec_validator\validator20.py:53: SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information. (path #/definitions/User/properties/preferences)
ref_dict['$ref'], '/'.join(path),
2021-03-16 18:38:22,340 - ERROR - error from callback <bound method BitMexWs.__on_error of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: __on_error() missing 1 required positional argument: 'message'
2021-03-16 18:38:22,340 - ERROR - error from callback <bound method BitMexWs.__on_close of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: __on_close() missing 1 required positional argument: 'ws'
2021-03-16 18:38:23,315 - ERROR - error from callback <bound method BitMexWs.__on_error of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: __on_error() missing 1 required positional argument: 'message'
2021-03-16 18:38:23,316 - ERROR - error from callback <bound method BitMexWs.__on_close of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: __on_close() missing 1 required positional argument: 'ws'
2021-03-16 18:38:24,334 - ERROR - error from callback <bound method BitMexWs.__on_error of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: __on_error() missing 1 required positional argument: 'message'
2021-03-16 18:38:24,334 - ERROR - error from callback <bound method BitMexWs.__on_close of <src.bitmex_websocket.BitMexWs object at 0x0000021C2839A908>>: _on_close() missing 1 required positional argument: 'ws'
Traceback (most recent call last):
File "C:\Users\hwang\Desktop\ebisu\src_init
.py", line 94, in retry
ret, res = func()
File "C:\Users\hwang\Desktop\ebisu\src\bitmex.py", line 119, in
.User.User_getMargin(currency="XBt").result())
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 271, in result
swagger_result = self._get_swagger_result(incoming_response)
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 124, in wrapper
return func(self, *args, **kwargs)
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 303, in _get_swagger_result
self.request_config.response_callbacks,
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 353, in unmarshal_response
raise_on_expected(incoming_response)
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 422, in raise_on_expected
swagger_result=http_response.swagger_result)
bravado.exception.HTTPUnauthorized: 401 Unauthorized: {'error': {'message': 'Invalid API Key.', 'name': 'HTTPError'}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 22, in
bot.run()
File "C:\Users\hwang\Desktop\ebisu\src\bot.py", line 127, in run
logger.info(f"Balance : {self.exchange.get_balance()}")
File "C:\Users\hwang\Desktop\ebisu\src\bitmex.py", line 107, in get_balance
return self.get_margin()["walletBalance"]
File "C:\Users\hwang\Desktop\ebisu\src\bitmex.py", line 118, in get_margin
self.margin = retry(lambda: self.private_client
File "C:\Users\hwang\Desktop\ebisu\src_init_.py", line 112, in retry
raise FatalError(error)
src.FatalError: 401 Unauthorized: {'error': {'message': 'Invalid API Key.', 'name': 'HTTPError'}}
`

AND here is my error when I did " python main.py --strategy TV "

`$ python main.py --strategy TV
2021-03-16 18:41:59,158 - INFO - Bot Mode : Trade
2021-03-16 18:41:59,158 - INFO - Starting Bot
2021-03-16 18:41:59,158 - INFO - Strategy : TV
C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\swagger_spec_validator\validator20.py:53: SwaggerValidationWarning: Found "$ref: #/definitions/UserPreferences" with siblings that will be overwritten. See https://stackoverflow.com/a/48114924 for more information. (path #/definitions/User/properties/preferences)
ref_dict['$ref'], '/'.join(path),
Traceback (most recent call last):
File "C:\Users\hwang\Desktop\ebisu\src_init_.py", line 94, in retry
ret, res = func()
File "C:\Users\hwang\Desktop\ebisu\src\bitmex.py", line 119, in
.User.User_getMargin(currency="XBt").result())
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 271, in result
swagger_result = self._get_swagger_result(incoming_response)
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 124, in wrapper
return func(self, *args, **kwargs)
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 303, in _get_swagger_result
self.request_config.response_callbacks,
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 353, in unmarshal_response
raise_on_expected(incoming_response)
File "C:\Users\hwang\AppData\Local\Programs\Python\Python36\lib\site-packages\bravado\http_future.py", line 422, in raise_on_expected
swagger_result=http_response.swagger_result)
bravado.exception.HTTPUnauthorized: 401 Unauthorized: {'error': {'message': 'Invalid API Key.', 'name': 'HTTPError'}}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 22, in
bot.run()
File "C:\Users\hwang\Desktop\ebisu\src\strategy.py", line 221, in run
logger.info(f"Balance : {self.exchange.get_balance()}")
File "C:\Users\hwang\Desktop\ebisu\src\bitmex.py", line 107, in get_balance
return self.get_margin()["walletBalance"]
File "C:\Users\hwang\Desktop\ebisu\src\bitmex.py", line 118, in get_margin
self.margin = retry(lambda: self.private_client
File "C:\Users\hwang\Desktop\ebisu\src_init_.py", line 112, in retry
raise FatalError(error)
src.FatalError: 401 Unauthorized: {'error': {'message': 'Invalid API Key.', 'name': 'HTTPError'}}
`

everything like this error
I did "source ~/.bash_profile"
and my bash_profile is like this

export BITMEX_TEST_APIKEY=oJ8w4XXXXXXXXXXXXXXXXXXXXXXfhnQ export BITMEX_TEST_SECRET=SvlbbnXXXXXXXXXXXXXXXXXXXXXXXXL2eRI export LINE_APIKEY=Uf252XXXXXXXXXXX22c92d export [email protected]

I really wanna use this bot so can someone help me?

TV Strategy doesn't work

image

Hello,

I have setup everyting and I have placed file as the documentation say
image

How I can troubleshoot ?

Regards

__on_error() missing 1 required positional argument: 'message'

Hey,
after run python main.py --demo --strategy Doten command, it showed the following error

2020-01-23 12:23:59,361 - INFO - Bot Mode : Trade
2020-01-23 12:23:59,363 - INFO - Starting Bot
2020-01-23 12:23:59,363 - INFO - Strategy : Doten
2020-01-23 12:25:14,856 - ERROR - error from callback <bound method BitMexWs.__on_error of <src.bitmex_websocket.BitMexWs object at 0x1370ccb00>>: __on_error() missing 1 required positional argument: 'message'
2020-01-23 12:25:14,856 - ERROR - error from callback <bound method BitMexWs.__on_close of <src.bitmex_websocket.BitMexWs object at 0x1370ccb00>>: __on_close() missing 1 required positional argument: 'ws'
Traceback (most recent call last):
  File "/Users/ywen8/.pyenv/versions/3.6.5/lib/python3.6/site-packages/urllib3/connection.py", line 157, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/Users/ywen8/.pyenv/versions/3.6.5/lib/python3.6/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/Users/ywen8/.pyenv/versions/3.6.5/lib/python3.6/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
TimeoutError: [Errno 60] Operation timed out

has no attribute 'strategy'

~/ebisu$ python3 main.py --strategy strategy
Traceback (most recent call last):
File "/home/ooo/ebisu/src/factory.py", line 16, in create
cls = getattr(strategy, args.strategy)
AttributeError: module 'src.strategy' has no attribute 'strategy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 20, in
bot = BotFactory.create(args)
File "/home/ooo/ebisu/src/factory.py", line 24, in create
raise Exception(f"Not Found Strategy : {args.strategy}")
Exception: Not Found Strategy : strategy

I can't solve this.. help plz

.csv files are missing

would you mind to provide the scripts to generate the .csv files for backtest?

PS: test_bitmex_backtest.py is also failing

hyperopt SMA strategy leaves empty list

Hello, I have managed to get this to run on testnet, great work by the way :)
However, when attempting to use the hyperopt option, the optimum settings don't seem to be added to the list, causing a null object and an error. (at least this is my understanding)

Error below:

2019-09-29 13:09:07,389 - INFO - tpe_transform took 0.002560 seconds
2019-09-29 13:09:07,392 - INFO - TPE using 199/199 trials with best loss inf
2019-09-29 13:09:07,507 - INFO - Params : {'fast_len': 3.0, 'slow_len': 22.0}
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 200/200 [00:18<00:00, 10.63it/s, best loss: ?]
Traceback (most recent call last):
  File "main.py", line 22, in <module>
    bot.run()
  File "/home/linux/build/ta-lib/ebisu/src/bot.py", line 109, in run
    self.params_search()
  File "/home/linux/build/ta-lib/ebisu/src/bot.py", line 99, in params_search
    best_params = fmin(objective, self.options(), algo=tpe.suggest, trials=trials, max_evals=200)
  File "/home/linux/.local/lib/python3.6/site-packages/hyperopt/fmin.py", line 388, in fmin
    show_progressbar=show_progressbar,
  File "/home/linux/.local/lib/python3.6/site-packages/hyperopt/base.py", line 639, in fmin
    show_progressbar=show_progressbar)
  File "/home/linux/.local/lib/python3.6/site-packages/hyperopt/fmin.py", line 409, in fmin
    return trials.argmin
  File "/home/linux/.local/lib/python3.6/site-packages/hyperopt/base.py", line 590, in argmin
    best_trial = self.best_trial
  File "/home/linux/.local/lib/python3.6/site-packages/hyperopt/base.py", line 585, in best_trial
    best = np.argmin(losses)
  File "<__array_function__ internals>", line 6, in argmin
  File "/home/linux/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 1222, in argmin
    return _wrapfunc(a, 'argmin', axis=axis, out=out)
  File "/home/linux/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 58, in _wrapfunc
    return _wrapit(obj, method, *args, **kwds)
  File "/home/linux/.local/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 47, in _wrapit
    result = getattr(asarray(obj), method)(*args, **kwds)
ValueError: attempt to get argmin of an empty sequence

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.