zenbot icon indicating copy to clipboard operation
zenbot copied to clipboard

c.order_type='taker' in conf.js not working on Binance

Open leepc12 opened this issue 8 years ago • 9 comments

System information

  • Have I written custom code (as opposed to using zenbot vanilla): Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows Bash (Ubuntu 16.04)
  • Zenbot version (commit ref, or version):
  • Zenbot branch: unstable (pulled latest code at 2/25/2018)
  • NodeJS version:
  • Python version (when using a python script):
  • Exact command to reproduce (include everything):
  • Did I make any changes to conf-sample.js?: Yes

I am testing my own strategy with Zenbot on Binance. My conf.js looks like:

...

// avoid trading at a slippage above this pct
c.max_slippage_pct = 5
// buy with this % of currency balance (WARNING : sim won't work properly if you set this value to 100)
c.buy_pct = 100 //99
// sell with this % of asset balance (WARNING : sim won't work properly if you set this value to 100)
c.sell_pct = 100 //99
// ms to adjust non-filled order after
c.order_adjust_time = 3000
// avoid selling at a loss below this pct set to 0 to ensure selling at a higher price...
c.max_sell_loss_pct = 25
// avoid buying at a loss above this pct set to 0 to ensure buying at a lower price...
c.max_buy_loss_pct = 25
// ms to poll order status
c.order_poll_time = 3000
// ms to wait for settlement (after an order cancel)
c.wait_for_settlement = 3000
// % to mark down buy price for orders
c.markdown_buy_pct = 0
// % to mark up sell price for orders
c.markup_sell_pct = 0
// become a market taker (high fees) or a market maker (low fees)
c.order_type = 'taker'
// when supported by the exchange, use post only type orders.
c.post_only = false

...

I checked my order status on Binance. I specified order_type as taker in conf.js but the bot always makes limit orders and slippage is somtimes > 0.5%.

image

Some market orders on the above image are orders that I made manually.

Maker and taker fees are the same on Binance. So it's always better to make market orders.

leepc12 avatar Mar 01 '18 19:03 leepc12

Check the order_type of the my_trades object at the API endpoint /trades

defkev avatar Mar 01 '18 20:03 defkev

Where is that file located?

Primea1 avatar Mar 02 '18 00:03 Primea1

Point your browser to http://ip.of.your.bot:port/trades

defkev avatar Mar 02 '18 00:03 defkev

It's weird. order_type on the API endpoint says maker.

[{"order_id":"59214030","time":1519954231610,"execution_time":28810,"slippage":0,"type":"buy","size":"0.445704","fee":0,"price":"11113.00","order_type":"maker","cancel_after":"day","id":"b483ef13","_id":"b483ef13","selector":"binance.BTC-USDT","session_id":"e9ef0702","mode":"live"}]

I also added some debugging lines to binance exchange.js

    buy: function (opts, cb) {
      var func_args = [].slice.call(arguments)
      var client = authedClient()
      if (typeof opts.post_only === 'undefined') {
        opts.post_only = true
      }
      opts.type = 'limit'
      process.stdout.write('\nAPI BUY:'+opts.order_type+'\n')

and it says

2018-03-01 17:30:01 - preparing buy order over 0.44570400 BTC of 4953.10 USDT (98.9998178287712%) tradeable balance with a expected fee of 0.00000000 USDT (0%)

2018-03-01 17:30:01 - placing buy order...

API BUY:maker
2018-03-01 17:30:01  11115.00 BTC-USDT   +0.03%        1   64.87 ++      buying  0.00000 BTC  5003.15009114 USDT   +0.00%   -1.54%
2018-03-01 17:30:01 - buy order placed at 11113.00 USDT

buy order completed at 2018-03-01 17:30:31:

0.44570400 BTC at 11113.00 USDT
total 4953.10 USDT
0.0000% slippage (orig. price 11113.00 USDT)
execution: a few seconds

2018-03-01 17:33:00  11131.94 BTC-USDT   +0.18%      293   66.89 +++     bought

I think in c.order_type in conf.js is just ignored?

leepc12 avatar Mar 02 '18 01:03 leepc12

Adding the question as well as the bug label, as I'm questioning if this is a bug at this point.

DeviaVir avatar Mar 02 '18 07:03 DeviaVir

Dump the running config using O in the console and verify its indeed taker

defkev avatar Mar 02 '18 16:03 defkev

same issue, always need to start live trading and type the "T" uppercase for making taker working

araviel avatar Mar 02 '18 16:03 araviel

This is indeed a bug.

c.order_type has no effect, the bot will always start in maker mode unless switched using T

Let me take a look whats broken.

defkev avatar Mar 02 '18 18:03 defkev

I checked that It's fixed in PR #1459. Thanks again @defkev @DeviaVir.

leepc12 avatar Mar 03 '18 23:03 leepc12