DeviaVir / zenbot

Zenbot is a command-line cryptocurrency trading bot using Node.js and MongoDB.
MIT License
8.23k stars 2.03k forks source link

Can't get Altcoin/BTC pair to display properly on graph #20

Closed JFD3D closed 8 years ago

JFD3D commented 8 years ago

Hello,

I have been trying to get altcoins to graph properly for about a week now. I've tried many different settings in exchange.js for multiple pairs on both Bitfinex and Poloniex and while zenbot will pull the data correctly, pull and plot volume data and even report good/accurate sell/buy indicators (which are actually on the graph) I can't seem to get the price data to plot properly. I also noticed that any Altcoin/BTC coin will not work at all unless BTC is added as a "currency" which makes sense.

I even tried RDash21's settings from pull request #19 without any success. I was able to get something after a while but it only plots the 3rd of August. The USD pairs show volumes and plots prices almost instantly after running zenbot while the BTC pairs only show volume. Also the log/graph is only showing 0.003 decimal instead of the exact price. I figured I would ask here before I dug deeper.

As of right now the BTC pair graph looks like this: etc-btc

While the USD pairs display properly as seen below: etc-usd btc-usd

I have tried many different settings in both config.js and exchange.js with many different pairs and have not found a solution. Am I doing something wrong or is this not implemented yet?

config.js pair settings:

c.assets = [
  "BTC",
  "ETC",
  //"ETH",
  //"LTC"
]
c.currencies = [
  //"CNY",
  //"EUR",
  "USD",
  "BTC"
]
c.enabled_plugins = [
  //"bitfinex",
  //"gdax",
  "poloniex",
  "server"
]

Poloniex exchange.js pair settings (produced the graph from above):

    {
      "id":"USDT_ETC",
      "asset":"ETC",
      "currency":"USD",
      "min_size":0.01,
      "max_size":10000,
      "increment":0.01,
      "label":"USDT/ETC"
    },
    {
      "id":"BTC_ETC",
      "asset":"ETC",
      "currency":"BTC",
      "min_size":0.01,
      "max_size":10000,
      "increment":0.00001,
      "label":"BTC/ETC"
    },

I have been watching this project since you announced 3.x and I'm loving it so far. I was actually working on my own ML bot based off of Gekko and pyTrader when I found it :) I'm looking forward to contributing in anyway I can. I am working on getting Bitfinex and Poloniex live trading but I'm not confident it will perform as expected without knowing zenbot is seeing the right prices.

Any help with this issue would be much appreciated. Thanks.

carlos8f commented 8 years ago

interesting, I will investigate in the next couple days. I have been launching 3.x a little ahead of schedule because 2.x started to break, and frantically fixing things today, lol. I trade on GDAX so that is where my code starts, but I will go back and update bitfinex / poloniex plugins next, based on 3.1 which I released today.

Cheers, Carlos

JFD3D commented 8 years ago

Thanks for the prompt response. You've been committing like a mad-man! Mad respect. I am excited to watch this project grow and I will let you know if I find anything else of interest.

ghostnegotiator commented 8 years ago

@JFD3D hello there,

The pull is not complete yet* please don't use it yet... still work in progress till the Poloniex exchange is fixed. I am currently adding them so @carlos8f has less fingerbleed from writing all those crypto coins.

Yours Faithfully, RDash

JFD3D commented 8 years ago

Hello @RDash21, looks like your pull request just got merged :) That makes sense. I noticed that your settings for "min_size", "max_size", and "increment" are much different than what I have. Have you been able to get any BTC pair to graph properly yet? Oh and it looks like ETC is in there 3 times in a row.

Also @carlos8,f I noticed the max size for ETH is 100000 as opposed to 10000 for other coins in your gdax exchange.js. Is this due to volume or because of the price difference?

Thanks, JFD3D

ghostnegotiator commented 8 years ago

Thanks for the find on the ETC! Going to update it now :+1:

Probably an error on my side for not seeing it (Hence for being uncle and having a 11 Months niece!)

Going to fix it asap!

JFD3D commented 8 years ago

@RDash21 Also USDT pairs are missing, I have these:

    {
      "id":"USDT_BTC",
      "asset":"BTC",
      "currency":"USD",
      "min_size":0.01,
      "max_size":10000,
      "increment":0.01,
      "label":"USDT/BTC"
    },
    {
      "id":"USDT_DASH",
      "asset":"DASH",
      "currency":"USD",
      "min_size":0.01,
      "max_size":100000,
      "increment":0.01,
      "label":"DASH/USD"
    },
    {
      "id":"USDT_ETC",
      "asset":"ETC",
      "currency":"USD",
      "min_size":0.01,
      "max_size":10000,
      "increment":0.00001,
      "label":"ETC/USD"
    },
    {
      "id":"USDT_ETH",
      "asset":"ETH",
      "currency":"USD",
      "min_size":0.01,
      "max_size":100000,
      "increment":0.01,
      "label":"ETH/USD"
    },
    {
      "id":"USDT_LTC",
      "asset":"LTC",
      "currency":"USD",
      "min_size":0.01,
      "max_size":10000,
      "increment":0.01,
      "label":"LTC/USD"
    },

Not sure if ETC needs "increment":0.00001, as opposed to "increment":0.01, or another value entirely but it looks like it's working. This might make it more accurate but I haven't had the time to dig through and figure out how the graph and zenbrain uses these values. Also you should remove the comma at the end of the list as it causes zenbrain to throw an error since it is expecting more pairs. Hope this helps.

ghostnegotiator commented 8 years ago

I am aware that Poloniex USDT Currencies are missing and also quite some other crypto coins. Still working on adding them all which is a HUGE list. Poloniex does accept 0.0001 on most currencies and some requires 0.01 for trading. hopefully @carlos8f got some good feedback regarding that?.

@carlos8f what do you think of doing as 'minimal' trade?

Yours Faithfully, RDash

JFD3D commented 8 years ago

Oh and you need to add BTC as a "currency" in config.js and switch asset and currency in polo's exchange.js, for example:

      "asset":"ETC",
      "currency":"BTC",

Otherwise it will not work at all.

ghostnegotiator commented 8 years ago

@JFD3D thanks for noticing, fixing it tonight :)

ghostnegotiator commented 8 years ago

@JFD3D looks like I got to work on it as soon as possible. It will be fixed by tonight including USDT will be added. Thank you for noticing :)

ghostnegotiator commented 8 years ago

Working on it... check out PR #23 (Note: it is still work in progress.. :+1: )

carlos8f commented 8 years ago

ok, as of now zenbot master branch has working poloniex, kraken, and bitfinex code. see https://zenbot.s8f.org/ for some new exchange/pair graphs including ETH, LTC and EUR.

carlos8f commented 8 years ago

also note that bitfinex doesn't have a backfill API, so we can't pull historical trades to populate the graph.

JFD3D commented 8 years ago

After a lot of digging around I found the problem and fixed the Altcoin Graph's :)

The issue was in plugins/server/controllers/data.js where the data was being written with too few decimals causing the graphs to have no open/close data to read from for anything with a sub 0.01 value. This is why the candlesticks/indicators weren't showing up properly even though the trade arrows were on the accurate price.

fix