Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 12
},
"rules": {
"space-before-function-paren": ["error", "always"]
}
}
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: node_js
node_js:
- 10
Comment on lines +1 to +3
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added .travis.yml, so now you can integrate it with TravisCI and it will run the whole set of tests with every PR.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ see `example.js` for more details
smartTradesCreateSmartTrade (params)

smartTrades ()

smartTradesV2 ()

smartTradesStepPanicSell (params)

Expand Down
3 changes: 3 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
API_URL: 'https://api.3commas.io'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved API_URL attributes into its own file (primarily for easier testing)

}
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict'
const querystring = require('querystring');
const crypto = require('crypto')
const fetch = require('node-fetch')
const crypto = require('crypto');
const fetch = require('node-fetch');
const { API_URL } = require('./config');

const API_URL = 'https://api.3commas.io'

class threeCommasAPI {
constructor(opts = {}) {
constructor (opts = {}) {
this._url = opts.url || API_URL
this._apiKey = opts.apiKey || ''
this._apiSecret = opts.apiSecret || ''
Expand Down Expand Up @@ -40,7 +40,7 @@ class threeCommasAPI {

return await response.json()
} catch (e) {
console.log(e);
console.error(e);
return false
}
}
Expand Down Expand Up @@ -168,7 +168,7 @@ class threeCommasAPI {
async smartTradesV2 (params) {
return await this.makeRequest('GET', `/public/api/v2/smart_trades?`, params)
}

async smartTradesStepPanicSell (params) {
return await this.makeRequest('POST', `/public/api/ver1/smart_trades/${params.smart_trade_id}/step_panic_sell?`, params)
}
Expand Down
Loading