question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Let CCXT Read from a credentials.js file

See original GitHub issue

I would like to enable CCXT to read from a credentials.js file when needing exchange credentials instead of having to put the credentials inside the source.

For example, instead of (this is from the instantiate-all-at-once.js example):

"use strict";

const ccxt = require ('../../ccxt');

async function test () {

    let exchanges = { 
        "bittrex": {
            "apiKey": "60f38a5818934fc08308778f94d3d8c4", 
            "secret": "9d294ddb5b944403b58e5298653720c1",
        },
        "bitfinex": { 
            "apiKey": "02YsRDRAFwqt9JXfFKPIEw82mgmNbZtfpwvt8q5WK5a", 
            "secret": "IummLrCfcZ9d9NPEtMg6chCpO8hugCvsDIscNm1F3pE"
        },
    }

    let ids = ccxt.exchanges.filter (id => id in exchanges)

we could do something like:

"use strict";

const ccxt = require ('../../ccxt');
const exchanges = require('credentials.js').credentials;

async function test () {

    let ids = ccxt.exchanges.filter (id => id in exchanges)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
xplcommented, Oct 31, 2017

@cklester Actually, you can use require to load JSON:

const keys = require ('./keys.json')
1reaction
cklestercommented, Nov 1, 2017

That seems to be the way to go… right? 🥇

Read more comments on GitHub >

github_iconTop Results From Across the Web

Manual · ccxt/ccxt Wiki - GitHub
A JavaScript / Python / PHP cryptocurrency trading API with support for more than 100 bitcoin/altcoin exchanges - Manual · ccxt/ccxt Wiki.
Read more >
ccxt Documentation - Read the Docs
ccxt Documentation, 1.13.142. A JavaScript / Python / PHP library for cryptocurrency trading and e-commerce with support for many bit-.
Read more >
CCXT — ccxt 2.4.60 documentation
A JavaScript / Python / PHP library for cryptocurrency trading and e-commerce with support for many bitcoin/ether/altcoin exchange markets and merchant APIs ...
Read more >
Encrypt & Decrypt user credentials | Crypto-JS | Playwright
A demonstration of how to use CryptoJS to encrypt and decrypt data, including code examples and step-by-step instructionsCrypto- JS is a ...
Read more >
Complete Authentication with Credentials, Google & GitHub
We will learn how to use the NextAuth. js library to make Google, Github, and Custom Credential Login in the same application.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found