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ā¦
Hey @Leedecker425, hope you are well.
Could you please provide an screenshot about your issue? Which is the process that you are following to use npm?
Carlos Z
@thecil, I am getting the same type of error. If i understand correctly, you suggested to remove this line from the code:
global.fetch = require('node-fetch');
removing this line i get
referenceerror: fetch is not defined.
Didnt attach snapshots because its pretty similar to @Riki 's error messages
// Hello bot-mongers
Iām stuck at the āyarn add gemini-apiā step in powershell.
all the steps in the āGemini Yarn Installā video worked fine up to this point.
Further more, I am unable to find the webpage Ivan uses to copy āyarn add gemini-apiā from.
edit: resolved. If u encounter this prob too, check out reply #77 in this thread.