rentorm / 3commas-api-node

NodeJS wrapper for Official 3commas API
GNU General Public License v3.0
43 stars 28 forks source link

Add possibility of forcing paper or real mode in the headers #20

Closed papegaill closed 3 years ago

papegaill commented 3 years ago

To fix issue: https://github.com/rentorm/3commas-api-node/issues/19 To be able to force 'paper' or 'real' mode account, like so:

const api = new threeCommasAPI({
  apiKey: '',
  apiSecret: '',
  forceMode: 'paper'
});
richjenks commented 3 years ago

Tested this (because I really want it to be available) and found if you omit the forcedMode option you get an error.

Is it sending the header with an empty value, which the API is interpreting as invalid, when it shouldn't be sending the header at all (in which case it'll sync it with the web app as per https://github.com/3commas-io/3commas-official-api-docs/#api-modesreal-or-paper)?

Code example:

const threeCommasAPI = require('./3commas-api-node')

dotenv.config()
const tc = new threeCommasAPI({
    apiKey:    API_KEY,
    apiSecret: API_SECRET,
    // forcedMode: 'real',
})

tc
.getBots()
.then(bots => {
    console.log(bots)
})
.catch(error => console.log(error))

Output:

{
  error: 'forced_mode_invalid',
  error_description: "Forced mode is not included in the ['real', 'paper']"
}