abayomi185/simple-pump-and-dump-bot

Syntaxerror node

calamarcus opened this issue ยท 29 comments

Hello! im getting the below error when starting the bot.js with "node bot.js"

'simple-pump-and-dump-bot\node_wip\bot.js:3
import {
^

SyntaxError: Unexpected token {
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Okay, got closer to runinng. im getting to the ANSI text and can select kucoin. after that i get

"(node:576) UnhandledPromiseRejectionWarning: API secrets cannot be validated
(Use node --trace-warnings ... to show where the warning was created)
(node:576) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an
async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node pro
cess on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_
unhandled_rejections_mode). (rejection id: 1)
(node:576) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that ar
e not handled will terminate the Node.js process with a non-zero exit code.
"

Hey, I presume you've installed the node modules?

I put a validity check to throw before getting to the coin input, it seems that's where you're getting an error.

Rename the secrets file to "secrets-kucoin.yaml"

It seems it is still using V1, although i have uncommented the authVersion 2

Could you show me the error?

I used the official SDK hoping they had fully implemented the V2 API

never mind the wrong api url. the important error is the "/api/v1/sub/user?"

(node:14768) UnhandledPromiseRejectionWarning: FetchError: request to https://api.kucoin.io/api/v1/sub/user? failed, reason: connect ETIMEDOUT 75.2.43.232:443
at ClientRequest. (C:\Users\Marcus\simple-pump-and-dump-bot\node_wip\node_modules\node-fetch\lib\index.js:1461:11)
at ClientRequest.emit (events.js:376:20)
at TLSSocket.socketErrorListener (_http_client.js:475:9)
at TLSSocket.emit (events.js:376:20)
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use node --trace-warnings ... to show where the warning was created)
(node:14768) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14768) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

shouldnt it say v2 there when i have uncommented authVersion: 2

if i use your template formatting i get "There has been an error loading your config file
(node:5972) UnhandledPromiseRejectionWarning: Error: Invalid cfg type" when uncommenting the authVersion.

if i move the authVersion one space to the right, the error is instead the API validation error.

Here's the official API wrapper

https://github.com/Kucoin/kucoin-node-sdk

It states it should be 2. The authVersion in the config file should also have no indentation.

From what I can see in the API wrapper, it should handle a V2 key. I didn't test this because I have a V1 key.

image

i just vaildated the yaml for the secrets-kucoin.yanml. running it and still it uses v1 url

perhaps it is same url for both v2

for both v1 and v2 ?

Yes

From what I can tell, not all endpoints are V2 yet. See this API wrapper

https://github.com/escwdev/kucoin-node-api

still get the "(node:10176) UnhandledPromiseRejectionWarning: API secrets cannot be validated" though

Okay. Head into node_wip > src > bot-kucoin.js and comment out line 190. The validity check I put in place.

I used any API call that requires a signature to check in order to validate the connection. You may also want to check the permissions for your API key on Kucoin

(node:13860) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '0' of undefined
at KucoinBot.getquoteCoinBalance (file:///C:/Users/Marcus/simple-pump-and-dump-bot/node_wip/src/bot-kucoin.js:57:134)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async KucoinBot.run (file:///C:/Users/Marcus/simple-pump-and-dump-bot/node_wip/src/bot-kucoin.js:195:5)
(Use node --trace-warnings ... to show where the warning was created)

i have general and trade checked on the api

Sorry, I'm not sure what the issue is at the moment.

I'll be testing with V2 keys soon.

Okay, thanks!

more info that might be interesting.

node --unhandled-rejections=strict --trace-warnings --trace-exit bot
__ __ __
____________ ______ / /_____ / /_ ____ / /_
/ / / / / / __ / / __ _/ __ / __ / /
/ /
/ / / /
/ / /
/ / /
/ // /_____/ // / // / /
_// _, / ./_/_/ /./_/_/
/
__//

? Please select a Crypto Exchange Kucoin
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Kucoin โ”ƒ
โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›
internal/process/promises.js:213
triggerUncaughtException(err, true /* fromPromise */);
^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "API secrets cannot be validated".] {
code: 'ERR_UNHANDLED_REJECTION'
}
(node:14652) WARNING: Exited the environment with code 1
at processPromiseRejections (internal/process/promises.js:213:9)
at processTicksAndRejections (internal/process/task_queues.js:96:32)

