Skip to content
This repository has been archived by the owner on Jan 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1 from Kartax/develop
Browse files Browse the repository at this point in the history
1.0.1, cleanup and documentation
  • Loading branch information
Kartax committed Apr 3, 2020
2 parents 5915d6b + 160ffd1 commit 0d9f989
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
[![NPM version](http://img.shields.io/npm/v/iobroker.binance.svg)](https://www.npmjs.com/package/iobroker.binance)
[![Downloads](https://img.shields.io/npm/dm/iobroker.binance.svg)](https://www.npmjs.com/package/iobroker.binance)
![Number of Installations (latest)](http://iobroker.live/badges/binance-installed.svg)
![Number of Installations (stable)](http://iobroker.live/badges/binance-stable.svg)
[![Dependency Status](https://img.shields.io/david/Kartax/iobroker.binance.svg)](https://david-dm.org/Kartax/iobroker.binance)
[![Known Vulnerabilities](https://snyk.io/test/github/Kartax/ioBroker.binance/badge.svg)](https://snyk.io/test/github/Kartax/ioBroker.binance)

[![NPM](https://nodei.co/npm/iobroker.binance.png?downloads=true)](https://nodei.co/npm/iobroker.binance/)


# ioBroker.binance

Adapter to communicate with the crypt trading platform binance
Expand Down
7 changes: 6 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"common": {
"name": "binance",
"version": "1.0.0",
"version": "1.0.1",
"news": {
"1.0.1": {
"en": "Documentation adjustments",
"de": "Anpassung Dokumentation"
},
"1.0.0": {
"en": "Initial release",
"de": "Erstveröffentlichung"
Expand All @@ -21,6 +25,7 @@
"Kartax <kartax@cuntz.org>"
],
"keywords": [
"binance",
"crypto",
"trading",
"bitcoin",
Expand Down
8 changes: 5 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class Binance extends utils.Adapter {
* The main update method
*/
main() {
this.log.info('main');
this.requestPrices();
if (this.config.apiKey && this.config.apiKeySecret) this.requestAccount();
}
Expand All @@ -46,12 +45,13 @@ class Binance extends utils.Adapter {
*/
requestPrices() {
this.log.info('requestPrices');

request(
{
url: ENDPOINT_PRICE,
json: true,
time: true,
timeout: this.config.interval - 2000
timeout: 5000
},
(error, response, content) => {
if (!error) {
Expand All @@ -77,6 +77,7 @@ class Binance extends utils.Adapter {
} else if (response.statusCode == 418 || response.statusCode == 429) {
// we need to back off
this.log.warn('need to back off');
// TODO

} else {
// unexpected
Expand All @@ -95,13 +96,14 @@ class Binance extends utils.Adapter {
* Request account
*/
requestAccount() {
this.log.info('requestAccount');

const timestamp = Date.now();
const queryString = 'timestamp=' + timestamp;
const signature = hmacSHA256(queryString, this.config.apiKeySecret);

this.log.info(ENDPOINT_ACCOUNT + '?' + queryString + '&signature=' + signature);

this.log.info('requestAccount');
request(
{
url: ENDPOINT_ACCOUNT + '?' + queryString + '&signature=' + signature,
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.binance",
"version": "1.0.0",
"version": "1.0.1",
"description": "Adapter to communicate with the crypt trading platform binance",
"author": {
"name": "Kartax",
Expand All @@ -9,6 +9,7 @@
"homepage": "https://github.com/Kartax/ioBroker.binance",
"license": "MIT",
"keywords": [
"binance",
"crypto",
"trading",
"bitcoin",
Expand Down

0 comments on commit 0d9f989

Please sign in to comment.