SignificantTrades
SignificantTrades copied to clipboard
Exchanges not showing up
I have exchanges not showing up only one from remote clients. If I try locally it's fine, I opened up the dev tools in firefox and network's showing bunch of connection to api's when I connect locally. From remote client there's only 1 connections.. Everything else works. Debian 10.2 (Docker)
Proxy settings maybe, when starting the client in dev mode (npm run serve) webpack starts a proxy server that should allow you to fetch the latest products from exchanges. Open the console tab of chrome and you should see if it can reach exchanges api. If not, maybe the proxyurl is wrong (default is 8080 but you can have another app on your pc that use it) so the significanttrades app run on 8081, you need to change proxyurl to use 8081 as well. Right there :https://github.com/Tucsky/SignificantTrades/blob/master/.env
Hi I have deployed it on Netlify but it fails to fetch data on other exchanges, only Bybit shows up.
From the browser debug console, I noticed this error; net::ERR_CONNECTION_REFUSED.
As you suggested, I have already changed the proxy URL port on .env file, but no way. Any idea what's wrong with Netlify?
I have the same issue. Ive tried setting this up on Digitalocean, both on Apache and Nginx, the same issue persists where only ByBit shows up. Did you ever find a fix?
These are the errors I get in console:
[bitmex] products data expired exchange.js:78 [bitfinex] products data expired exchange.js:78 [binance] products data expired exchange.js:78 [binance_futures] products data expired exchange.js:78 [bitstamp] products data expired exchange.js:78 [gdax] products data expired exchange.js:78 [poloniex] products data expired exchange.js:78 [kraken] products data expired exchange.js:78 [okex] products data expired exchange.js:78 [deribit] products data expired exchange.js:78 [huobi] products data expired exchange.js:78 [hitbtc] products data expired exchange.js:78 [bybit] products data expired exchange.js:78 [ftx] products data expired socket.js:275 [sockets] initializing 14 exchange(s) Chart.vue:156 [chart.mounted] chartController.js:58 [chart/controller] create chart chartController.js:632 [chart/controller] setup queue (500ms) Chart.vue:570 [chart] setup keepalive Chart.vue:214 [chart] fetch (real time range) socket.js:344 [socket.connect] disconnect exchanges asynchronously socket.js:300 [socket.connect] connecting to BTCUSD exchange.js:265 [bitmex] fetching products... Array(1) exchange.js:265 [bitfinex] fetching products... Array(1) exchange.js:265 [binance] fetching products... Array(1) exchange.js:265 [binance_futures] fetching products... Array(1) exchange.js:265 [bitstamp] fetching products... Array(1) exchange.js:265 [gdax] fetching products... Array(1) exchange.js:265 [poloniex] fetching products... Array(1) exchange.js:265 [kraken] fetching products... Array(1) exchange.js:265 [okex] fetching products... Array(3) exchange.js:265 [deribit] fetching products... Array(1) exchange.js:265 [huobi] fetching products... Array(3) exchange.js:265 [hitbtc] fetching products... Array(1) exchange.js:265 [ftx] fetching products... Array(1) test.com/:1 Tracking Prevention blocked a Script resource from loading https://www.google-analytics.com/analytics.js. www.google-analytics.com/analytics.js:1 Failed to load resource: net::ERR_BLOCKED_BY_CLIENT index.js:30 Object "save.." Chart.vue:268 undefined (anonymous) @ Chart.vue:268 localhost:3002/BTCUSD/historical/1611660560000/1611665880167/10000:1 Failed to load resource: net::ERR_CONNECTION_REFUSED localhost:8081/https://www.bitmex.com/api/v1/instrument/active:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch exchange.js:292 [bitmex] received API products response => format products exchange.js:210 [bitmex] unknown pair BTCUSD localhost:8081/https://api.bitfinex.com/v1/symbols:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch exchange.js:292 [bitfinex] received API products response => format products exchange.js:210 [bitfinex] unknown pair BTCUSD localhost:8081/https://api.binance.com/api/v1/ticker/allPrices:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch exchange.js:292 [binance] received API products response => format products exchange.js:210 [binance] unknown pair BTCUSD localhost:8081/https://fapi.binance.com/fapi/v1/exchangeInfo:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch exchange.js:292 [binance_futures] received API products response => format products exchange.js:210 [binance_futures] unknown pair BTCUSD localhost:8081/https://www.bitstamp.net/api/v2/trading-pairs-info/:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch exchange.js:292 [bitstamp] received API products response => format products exchange.js:210 [bitstamp] unknown pair BTCUSD localhost:8081/https://api.pro.coinbase.com/products:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch exchange.js:292 [gdax] received API products response => format products exchange.js:210 [gdax] unknown pair BTCUSD index.js:30 Object "save.." localhost:8081/https://www.poloniex.com/public?command=returnTicker:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch exchange.js:292 [poloniex] received API products response => format products exchange.js:210 [poloniex] unknown pair BTCUSD localhost:8081/https://api.kraken.com/0/public/AssetPairs:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch exchange.js:292 [kraken] received API products response => format products exchange.js:210 [kraken] unknown pair BTCUSD localhost:8081/https://www.okex.com/api/spot/v3/instruments:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch localhost:8081/https://www.okex.com/api/swap/v3/instruments:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch localhost:8081/https://www.okex.com/api/futures/v3/instruments:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch exchange.js:292 [okex] received API products response => format products exchange.js:210 [okex] unknown pair BTCUSD localhost:8081/https://www.deribit.com/api/v1/public/getinstruments:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch exchange.js:292 [deribit] received API products response => format products exchange.js:210 [deribit] unknown pair BTCUSD index.js:30 Object "save.." localhost:8081/https://api.huobi.pro/v1/common/symbols:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch localhost:8081/https://api.hbdm.com/api/v1/contract_contract_info:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch localhost:8081/https://api.hbdm.com/swap-api/v1/swap_contract_info:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch exchange.js:292 [huobi] received API products response => format products exchange.js:210 [huobi] unknown pair BTCUSD localhost:8081/https://api.hitbtc.com/api/2/public/symbol:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch exchange.js:292 [hitbtc] received API products response => format products exchange.js:210 [hitbtc] unknown pair BTCUSD localhost:8081/https://ftx.com/api/markets:1 Failed to load resource: net::ERR_CONNECTION_REFUSED exchange.js:283 TypeError: Failed to fetch exchange.js:292 [ftx] received API products response => format products exchange.js:210 [ftx] unknown pair BTCUSD socket.js:322 [socket.connect] 1 successfully matched with BTCUSD socket.js:331 [socket.connect] batch connect to bybit exchange.js:107 [bybit] connecting... (BTCUSD) index.js:30 Object "save.." chartCache.js:20 [cache/saveChunk] 26/1 14:58:10 26/1 14:58:10 chartCache.js:40 [saveChunk] new cache range 26/1 14:58:10 -> 26/1 14:58:10
When the app starts it fetch the latest products from all exchanges, and need to access exchange REST api to do so. And exchanges do not allow direct request to REST api from browser due to CORS.
Setting PROXY_URL env var with your proxy server will fix that
Exemple in the .env
PROXY_URL=https://cors.aggr.trade/
meaning all the api requests will go through https://cors.aggr.trade which will do the request for you
cors.aggr.trade should work, but please setup your own, especially for production... -> https://github.com/Freeboard/thingproxy
That worked! Thank you Tucsky :) Going to set up my thingproxy!
When the app starts it fetch the latest products from all exchanges, and need to access exchange REST api to do so. And exchanges do not allow direct request to REST api from browser due to CORS.
Setting PROXY_URL env var with your proxy server will fix that Exemple in the .env
PROXY_URL=https://cors.aggr.trade/
meaning all the api requests will go through https://cors.aggr.trade which will do the request for youcors.aggr.trade should work, but please setup your own, especially for production... -> https://github.com/Freeboard/thingproxy
Cors.aggr.trade worked perfectly. I set up my own thingproxy, and tried the following formats in the .env file
PROXY_URL=http://localhost:3000/
and also
PROXY_URL=http://localhost:3000/fetch/
Neither of which seem to work (they work in browser, though, for example this worked in browser: http://myserverip:3000/fetch/https://google.com
But, being set up in the .env file it doesnt seem to work for me
If I may ask, are you using thingproxy as well, did you do some modifications to the configuration file? I wonder if its my configuration blocking something right now in thingproxy.
Hmm I don't see why really, is the app using the proxy url at all or ? (maybe you have another .env that override it ?) I did a test and it is working as expected
PROXY_URL=https://thingproxy.freeboard.io/fetch/
in the .env ^
I figured it out! The issue was on my end: I was using cloudflare, and something got messed up in the process. Once I disabled cloudflare and the use of https, everything started working! :)
@Tucsky I was able to deploy my own version of this on vercel. When I run locally all exchanges worked, and appear to have ws connections. I'm using my own proxy setup at heroku. For some reason bitmex doesn't work but all the other exchanges work on my deployed version. Any thoughts why that might be?
Here's the request that fails with 403.
Also just wanted to give you a heads up on this point, I tried deploying to heroku and for some reason their env variables didn't seem to be working. Was banging my head against the wall and just could not get it working. I ended up just hard coding the proxy url in that vue config file but in case anyone else uses heroku maybe they will see this.
Also this is soooo useful. Thanks for your work.
@blake41 Hard to tell, try look into https://gist.github.com/Tucsky/91060583d326926bbbfef580bb1bdd9e and compare with your proxu, see if there is anything you forgot to pass / remove into the final request
Wow I’m an idiot, totally forgot to look at the proxy logs...will keep debugging there. This proxy server will be helpful to see if there’s something I’m missing. Thanks!
Yup removing those headers in my proxy did it.