uaktags / iquidus-explorer-exchanges

Repository of exchanges
BSD 3-Clause "New" or "Revised" License
2 stars 7 forks source link

Graviex v3 update #4

Open koentjeappel opened 4 years ago

koentjeappel commented 4 years ago

I believe this is outdated since this api call: function get_orders(coin, exchange, cb) { var req_url = base_url + '/order_book.json?market=' + coin.concat(exchange).toLowerCase();

this link as example: https://graviex.net/api/v3/order_book.json?market=pacbtc gives:{"error":{"code":1001,"message":"access_key is missing, tonce is missing, signature is missing"}}

I believe this is because when it was created it didnt require access key and tonce etc.

Is this correct or am i just doing something wrong?

koentjeappel commented 4 years ago

Is this true or am i just doing something wrong?

Can you please help me @uaktags ?

uaktags commented 4 years ago

Hey, using v3 definitely will need a recode. I started looking into this but haven't gotten far yet. I should have a solution today, but their way of dealing with access keys is a PITA

uaktags commented 4 years ago

So i'm not sure how cleanly this will work with Iquidus, but it atleast works using the test.js. My guess is there will probably be issues with settings from the market itself. Still a little more to test out.

koentjeappel commented 4 years ago

Thanks for looking into this!

will wait until you think its all good :)

uaktags commented 4 years ago

Okay, so it appears, until we get i18 added into official, some edits are needed to the pugs. I'll use gist for now until i rework this repo. I have it working on my end with official iquidus master.

uaktags commented 4 years ago

https://gist.github.com/uaktags/12bb37b098a6e08413dbe3fe7ce8ec1c

That should get you going. That's v2. I'll look into v3 soon.

koentjeappel commented 4 years ago

So if i add the graviex.js and add it the required to the database.js and change the settings.json it should work?

uaktags commented 4 years ago

Correct, add graviex.js, graviex.pug, add the snippet to database.js, and add in the graviex_* fields to settings.json. Then you can do node scripts/sync.js market and you'll be off to the races (knock on wood)

koentjeappel commented 4 years ago

Thanks will try it later, somehow im my latest restart i removed the data from the richlist or something. but i see that the sync.js index update is running so im guessing its pulling the data for the rich list now https://eu.pacglobalexplorer.com/richlist

koentjeappel commented 4 years ago

It works :) the info gets pulled and shown in the price tab. But the market tab shows this:

/root/explorer/views/markets/graviex.pug:8 6| .card.card-default 7| .card-header > 8| strong= t('market.market_title',{market : t('exchange.graviex'),coin : marketdata.coin, exchange : marketdata.exchange }) 9| a(href='#') 10| span.fa.fa-line-chart.pull-right.view-chart-disabled.iquidus.market-toggle(data-toggle='tooltip', data-placement='bottom', title= t('market.no_chart')) 11| table.table.table-bordered.summary-table t is not a function

So i will disable the markets tab

koentjeappel commented 4 years ago

Hello,

I have been using just the price on our explorer. pacglobalexplorer.com

But it started erroring when doing nodejs scripts/sync.js market

This is the error: root@Explorergood:~/explorer# nodejs scripts/sync.js market script launched with pid: 5742 send request to - https://graviex.net/api/v2/order_book.json?access_key=KEYHIDDEN&market=pacbtc&signature=099908f0eea50718fc367bb1db230ce8cba1ed260dac3f29cd8b9a7be877d131&tonce=1599921378214 error code: 1020 /root/explorer/lib/markets/graviex.js:82 if (buyorders.length > 0){ ^

TypeError: Cannot read property 'length' of undefined at Request._callback (/root/explorer/lib/markets/graviex.js:82:25) at Request.self.callback (/root/explorer/node_modules/request/request.js:185:22) at Request.emit (events.js:315:20) at Request. (/root/explorer/node_modules/request/request.js:1154:10) at Request.emit (events.js:315:20) at IncomingMessage. (/root/explorer/node_modules/request/request.js:1076:12) at Object.onceWrapper (events.js:421:28) at IncomingMessage.emit (events.js:327:22) at endReadableNT (_stream_readable.js:1221:12) at processTicksAndRejections (internal/process/task_queues.js:84:21)

Do you know what the problem is?

uaktags commented 4 years ago

It's saying that but orders doesn't exist. So check if body contains any bids:

buyorders = body['bids']; So if buyorders is undefined, something isn't returning from that api correctly

longvic0 commented 2 years ago

Hi @uaktags , I'm looking for the modification for the explorer, work with graviex.net v2. Follow your instruction (https://gist.github.com/uaktags/12bb37b098a6e08413dbe3fe7ce8ec1c) I've already added : graviex.js to lib/markets/ ; graviex.pug to views/markets/ . and setting.json-snippet . add to lib/database.js , graviex = require('./markets/graviex') When I run to update : nodejs scripts/sync.js market , I met an error message: `nodejs scripts/sync.js market script launched with pid: 842 events.js:183 throw er; // Unhandled 'error' event ^

TypeError: coin.concat is not a function at get_summary (/home/exp/explorer/lib/markets/graviex.js:6:33) at Object.get_data (/home/exp/explorer/lib/markets/graviex.js:47:9) at get_market_data (/home/exp/explorer/lib/database.js:167:14) at Object.update_markets_db (/home/exp/explorer/lib/database.js:658:5) at /home/exp/explorer/scripts/sync.js:239:20 at /home/exp/explorer/lib/database.js:474:16 ` Please help me, Thanks

uaktags commented 2 years ago

If you're getting coin.concat is not a function then that's telling me that "coin" is undefined. You shouldn't need the graviex = require( if you're on the latest version of iquidus. As we use https://github.com/iquidus/explorer/blob/5f33fea620701db019f4bd4dae28bc0e28a53a67/lib/database.js#L163-L172

The gist itself, too, is out of date. Change these lines: https://gist.github.com/uaktags/12bb37b098a6e08413dbe3fe7ce8ec1c#file-graviex-js-L117-L130 to be similar to whats in the markets currently on iquidus: https://github.com/iquidus/explorer/blob/5f33fea620701db019f4bd4dae28bc0e28a53a67/lib/markets/ccex.js#L122-L134

It should look SOMETHING (not tested) like this:

get_data: function(settings, cb) {
    var error = null;
    get_orders(settings.coin, settings.exchange, function(err, buys, sells) {
     if (err) { error = err; }
      get_trades(settings.coin, settings.exchange, function(err, trades) {
        if (err) { error = err; }
        get_summary(settings.coin, settings.exchange,  function(err, stats) {
          if (err) { error = err; }
          //return cb(error, {buys: buys, sells: sells, chartdata: [], trades: trades, stats: stats});
          return cb(error, {buys: buys, sells: sells, chartdata: [], trades: trades, stats: stats});
        });
      });
    });
  }

see how that fairs for you if you're on the latest version

longvic0 commented 2 years ago

Thank you @uaktags , It works perfectly with graviex v2 api