Error message when trying to make the first fake - trade in the course tutorial

Hello,

I’m struggling to find out why i get this error when trying to duplicate what Ivan does in the episode ( Using Gemini – BUY ORDER - min 8:40).

I’m attaching a screenshot of the powershell error and my atom window. Would hugely appreciate your guys help :slight_smile: image

Hey @Sebastian_xndr, hope you are ok.

Would be great if you share the entire code properly, you can follow this guide to post properly the code:

Carlos Z

Hello @thecil, hope your doing well too,

here the preformatted code and thx for sharing the info!

//Atom:


const GeminiAPI = require("gemini-api").default;
const secret = "3YQwQr1CEgQSCFicmcPpSNoSfUtJ"
const key = "WtfpmzWgmVD1M3NrUGaL"
const restClient = new GeminiAPI({key,secret,sandbox:true});

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

//Powershell:

PS C:\Users\sebas\Documents\Ivan on Tech_Programming\Java 101> node index.js
node:internal/process/promises:246
          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 "#<Object>".] {
  code: ←[32m'ERR_UNHANDLED_REJECTION'←[39m
}
PS C:\Users\sebas\Documents\Ivan on Tech_Programming\Java 101>

have a good day

Sebastian

1 Like

Alright just figured it out: I simply didn’t have my Gemini - account verified for the device and was therefore not able to place orders.

1 Like

Also you have an error in your key, which should start with account-

const key = "account-someNumbers";

Then, try with this function syntax:

  geminiClient.newOrder({amount:_data.amount,
    price:_data.price,
    side:_data.side,
    symbol:_data.symbol,
    options:_data.options})
    .then(_res => {
      console.log(_res)
    })
  .catch(console.error);

Sorry for the delay man, hope this helps you.

Carlos Z

1 Like