Thanks, this is good. Could you comment out "await this.validateAPIConnection()" in the bot-kucoin.js file and try this command again? It is line 239 in the last commit.
I'd like to see what error it throws as my error return is not descriptive of the actual issue.

node --unhandled-rejections=strict --trace-warnings --trace-exit bot
__ __ __
____________ ______ / /_____ / /_ ____ / /_
/ / / / / / __ / / __ _/ __ / __ / /
/ /
/ / / /
/ / /
/ / /
/ // /_____/ // / // / /
_// _, / ./_/_/ /./_/_/
/
__//

? Please select a Crypto Exchange Kucoin
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Kucoin โ”ƒ
โ”—โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”›
? Please select trade configuration? market-trade-one

{
pairing: 'USDT',
order_type: 'market',
buy_qty_from_wallet: 0.5,
profit_margin: 2,
sell_qty_from_wallet: 1,
refresh_interval: 100,
sell_fallback_timeout_ms: 25000
}

file:///C:/Users/Marcus/simple-pump-and-dump-bot/node_wip/src/bot-kucoin.js:64
} balance is ${this.quoteCoinBalance["data"][0]["available"]}\n`
^

TypeError: Cannot read property '0' of undefined
at KucoinBot.getquoteCoinBalance (file:///C:/Users/Marcus/simple-pump-and-dump-bot/node_wip/src/bot-kucoin.js:64:51) at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async KucoinBot.run (file:///C:/Users/Marcus/simple-pump-and-dump-bot/node_wip/src/bot-kucoin.js:244:5)
(node:16188) WARNING: Exited the environment with code 1
at processPromiseRejections (internal/process/promises.js:213:9)
at processTicksAndRejections (internal/process/task_queues.js:96:32)

btw, im actually getting an accountnumber as a result from the validation, so perhaps the problem in further into the code?

Okay, please uncomment line 60 "console.log(this.quoteCoinBalance);" and send the error log again. It should include the server response of your account balance.

Can you confirm that you have funds, (USDT in the default config) in your trading account?

file:///C:/Users/Marcus/simple-pump-and-dump-bot/node_wip/src/bot-kucoin.js:64
} balance is ${this.quoteCoinBalance["data"][0]["available"]}\n`
^

TypeError: Cannot read property '0' of undefined
at KucoinBot.getquoteCoinBalance (file:///C:/Users/Marcus/simple-pump-and-dump-bot/node_wip/src/bot-kucoin.js:64:51)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async KucoinBot.run (file:///C:/Users/Marcus/simple-pump-and-dump-bot/node_wip/src/bot-kucoin.js:244:5)
(node:16976) WARNING: Exited the environment with code 1
at processPromiseRejections (internal/process/promises.js:213:9)
at processTicksAndRejections (internal/process/task_queues.js:96:32)

confirmed 270 usdt is in the trading account

there was no real issue. only a human forgetting the api password

perhaps improbe the error messages a bit.

400001 Any of KC-API-KEY, KC-API-SIGN, KC-API-TIMESTAMP, KC-API-PASSPHRASE is missing in your request header
400002 KC-API-TIMESTAMP Invalid
400003 KC-API-KEY not exists
400004 KC-API-PASSPHRASE error
400005 Signature error
400006 The requested ip address is not in the api whitelist
400007 Access Denied
404000 Url Not Found
400100 Parameter Error
400200 Forbidden to place an order
400500 Your located country/region is currently not supported for the trading of this token
400700 Transaction restricted, there's a risk problem in your account
400800 Leverage order failed
411100 User are frozen
500000 Internal Server Error
900001 symbol not exists

i got the 400004, perhaps you could change the error code you show?

Thanks! will do