catalyst icon indicating copy to clipboard operation
catalyst copied to clipboard

Catalyst positions don't match with actual positions on Binance

Open quocble opened this issue 8 years ago • 4 comments

Dear Catalyst Maintainers,

Before I tell you about my issue, let me describe my environment:

Environment

  • Operating System: Linux ip-172-30-0-229 4.4.44-39.55.amzn1.x86_64 #1 SMP Mon Jan 30 18:15:53 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • Python Version: Python 2.7.13 :: Continuum Analytics, Inc.
  • Python Bitness: 64
  • How did you install Catalyst: official conda
  • Python packages:

alembic 0.9.6 backports.functools-lru-cache 1.4 bcolz 0.12.1 boto3 1.5.6 botocore 1.8.20 Bottleneck 1.2.1 ccxt 1.10.319 certifi 2016.2.28 py27_0
certifi 2017.11.5 chardet 3.0.4 click 6.7 contextlib2 0.5.5 cycler 0.10.0 cyordereddict 1.0.0 Cython 0.27.1 decorator 4.1.2 docutils 0.14 empyrical 0.2.1 enigma-catalyst 0.4.0 futures 3.2.0 idna 2.6 intervaltree 2.1.0 jmespath 0.9.3 libgfortran 3.0.0 1
Logbook 1.1.0 lru-dict 1.1.6 Mako 1.0.7 MarkupSafe 1.0 matplotlib 2.1.0 mkl 2017.0.3 0
multipledispatch 0.4.9 networkx 2.0 numexpr 2.6.4 numpy 1.13.1 py27_0
openssl 1.0.2l 0
pandas 0.19.2 pandas-datareader 0.5.0 patsy 0.4.1 pip 9.0.1 py27_1
pyparsing 2.2.0 python 2.7.13 0
python-dateutil 2.6.1 python-editor 1.0.3 pytz 2017.2 readline 6.2 2
requests 2.18.4 requests-file 1.4.2 requests-ftp 0.3.1 s3transfer 0.1.12 scipy 0.19.1 np113py27_0
setuptools 36.4.0 py27_1
six 1.11.0 sortedcontainers 1.5.7 SQLAlchemy 1.1.14 sqlite 3.13.0 0
statsmodels 0.8.0 subprocess32 3.2.7 TA-Lib 0.4.10 tables 3.4.2 tk 8.5.18 0
toolz 0.8.2 urllib3 1.22 wheel 0.29.0 py27_0
zlib 1.2.11 0

Now that you know a little about me, let me tell you about the issue I am having:

Description of Issue

  • What did you expect to happen?

I'm running a live algo against Binance. The positions are always greater than the actual positions on Binance, and this causes the sell to fail.

Actual differences:

Catalyst: wings_btc 4019 (Binance: 4014) gto_btc 17076 (Binance: 17059) wtc_btc 467 (Binance: 466) cdt_btc 32088 (Binance: 32055)

Here is how you can reproduce this issue on your machine:

Reproduction Steps

  1. Run live trading
  2. Make at least one buy
  3. Sell will fail on amount greater than actual

...

Sincerely, Quoc

quocble avatar Jan 02 '18 04:01 quocble

What are the differences? Binance orders will round up to the lot size. The amount of the order and transaction objects will correspond to the amount sent to Binance. On Mon, Jan 1, 2018 at 8:32 PM Quoc Le [email protected] wrote:

Dear Catalyst Maintainers,

Before I tell you about my issue, let me describe my environment: Environment

  • Operating System: Linux ip-172-30-0-229 4.4.44-39.55.amzn1.x86_64 #1 https://github.com/enigmampc/catalyst/pull/1 SMP Mon Jan 30 18:15:53 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • Python Version: Python 2.7.13 :: Continuum Analytics, Inc.
  • Python Bitness: 64
  • How did you install Catalyst: official conda
  • Python packages:

packages in environment at /home/ec2-user/anaconda2/envs/catalyst:

alembic 0.9.6 backports.functools-lru-cache 1.4 bcolz 0.12.1 boto3 1.5.6 botocore 1.8.20 Bottleneck 1.2.1 ccxt 1.10.319 certifi 2016.2.28 py27_0 certifi 2017.11.5 chardet 3.0.4 click 6.7 contextlib2 0.5.5 cycler 0.10.0 cyordereddict 1.0.0 Cython 0.27.1 decorator 4.1.2 docutils 0.14 empyrical 0.2.1 enigma-catalyst 0.4.0 futures 3.2.0 idna 2.6 intervaltree 2.1.0 jmespath 0.9.3 libgfortran 3.0.0 1 Logbook 1.1.0 lru-dict 1.1.6 Mako 1.0.7 MarkupSafe 1.0 matplotlib 2.1.0 mkl 2017.0.3 0 multipledispatch 0.4.9 networkx 2.0 numexpr 2.6.4 numpy 1.13.1 py27_0 openssl 1.0.2l 0 pandas 0.19.2 pandas-datareader 0.5.0 patsy 0.4.1 pip 9.0.1 py27_1 pyparsing 2.2.0 python 2.7.13 0 python-dateutil 2.6.1 python-editor 1.0.3 pytz 2017.2 readline 6.2 2 requests 2.18.4 requests-file 1.4.2 requests-ftp 0.3.1 s3transfer 0.1.12 scipy 0.19.1 np113py27_0 setuptools 36.4.0 py27_1 six 1.11.0 sortedcontainers 1.5.7 SQLAlchemy 1.1.14 sqlite 3.13.0 0 statsmodels 0.8.0 subprocess32 3.2.7 TA-Lib 0.4.10 tables 3.4.2 tk 8.5.18 0 toolz 0.8.2 urllib3 1.22 wheel 0.29.0 py27_0 zlib 1.2.11 0

Now that you know a little about me, let me tell you about the issue I am having: Description of Issue

  • What did you expect to happen?

I'm running a live algo against Binance. The positions are always greater than the actual positions on Binance, and this causes the sell to fail.

Actual differences:

Catalyst: wings_btc 4019 (Binance: 4014) gto_btc 17076 (Binance: 17059) wtc_btc 467 (Binance: 466) cdt_btc 32088 (Binance: 32055)

Here is how you can reproduce this issue on your machine: Reproduction Steps

  1. Run live trading
  2. Make at least one buy
  3. Sell will fail on amount greater than actual

...

Sincerely, $ whoami

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/enigmampc/catalyst/issues/132, or mute the thread https://github.com/notifications/unsubscribe-auth/ABZ-Qj87n7Q4LlG3erPxT1Ogf9JmiwL3ks5tGbFwgaJpZM4RQSFz .

fredfortier avatar Jan 02 '18 07:01 fredfortier

@fredfortier - I don't know the root cause. I suspect binance take off some from the order for commission, so the value stored on catalyst is larger than the values on binance. As a result, Sell order against the amount will fail.

Maybe it's better to sync the portfolio amounts as well.?

quocble avatar Jan 02 '18 08:01 quocble

I believe that this is resolved in the dev version. We currently sync the amount held in the exchange wallet with if lower than the position amount tracked by each algo. This enables you to run multiple algos at once or do manual trading on the same wallet, just as long as you keep enough position to cover the algo and avoid this issue. We'll plan to issue a release tomorrow as we have accumulated several worthwhile fixes and enhancements.

fredfortier avatar Jan 03 '18 08:01 fredfortier

Please reopen if it's still happening in version 0.4.2.

fredfortier avatar Jan 04 '18 21:01 fredfortier