Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Bitfinex live trading not working #695

Closed
dentatar opened this issue Nov 9, 2017 · 25 comments
Closed

Bitfinex live trading not working #695

dentatar opened this issue Nov 9, 2017 · 25 comments
Labels

Comments

@dentatar
Copy link

dentatar commented Nov 9, 2017

Hello. I got an issue with live trading on Bitfinex. The bot just cant't perform any action, even manually executed orders won't work. I'm using --debug option and there is no errors, only "WebSockets: We are now fully connected and authenticated." after starting the bot. The price is also not updating.

Some additional info:
-API permissions is alright, i checked them several times. Orders have write permission and everything else is readonly.
-Paper mode and sim works fine.
-Pair is ETH-USD.
-NodeJS version is 8.8.1.

@morey-tech
Copy link

I'm having the same issue. In live trading, it won't make any trades even when manually telling it to buy/sell. I had run it in live with the debug option and received no errors. Making trades on Bitfinex works when using 'zenbot buy/sell'. The pair I tried is LTC-BTC. Though the price is updating fine for me.

@nedievas
Copy link
Contributor

No issue with LTC-BTC.
capture
What strategy are you using?

@dentatar
Copy link
Author

Im using MACD. Not working either with default options or overrided options.

@nedievas
Copy link
Contributor

Have you refreshed products.json?

@dentatar
Copy link
Author

Yes i refreshed it

@nedievas
Copy link
Contributor

You should adjust buy_pct to no more than 90%.

@dentatar
Copy link
Author

dentatar commented Nov 10, 2017

This is my current options:

{
    max_sell_loss_pct: '5',
    down_trend_threshold: -0.25,
    up_trend_threshold: 0.25,
    order_adjust_time: 5000,
    debug: true,
    strategy: 'macd',
    sell_stop_pct: 0,
    buy_stop_pct: 0,
    profit_stop_enable_pct: 0,
    profit_stop_pct: 1,
    max_slippage_pct: 5,
    buy_pct: 99,
    sell_pct: 99,
    order_poll_time: 5000,
    markup_pct: 0,
    order_type: 'maker',
    poll_trades: 30000,
    currency_capital: 1000,
    asset_capital: 0,
    rsi_periods: 25,
    avg_slippage_pct: 0.045,
    stats: true,
    mode: 'live',
    selector: 'bitfinex.ETH-USD',
    period: '1h',
    min_periods: 52,
    ema_short_period: 12,
    ema_long_period: 26,
    signal_period: 9,
    overbought_rsi_periods: 25,
    overbought_rsi: 70
}

@nedievas
Copy link
Contributor

long period...

@dentatar
Copy link
Author

But when i use paper mode I can see price updates several times in a minute and can execute sell/buy immediately. Live mode just updates the price once an hour and doesn't do anything :\

@dentatar
Copy link
Author

Just tried ETH-BTC pair with no luck.

@dentatar
Copy link
Author

@nedievas I tried LTC-BTC pair and it works fine lol. Checked my products.json for eth/usd:

  {
    "asset": "ETH",
    "currency": "USD",
    "min_size": "0.04",
    "max_size": "5000.0",
    "increment": "0.0001",
    "label": "ETH/USD"
  },

@nedievas
Copy link
Contributor

It is your side issue. Sorry ;)

@dentatar
Copy link
Author

Maybe, but can you give any advice? I'm not the only one with that problem :(

@nedievas
Copy link
Contributor

search for different points: maybe it's period, 100% buy...

@emseee
Copy link

emseee commented Nov 23, 2017

Having the same issue on Bitfinex. Trades perfectly fine on poloniex though.
bitfinex

@dentatar
Copy link
Author

Any pair works fine except eth/usd...

@nedievas
Copy link
Contributor

refresh products.js by executing update-products.sh. Bitfinex updates minimal orders every week!

@emseee
Copy link

emseee commented Nov 23, 2017

Thank you @nedievas trying to do so now but when executing ./update-products.sh I get -bash: ./update-products.sh: Permission denied
Can you please advise?

Thanks

@nedievas
Copy link
Contributor

ls -l to check permissions

@emseee
Copy link

emseee commented Nov 24, 2017

@nedievas that's what I got:
-rw-rw-r-- 1 myusername myusername 130 Nov 21 19:53 _codemap.js
-rw-rw-r-- 1 myusername myusername 15234 Nov 21 19:53 exchange.js
-rw-rw-r-- 1 myusername myusername 5520 Nov 21 19:53 products.json
-rw-rw-r-- 1 myusername myusername 1037 Nov 21 19:53 update-products.sh

@nedievas
Copy link
Contributor

chmod 744 update-products.sh

@dentatar
Copy link
Author

I refreshed products and tried like 10 different pairs. Only pairs with ETH doesn't work... How could it be my side issue?

@kareha
Copy link

kareha commented Jan 7, 2018

I think I found the issue:
syncBalance() in engine.js will not cal the callback if you are in live mode and you have never traded that asset before.

Than, bitfinex will not give you the wallet balance for that asset (see function updateWallet (wallets) {} in exchange.js) The wallets value only has the currencies and assents you have traded before, also if the balance is zero.

The result of that is, that waitForCalc('getBalance', opts, cb) will run forever.

Maybe you can fix that with:

Split up in exchange.js:

else if (
        (ws_walletCalcDone[opts.asset] === false && ws_walletCalcDone[opts.currency] === true) ||
        (ws_walletCalcDone[opts.asset] === true && ws_walletCalcDone[opts.currency] === false)
      ) {
        return waitForCalc('getBalance', opts, cb)
      }

and put in:

else if (ws_walletCalcDone[opts.currency] === true && ws_walletCalcDone[opts.asset] === false) {
   // assume asset has never been traded before
   ws_balance[opts.asset].balance = ws_balance[opts.asset].available = 0
   ws_walletCalcDone[opts.asset] = true
}

.. in getBalance: function (opts, cb) { .. }

Paper mode is not effected because:

    function syncBalance (cb) {
      if (so.mode !== 'live') {
        return cb()
      }
...

@kareha
Copy link

kareha commented Jan 7, 2018

I recognize that after I put console.log('wallets:', wallets) into function updateWallet (wallets) { .. } and all by traded assets were in the array, but not the others (and where I have issues with).

@DeviaVir
Copy link
Owner

Dear issue reporter,

We have slightly changed our github issue policy and would now kindly request folks that have questions that they ask them in our zenbot subreddit.

You can find it here: https://reddit.com/r/zenbot

This issue will be closed, but if you disagree with your ticket being marked as a question feel free to leave a comment defending your case.

Thanks for contributing time and effort!

Greetings,
🤖

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants