Javascript bot programming using Gemini API, NodeJS and CryptoCompare - DISCUSSION

Working good for me every day, 3 months now since i started. :+1: :slightly_smiling_face:

Hello sir, no, the academy website is working fine, are you still facing the same issue? maybe its a DNS problem from your side?

If you have any doubt, please let us know so we can help you! :slight_smile:

Carlos Z.

in case anyone is facing write access error when installing Yarn (im on mac):

1 Like

Guys can you help me, im working with Mac, instead of PowerShell Im using Terminal, but when I want to change the path and type CD an error appears

I am having a problem running yarn how do i enable the script in my system ?

yarn : File C:\Users\josiah\AppData\Roaming\npm\yarn.ps1 cannot be loaded because running scripts is disabled on this
system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1

  • yarn add gemini-api
  •   + CategoryInfo          : SecurityError: (:) [], PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess

i am having this problem come up can anyone help?

node index.js
(node:3260) UnhandledPromiseRejectionWarning: #
(node:3260) 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: 3)
(node:3260) [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.

const GeminiAPI = require(“gemini-api”).default;
const secret = “”;
const key = “”;
const restClient = new GeminiAPI({key, secret, sandbox:true});

restClient.newOrder({amount:10,price:100,side:“buy”,symbol:“btcusd”})
.then(response => console.log(response));

Hi Mesiah,

Just change restClient.newOrder line into:
restClient.newOrder({amount:10,price:100,side:“buy”,symbol:“btcusd”})
.then(response => { console.log(response) })
.catch(error => { console.log(error) });

I got “InvalidSignature” error message (due the added catch part, which must be available nowadays).
I saw : I exchanged the key and secret strings!
The key start with “account-” or “master-”.

See: https://medium.com/@lucymarmitchell/using-then-catch-finally-to-handle-errors-in-javascript-promises-6de92bce3afc

C:\Users\josiah\Documents\Ivan On Tech\code\index.js:6
restClient.newOrder({amount:10,price:100,side:“buy”,symbol:“btcusd”})

SyntaxError: Invalid or unexpected token
e[90m at wrapSafe (internal/modules/cjs/loader.js:1054:16)e[39m
e[90m at Module._compile (internal/modules/cjs/loader.js:1102:27)e[39m
e[90m at Object.Module._extensions…js (internal/modules/cjs/loader.js:1158:10)e[39m
e[90m at Module.load (internal/modules/cjs/loader.js:986:32)e[39m
e[90m at Function.Module._load (internal/modules/cjs/loader.js:879:14)e[39m
e[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)e[39m
e[90m at internal/main/run_main_module.js:17:47e[39m

this came up im on node js looking to see if i missed any steps

{
result: ‘error’,
reason: ‘MissingAccounts’,
message: ‘Expected a JSON payload with accounts’
}

Did you define these lines:

const key = "account-uBt....";
const secret = "Ln1...Jrs";
var restClient = new GeminiAPI({key, secret, sandbox:true});

I noticed the names (strange to me, but ok) the variable names key and secret can not be changed.

everytime i go to copy the lessons its saying the code is out dated. I am learning how to update their code at the same time lol

1 Like

thanks for the info i just had to learn how to use their code as a base go through the whole package and update it

1 Like

You’re welcome and if you have (javascript, nodeJS, coding) questions… you can ask me as well…

have a nice day and success coding! :+1:

  • I think @filip said this somewhere already (I was having the same issue) but check that the folder you are using just has one word, and no spaces. That makes things easier.
  • I also had trouble typing the “cd ~/”… whatever you path is. I forgot a space a couple times, so I went folder by folder make sure it was right. Could be that.

Does anyone know an exchange in the US with a Sandbox, and is able to Short? Shorting is essential to the strategy (and probable future strategies) I’m working on.

Gemini is not available in Venezuela, I’m trying to implement the course with my Kraken account with pair ADABTC 1ADA@1BTC that way I can´t be mad if the order executes. I will also try with Binance.

Hi i have problems gemini-api on LINUX, it seems this gemini-api is not there or different than windows ??

Procedure i followed is the same as Ivan did, but it looks that the directory’s from gemini are different ??
after these conmmands i tried to run the example Ivan is doing …

npm install yarn --global
yarn add gemini -api

node index.js
These is the result

internal/modules/cjs/loader.js:969
throw err;
^

Error: Cannot find module ‘gemini-api’
Require stack:

  • /home/rld/Documents/Cursus Blockchain Ivan/JavaScript/index.js

The javascript code i tried :

const GeminiAPI = require(“gemini-api”).default;
const secret = “my secret …”;
const key = “mu key”;
const restClient = new GeminiAPI({key,secret,sandbox:true});

restClient.newOrder({amount:10,price:100,side:“buy”,symbol:“btcusd”})
.then(response => console.log(response));

2] i changed gemini-api to gemini :

So at this moment i am not sure how to solve this, any idea’s
Thanks

RLion

Hi RLion,

Did you succeed with installing the gemini-api?

It is “yarn add gemini-api” without the space in the name.

And if yarn is not available, mostly due --global (unsufficient rights) , then replace it with --save to install it locally. Yes, then it is only available for current project. If you want it ‘global’ then
sudo npm install yarn --global
can work, but sudo must be enabled for your account.

npm list --depth 0
shows a list of installed packages locally, add -g to see which are global available and change depth value to see dependices or ommit it to see all.

Best regards,
CasNWK.

1 Like