Thanks Carloz, always appreciated
Hi Carloz, apologies me again
I’ve fixed as per yours above but still getting the error message:
SyntaxError: Unexpected token '.'
←[90m at wrapSafe (internal/modules/cjs/loader.js:979:16)←[39m
←[90m at Module._compile (internal/modules/cjs/loader.js:1027:27)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:928:32)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:769:14)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
←[90m at internal/main/run_main_module.js:17:47←[39m
PS C:\Users\dell\Desktop\Trading Bot>
Code as follows:
const GeminiAPI = require ("gemini-api").default;
const secret = "SAXTr4t13WYX5VV2a8rTqaZR8Pb";
const key = "F4C5TcIpdZi3lM7Y1Ilm";
const restClient = new GeminiAPI ({key, secret, sandbox:true});
restClient.newOrder({amount:10, price:100, side:"buy", symbol: "btcusd"});
.then(response => console.log(response));
at the end of the first code line, remove the ;
.
Remember that newOrder
is an async function so the basic structure is:
restClient.newOrder({
amount:10,
price:100,
side:"buy",
symbol: "btcusd"
}).then(
response => console.log(response)
)
Carlos Z
Hi Carloz hope all is well,
Many thanks for your reply, completely makes sense now.
I am however still getting an error message as follows:
PS C:\WINDOWS\system32> Set-Location -Path "C:\Users\dell\Desktop\TradingBot"
PS C:\Users\dell\Desktop\TradingBot> node index.js
(node:11540) UnhandledPromiseRejectionWarning: #<Object>
(Use `node --trace-warnings ...` to show where the warning was created)
(node:11540) 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:11540) [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.
PS C:\Users\dell\Desktop\TradingBot> node index.js
Code as follows:
const GeminiAPI = require("gemini-api").default;
const secret = "SAXTr4t13WYX5VV2a8rTqaZR8Pb";
const key = "F4C5TcIpdZi3lM7Y1Ilm";
const restClient = new GeminiAPI ({key, secret, sandbox:true});
restClient.newOrder({
amount:10,
price:100,
side:"buy",
symbol: "btcusd"
}).then(
response => console.log(response)
);
Appreciate all your help of late @thecil
try to add .catch(console.error)
at the end of your .then().
So that will trigger an error message from the server in case you have some error in the parameters.
restClient.newOrder({
amount:10,
price:100,
side:"buy",
symbol: "btcusd"
}).then(
response => console.log(response)
).catch(console.error)
Carlos Z
Thanks Carloz, will do
Hi @thecil I think we’re getting somewhere, i’ve included the .catch(console.error) and received the following:
PS C:\Users\dell\Desktop\TradingBot> node index.js
{
result: 'error',
reason: 'InvalidSignature',
message: 'InvalidSignature'
}
Could you let me know what the signature refers to?
Thanks again
Your key
should start with account-
then the numbers, verify your Gemini API keys.
Carlos Z
I am new to JS and was able to create an image on my computer. Were we supposed to upload an image on Ivan/Tech? Not sure where to put these assignments if they are to be completed on the forum.
Hey @Lorraine, hope you are ok.
I have seen you already find your way to post this question on the proper topic.
Our team will be helping you soon with the problem, but I could suggest you to share your code to see what is the problem.
https://forum.ivanontech.com/t/faq-how-to-post-code-in-the-forum/35357/2
Also here you can learn more about how to add images on HTML.
- https://www.w3schools.com/html/html_images.asp
- https://www.tutorialspoint.com/html/html_images.htm
- https://html.com/tags/img/
PD: please keep this topic related to the course, i know your question is about JS, so any case we will answer you in the specific topic next time
Carlos Z
Hello im trying to install Yarn in the terminal but when i try this appears:
MacBook-Pro-de-Eduardo-3:~ eduardocarrillodelapena$ npm install -g yarn
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’
npm ERR! [Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’] {
npm ERR! errno: -13,
npm ERR! code: ‘EACCES’,
npm ERR! syscall: ‘access’,
npm ERR! path: ‘/usr/local/lib/node_modules’
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/eduardocarrillodelapena/.npm/_logs/2021-05-11T17_38_34_813Z-debug.log
MacBook-Pro-de-Eduardo-3:~ eduardocarrillodelapena$ npm install --global yarn
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’
npm ERR! [Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’] {
npm ERR! errno: -13,
npm ERR! code: ‘EACCES’,
npm ERR! syscall: ‘access’,
npm ERR! path: ‘/usr/local/lib/node_modules’
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/eduardocarrillodelapena/.npm/_logs/2021-05-11T17_42_24_211Z-debug.log
Please, help me!
Hey @Eduardo_Carrillo, hope you are ok.
You might want to check this guide: https://tecadmin.net/install-yarn-macos/
Also maybe you just need to run your setup through admin role (sudo
).
Carlos Z
Thanks i could install brew but when i try to install through brew or nps doesnt install.
I even tried with this link : curl -o- -L https://yarnpkg.com/install.sh | bash ‘’ but this happened it needs a profile is not found. can you help me?:
just solved it, i had to update my OS. I updated from Sierra to Mojave.
What do you do if you use Linux?
You can use npm
or yarn
both are package managers and you can have both installed, i do use both of them (some packages use yarn, some npm).
Carlos Z
Cool, thanks Carlos.
Troy
In the homework. of making the minute, day, hour MA
when im trying to code the dayMA it doesnt recognize the property close.
i did minute and hour MA ok.
i even copied the code from the others and fixed the names many times but it appears the same error again and again…
can anyone. help me please?
Hey @Eduardo_Carrillo, hope you are ok.
Please provide your code in the following way:
Then i will try to replicate your issue to give you a feedback
Carlos Z
I am getting this error message. Though the file is there, power shell is stating it isn’t there. Please advise
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\ragib> cd “C:\Users\ragib\OneDrive\Documents\botjs\bot.js”
cd : Cannot find path ‘C:\Users\ragib\OneDrive\Documents\botjs\bot.js’ because it does not exist.
At line:1 char:1
- cd “C:\Users\ragib\OneDrive\Documents\botjs\bot.js”
-
+ CategoryInfo : ObjectNotFound: (C:\Users\ragib\...ts\botjs\bot.js:String) [Set-Location], ItemNotFoundE xception + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
PS C:\Users\ragib> cd “C:\Users\ragib\OneDrive\Documents\botjs\bot2.js”
cd : Cannot find path ‘C:\Users\ragib\OneDrive\Documents\botjs\bot2.js’ because it does not exist.
At line:1 char:1
- cd “C:\Users\ragib\OneDrive\Documents\botjs\bot2.js”
-
+ CategoryInfo : ObjectNotFound: (C:\Users\ragib\...s\botjs\bot2.js:String) [Set-Location], ItemNotFoundE xception + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
PS C:\Users\ragib>