Greetings, having issues connecting my powershell/Atom account to my gemini sandbox. Anyone able to see what I am doing incoreectly? Thanks in advance
Hey guys so i get this merror message. Whatâs the matter here?
global.fetch = require(ânode-fetchâ);
const GeminiAPI = require(âgemini-apiâ).default;
const secret = â2SrRCw2ZJDTqc5wfFzTvLcWq3Vaâ;
const key = âaccount-jv3DuBrPOahId5fahuXcâ;
const CCAPIKey = â96339dfb1ded44102d3bf07aa4813dbc99ebf0a445a7d3926cb3e60ac6b7d156â;
const restClient = new GeminiAPI({key, secret, sandbox:true});
const CryptoCompareAPI = require(âcryptocompareâ);
CryptoCompareAPI.setApiKey(CCAPIKey);
restClient.newOrder({amount:10,price:10,side:âbuyâ,symbol:âbtcusdâ})
.then(response => console.log(response))
.catch(error => console.log(error));
//
CryptoCompareAPI.coinList()
.then(coinList => {
console.log(coinList)
})
Hey @Stahlin_Jonas, hope you are well.
Please take a look into this post which is related to your issue, the solution is to change the fetch version to a lower one.
Carlos Z
Your key is wrong, the format of it should start with âaccount-xxxxxxxxâ. Check the gemini api account for it
Check this: Javascript bot programming using Gemini API, NodeJS and CryptoCompare - DISCUSSION
Carlos Z
I canât use gemini in germany⌠any recommendations for other exchanges that work in a simular way so i can follow the course?
Hi Carlos, i have tried as per your instructions but i am still getting error message require is not defined. Please see my code below
My packages .json
Can you help, please?@thecil
Bitfinex, the api is a bit more complex but they also have sandbox account.
hey @thecil
iâm having some network issues⌠is there a way to install yarn from a manually downloaded source code? e.g. from their github
OR
can i use the wget function from my local folder where weâve been working for these assignments? or is it something that you can only access from another folder?
new problem
(edit: on a mac, btw)
eventually got the yarn to install locally*, but of course when i try yarn add gemini-api
, it tells me the command âyarnâ is not found⌠i tried sudo npm install yarn --global
, but my user canât get that access (âMissing write access to /usr/local/lib/node_modulesâ), and my master password isnât working thereâŚ
by installed locally i mean
MyComputer:TA w filip and ivan users$ npm install yarn
> [email protected] preinstall /Users/weakuser 1/Documents/crypto training/TA w filip and ivan/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No repository field.
+ [email protected]
added 1 package and audited 1 package in 45.338s
found 0 vulnerabilities
MyComputer:TA w filip and ivan users$ yarn add gemini-api
-bash: yarn: command not found
MOST RECENT EDIT:
finally just used npm install gemini-api and got no errors so farâŚ
iâd like to use your credentials @thecil (that i got from here Javascript bot programming using Gemini API, NodeJS and CryptoCompare - DISCUSSION) or ivanâs from the video in order to check that anything there is working and avoid having to go through the entire account setup process with gemini (i try to minimize the number of centralized accounts i use in order to avoid all the risks associated with centralization)
Please LET ME KNOW if thatâs not ok! iâll hold off for a day or two
fyi: âterminalâ is the app heâs talkingabout in case youâre still wondering⌠i realize itâs a bit late, but i happened to be poking around haha
hey @Leo1, hope you are well.
Could you please share an screenshot about the console error that is showed to you?
Also please share your code in the following way so i can copy/paste easily
Carlos Z
@thecil, would it be worth it to solve some problems in this thread by you guys giving out some keys/credentials and telling people to head over to something like https://npm.runkit.com/gemini-api ? not having to download and install anything from terminal/powershell would certainly be helpful to me, and i donât think would detract too much from the class, although i donât know if that fits your guysâ goalsâŚ
if youâre not too busy, iâm also wondering what destructured means in this context (what is { getTIcker } literally in this case?):
// The methods are bound properly, so feel free to destructure them:
const { getTicker } = restClient;
getTicker('btcusd')
.then(data =>
console.log(`Last trade: $${data.last} / BTC`)
)
i think i got one of those (on a mac) and it was fixed by adding a âcatch lineâ like so after the .thenâŚ:
restClient.newOrder({amount: 10, price: 27000, side:"buy", symbol:"btcusd"})
.then(response => console.log(response))
.catch(console.log);
yeah i know itâs been a while, but just in caseâŚ!
Thanks mate!
I ll have a try.
anyone know what is wrong here, canât run my program in powershell. SyntaxError: Unexpected identifier
â[90m at Object.compileFunction (node:vm:352:18)â[39m
â[90m at wrapSafe (node:internal/modules/cjs/loader:1031:15)â[39m
â[90m at Module._compile (node:internal/modules/cjs/loader:1065:27)â[39m
â[90m at Object.Module._extensionsâŚjs (node:internal/modules/cjs/loader:1153:10)â[39m
â[90m at Module.load (node:internal/modules/cjs/loader:981:32)â[39m
â[90m at Function.Module._load (node:internal/modules/cjs/loader:822:12)â[39m
â[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)â[39m
â[90m at node:internal/main/run_main_module:17:47â[39m
global.fetch = require ("node-fetch");
is there anything wrong with the above code?
if not, why do i get the folllowing?
*****$ node tradebot4TA.js
trader_bot active
internal/modules/cjs/loader.js:1102
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /****/node_modules/node-fetch/src/index.js
require() of ES modules is not supported.
require() of /******/node_modules/node-fetch/src/index.js from /*****/tradebot4TA.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /*****/node_modules/node-fetch/package.json.
at new NodeError (internal/errors.js:322:7)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1102:13)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/Users/weakuser 1/Documents/crypto training/TA w filip and ivan/tradebot4TA.js:4:16)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32) {
code: 'ERR_REQUIRE_ESM'
}
ok NOW knowing that i did not yarn add node-fetch, but used npm i node-fetch⌠what difference does that make? (i havenât been able to get yarn working, but npm worked for gemini and cryptocompare up until global.fetchâŚ
Hi @thecil thanks for coming back to me. I have found where the issue was. Basically in the package.json the type need to be changes to common.js instead of module as well. it is line 17 on my screenshot.
Hope it will help some lost soul in the future
Hey @B_S, hope you are great!
Please take a look to this reply, which is releated to the same issue that you have with the fetch module.
Carlos Z
733.12 seconds of updating node-fetch⌠and another 30 of running my new and improved trad-bot⌠itâs working all right!
Hi, I canât figure out how to get the npm package over to atom even though I followed the video and went through the correct steps on how to set up the npm package
whoooof, itâs a long road for some of these machine vagaries⌠this course in particular was subject to more of the âout-of-dateâ or machine-specific type of issues than the others iâve tkaen; that said, iâm not sure how to help with this problem (i just tried installing to my local folder, which worked), but two big ones that came up for me were the node-fetch downgrade (just a couple posts above yours here), and yarn not wanting to play nice (so i skipped it and just used npm for the remainder of the course)⌠also using a vpn or similar mightâve been messing up my connectivity in the first placeâŚ