AEX WSS issue

Author: flyju, Created: 2020-03-20 20:51:12, Updated:

AEX Exchange I tried all the methods in the documentation and I can't get the data from WSS. The data is empty. I'm a beginner and I've been working hard all day. AEX WSS documentationhttps://github.com/aextech/websocket-api-doc/blob/master/README.md


More

The grassLook carefully at the tutorials, there are many examples, and you should also have an overseas host.

The grass /upload/asset/2f6f67e25a076fcecf6.png

The grassLet's test it out. What's up? function main (() { var client = Dial (("wss://api.aex.zone/ws/v1"); client.write (('{"cmd": {"type": 2}, "type": 1, "pairs": [{ "market": "cnc", "coin": "btc" }]}') while (true) { var msg = client.read ()) var data = JSON.parse ((msg) // parses the json string as an object that can be referenced Log ((data)) // processing of data data I'm not sure. I'm not sure. What's up?

The grassHave you seen the tutorial on how to connect to the forum?

The grassYes, you can.

flyjuTry data = JSON.parse ((msg)) I'm not sure. catch (err) { Log ((err.message)) I'm not sure. Is that so?

The grassYou can try it out, or you can try catch to see if you get the wrong message.

flyjuSyntax error: invalid json (at offset 1) at main (__FILE__:27) and interrupted JSON cannot handle the data that was obtained by the error prompts that should be client.read (()) error. Can I write this error? var data = JSON.parse ((msg)) if (!data) { is the data = JSON.parse ((msg)) I'm not sure.

flyjuI'm going to try to make sure that it's stable, and I'm going to try to make sure that it's running. Thank you very much. You've been so patient.

The grassThe data is stored in a dictionary structure (actually an object).

flyjuSo I get it, after judging the statement, the object that assigns the data data value to the global variable data, right?

flyjuI'm sorry, I don't understand. What is the purpose of setting this global variable data? What is the structure of the data variable?

The grassIt's not that complicated, setting a global variable data = {btc:{buy:0,buyamout:0},eth:{buy:0,buyamout:0}} before the main function.

flyjufunction main (() { var client = Dial (("wss://api.aex.zone/ws/v1 in order to reconnect=true"); The client.write (('{"cmd": {"type": 2}, "type": 1, "pairs": [{ "market": "cnc", "coin": "eth" }]}') while (true) { var msg = client.read (); var data = JSON.parse ((msg)) var type = data.cmd.type is used if (type === 1) { var CNCBuy = data.bids[0].price var CNCBuyamount = data.bids[0].amount var CNCSell = data.asks[0].price This is a list of all the different ways CNCSell is credited in the database. var CNCSellamount = data.asks[0].amount This is a list of all the different ways CNCSellamount is credited in the database. I'm not sure. Log ((CNCBuy)) /* can't call variables across domains and if you focus on multiple transaction pairs and need to judge other conditions to filter data, it involves subsequent transaction logic judgments. I'm not sure. I'm not sure.

The grassIf you're going to do a bit of research, you're going to have to think about whether or not you're going to be able to get the data back.

flyjuUnable to extract object from bids array var bids = data.bids[0] Error TypeError: cannot read property 0 of undefined at main (__FILE__:9) exchange.GetDepth ((); the depth data obtained can be

flyjuIt turns out that this is how it is, it helped me a lot, thank you very much. (bow) The official documentation of AEX is really rubbish, it's not clear what you mean.

flyjuThe logs are either blank, or there's no depth data, and the documentation doesn't say anything about data being compressed. function main (() { var client = Dial (("wss://api.aex.zone/ws/v1") var msg = client.read ()) //var data = JSON.parse (msg) //var data = JSON.parse (msg) //var data = JSON.parse (msg) //var data = JSON.parse (msg) //var data = JSON.parse (msg) //var data is the most commonly used form of data Log ((client)) Log (((msg)) //Log ((data) is the name of the file I'm not sure. The client has an error processing JSON.parse for empty msg as {}

flyjuThe logs are either blank, or there's no depth data, and the documentation doesn't say anything about data being compressed.

The grassDo you want to focus on trading first?

The grassCheck to see if there are no updates.

flyjuYou can send any request you want, but deep data doesn't need to be sent, and the link in the documentation will return deep data.

flyjuI've tried using the tutorials and the documentation to do all the other sending commands, but getting deep data doesn't require sending commands, and I don't know how to do that.

The grassDid you send the request?

flyjuI'm looking at dial and other exchanges can link and get the data back AEX can link but the data back is empty and can't be processed in JSON I don't know where the problem is