-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1190 from bitholla/develop
Develop
- Loading branch information
Showing
9 changed files
with
99 additions
and
149 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,29 @@ | ||
const HollaEx = require('../index'); | ||
require('dotenv').load(); | ||
|
||
const API_KEY = process.env.API_KEY || ''; | ||
const API_SECRET = process.env.API_SECRET || ''; | ||
const client = new HollaEx({ apiKey: API_KEY, apiSecret: API_SECRET }); | ||
|
||
client | ||
.getTicker('xht-usdt') | ||
.then((res) => { | ||
let data = JSON.parse(res); | ||
console.log('The volume is', data.volume); | ||
}) | ||
.catch((err) => { | ||
console.log(err); | ||
}); | ||
|
||
// connect to websocket | ||
/* | ||
events (emitted) : trades (trades), orderbook (orderbook), user (userInfo, userWallet, userOrder, userTrades, userUpdate), all | ||
symbols : xht-usdt | ||
*/ | ||
|
||
const socket1 = client.connect('trades:xht-usdt'); | ||
|
||
socket1.on('trades', (data) => { | ||
console.log(data); | ||
const Network = require('./index'); | ||
|
||
const network = new Network({ | ||
apiUrl: 'https://api.hollaex.network', | ||
apiKey: '', | ||
apiSecret: '', | ||
activation_code: '', | ||
exchange_id: 1 | ||
}); | ||
|
||
const socket2 = client.connect('all'); | ||
|
||
socket2.on('orderbook', (data) => { | ||
console.log(data); | ||
}); | ||
|
||
// You have to use a token to use these otherwise the socket disconnects | ||
socket2.on('userInfo', (data) => { | ||
console.log(data); | ||
}); | ||
|
||
|
||
setTimeout(() => { | ||
socket2.disconnect(); | ||
}, 5000); | ||
(async () => { | ||
try { | ||
const init = await network.init(); | ||
console.log(init); | ||
console.log(network.exchange_id) | ||
|
||
console.log('connecting to websocket') | ||
network.connect(['orderbook:xht-usdt']); | ||
network.ws.on('message', (data) => { | ||
console.log(data) | ||
}) | ||
|
||
} catch (err) { | ||
console.log(err) | ||
} | ||
|
||
|
||
|
||
}) (); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
{ | ||
"name": "hollaex-tools-lib", | ||
"version": "2.15.0", | ||
"version": "2.2.8", | ||
"description": "HollaEx tools library for developers", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "bitHolla Inc", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/bitholla/hollaex-tools-lib" | ||
"url": "https://github.com/bitholla/hollaex-kit/tree/master/server/utils/hollaex-tools-lib" | ||
}, | ||
"dependencies": {} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters