How to use the ansicolors.magenta function in ansicolors

To help you get started, we’ve selected a few ansicolors examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github drewcummins / hodlol / app / model / trader / index.js View on Github external
async printPerformance() {
    if (this.strategies.length == 0) return;
    console.log('\x1Bc');
    var date = "";
    if (this.exchange.isBacktesting()) {
      let dateStart = colors.magenta(dateFormat(config.scenario.start, "mmm d, h:MM:ssTT"));
      let dateEnd = colors.magenta(dateFormat(config.scenario.end, "mmm d, h:MM:ssTT"));
      date = colors.magenta(dateFormat(Math.min(this.exchange.time, config.scenario.end), "mmm d, h:MM:ssTT"));
      console.log(` | Backtesting from ${dateStart} to ${dateEnd}\n`);
    }
    let columns = [];
    for (var i = 0; i < this.strategies.length; i++) {
      let strategy = this.strategies[i];
      try {
        let value = await strategy.portfolio.value("USDT");
        if(!strategy.originalValue) strategy.originalValue = value;
        let valstr = colors.green("$" + value.total.toFixed(2));
        let ovalstr = colors.green("$" + strategy.originalValue.total.toFixed(2));
        columns.push({strategy: colors.blue(strategy.title), value: valstr, "original value": ovalstr});
        // console.log(" |=> " + strategy.prettyTitle(), valstr + ", original value:", ovalstr);
      } catch(err) {
        throw err;
        console.log("Error calculating value");
github liquidg3 / altair / node_modules / npm / lib / outdated.js View on Github external
if (!npm.config.get('global')) {
    dir = path.relative(process.cwd(), dir)
  }

  var columns = [ depname,
                  has || 'MISSING',
                  want,
                  latest,
                  deppath
                ]
  if (long) columns[5] = type

  if (npm.color) {
    columns[0] = color[has === want ? 'yellow' : 'red'](columns[0]) // dep
    columns[2] = color.green(columns[2]) // want
    columns[3] = color.magenta(columns[3]) // latest
    columns[4] = color.brightBlack(columns[4]) // dir
    if (long) columns[5] = color.brightBlack(columns[5]) // type
  }

  return columns
}
github drewcummins / hodlol / dist / models / trader / index.js View on Github external
async printPerformance() {
        if (this.strategies.length == 0)
            return;
        let scenario = types_1.Scenario.getInstance();
        let out = "\x1Bc\n";
        var date;
        if (scenario.mode == types_1.ScenarioMode.PLAYBACK) {
            let dateStart = colors.magenta(dateFormat(scenario.start, "mmm d, h:MM:ssTT"));
            let dateEnd = colors.magenta(dateFormat(scenario.end, "mmm d, h:MM:ssTT"));
            date = colors.magenta(dateFormat(Math.min(scenario.time, scenario.end), "mmm d, h:MM:ssTT"));
            out += ` | Backtesting from ${dateStart} to ${dateEnd}\n\n`;
        }
        let columns = [];
        for (var i = 0; i < this.strategies.length; i++) {
            let strategy = this.strategies[i];
            try {
                let value = await strategy.portfolio.value(this.params.quote, this.exchange.price.bind(this.exchange));
                if (!strategy.originalValue)
                    strategy.originalValue = value;
                let total = types_1.BN(value.all.free).plus(value.all.reserved).toFixed(2);
                let originalTotal = types_1.BN(strategy.originalValue.all.free).plus(strategy.originalValue.all.reserved).toFixed(2);
                let valstr = colors.green("$" + total);
                let ovalstr = colors.green("$" + originalTotal);
                columns.push({ strategy: colors.blue(strategy.title), value: valstr, "original value": ovalstr });
            }
            catch (err) {
github drewcummins / hodlol / src / models / trader / index.ts View on Github external
protected async printPerformance() {
    if (this.strategies.length == 0) return;
    let scenario = Scenario.getInstance();
    let out = "\x1Bc\n";
    var date;
    if (scenario.mode == ScenarioMode.PLAYBACK) {
      let dateStart = colors.magenta(dateFormat(scenario.start, "mmm d, h:MM:ssTT"));
      let dateEnd = colors.magenta(dateFormat(scenario.end, "mmm d, h:MM:ssTT"));
      date = colors.magenta(dateFormat(Math.min(scenario.time, scenario.end), "mmm d, h:MM:ssTT"));
      out += ` | Backtesting from ${dateStart} to ${dateEnd}\n\n`;
    }
    let columns = [];
    for (var i = 0; i < this.strategies.length; i++) {
      let strategy = this.strategies[i];
      try {
        let value = await strategy.portfolio.value(this.params.quote, this.exchange.price.bind(this.exchange));
        if(!strategy.originalValue) strategy.originalValue = value;
        let total:string = BN(value.all.free).plus(value.all.reserved).toFixed(2);
        let originalTotal:string = BN(strategy.originalValue.all.free).plus(strategy.originalValue.all.reserved).toFixed(2);
        let valstr = colors.green("$" + total);
        let ovalstr = colors.green("$" + originalTotal);
        columns.push({strategy: colors.blue(strategy.title), value: valstr, "original value": ovalstr});
      } catch(err) {
        throw err;
github renelikestacos / Web-Mapping-Leaflet-NodeJS-Tutorials / 002-Leaflet-Custom-Markers / node_modules / beefy / lib / handlers / legacy-bundle.js View on Github external
function handle(server, req, resp, parsed) {
    if(!(parsed.pathname in entries) && !('browserify' in parsed.query)) {
      return nextHandler(server, req, resp, parsed)
    }

    var entryPath = entries[parsed.pathname]
      , args = bundlerOpts.flags.slice()
      , bundler
      , output

    if(entryPath) {
      args.unshift(entryPath)
    }

    args.unshift(bundlerOpts.command)
    parsed.loggedPathname = ansicolors.magenta(
        parsed.pathname + ' -> ' + args.map(toLocal).join(' ')
    )
    args.shift()

    bundler = spawn(bundlerOpts.command, args)
    bundler.stderr.pipe(accumError(io.error, resp))
    resp.setHeader('content-type', 'text/javascript')
    bundler.stdout.pipe(resp)
  }
github drewcummins / hodlol / src / models / trader / index.ts View on Github external
protected async printPerformance() {
    if (this.strategies.length == 0) return;
    let scenario = Scenario.getInstance();
    let out = "\x1Bc\n";
    var date;
    if (scenario.mode == ScenarioMode.PLAYBACK) {
      let dateStart = colors.magenta(dateFormat(scenario.start, "mmm d, h:MM:ssTT"));
      let dateEnd = colors.magenta(dateFormat(scenario.end, "mmm d, h:MM:ssTT"));
      date = colors.magenta(dateFormat(Math.min(scenario.time, scenario.end), "mmm d, h:MM:ssTT"));
      out += ` | Backtesting from ${dateStart} to ${dateEnd}\n\n`;
    }
    let columns = [];
    for (var i = 0; i < this.strategies.length; i++) {
      let strategy = this.strategies[i];
      try {
        let value = await strategy.portfolio.value(this.params.quote, this.exchange.price.bind(this.exchange));
        if(!strategy.originalValue) strategy.originalValue = value;
        let total:string = BN(value.all.free).plus(value.all.reserved).toFixed(2);
        let originalTotal:string = BN(strategy.originalValue.all.free).plus(strategy.originalValue.all.reserved).toFixed(2);
        let valstr = colors.green("$" + total);
        let ovalstr = colors.green("$" + originalTotal);
        columns.push({strategy: colors.blue(strategy.title), value: valstr, "original value": ovalstr});
      } catch(err) {
        throw err;
      }
github chrisdickinson / beefy / lib / handlers / legacy-bundle.js View on Github external
function handle(server, req, resp, parsed) {
    if(!(parsed.pathname in entries) && !('browserify' in parsed.query)) {
      return nextHandler(server, req, resp, parsed)
    }

    var entryPath = entries[parsed.pathname]
      , args = bundlerOpts.flags.slice()
      , bundler
      , output

    if(entryPath) {
      args.unshift(entryPath)
    }

    args.unshift(bundlerOpts.command)
    parsed.loggedPathname = ansicolors.magenta(
        parsed.pathname + ' -> ' + args.map(toLocal).join(' ')
    )
    args.shift()

    bundler = spawn(bundlerOpts.command, args)
    bundler.stderr.pipe(accumError(io.error, resp))
    resp.setHeader('content-type', 'text/javascript')
    bundler.stdout.pipe(resp)
  }
github renelikestacos / Web-Mapping-Leaflet-NodeJS-Tutorials / 002-Leaflet-Custom-Markers / node_modules / beefy / lib / handlers / bundle.js View on Github external
function handle(server, req, resp, parsed) {
    if(!(parsed.pathname in entries) && !('browserify' in parsed.query)) {
      return nextHandler(server, req, resp, parsed)
    }

    var entryPath = entries[parsed.pathname]
      , args = bundlerOpts.flags.slice()
      , bundler
      , output

    args.unshift(bundlerOpts.command.bundler, entryPath)
    parsed.loggedPathname = ansicolors.magenta(
        parsed.pathname + ' ➞ ' + args.map(toLocal).join(' ')
    )
    args.shift()
    args.shift()

    bundler = bundlerOpts.command(entryPath)
    bundler.stderr.pipe(accumError(io.error, resp))
    resp.setHeader('content-type', 'text/javascript')
    bundler.stdout.pipe(resp)
  }
github drewcummins / hodlol / dist / models / trader / index.js View on Github external
async printPerformance() {
        if (this.strategies.length == 0)
            return;
        let scenario = types_1.Scenario.getInstance();
        let out = "\x1Bc\n";
        var date;
        if (scenario.mode == types_1.ScenarioMode.PLAYBACK) {
            let dateStart = colors.magenta(dateFormat(scenario.start, "mmm d, h:MM:ssTT"));
            let dateEnd = colors.magenta(dateFormat(scenario.end, "mmm d, h:MM:ssTT"));
            date = colors.magenta(dateFormat(Math.min(scenario.time, scenario.end), "mmm d, h:MM:ssTT"));
            out += ` | Backtesting from ${dateStart} to ${dateEnd}\n\n`;
        }
        let columns = [];
        for (var i = 0; i < this.strategies.length; i++) {
            let strategy = this.strategies[i];
            try {
                let value = await strategy.portfolio.value(this.params.quote, this.exchange.price.bind(this.exchange));
                if (!strategy.originalValue)
                    strategy.originalValue = value;
                let total = types_1.BN(value.all.free).plus(value.all.reserved).toFixed(2);
                let originalTotal = types_1.BN(strategy.originalValue.all.free).plus(strategy.originalValue.all.reserved).toFixed(2);
                let valstr = colors.green("$" + total);
                let ovalstr = colors.green("$" + originalTotal);
                columns.push({ strategy: colors.blue(strategy.title), value: valstr, "original value": ovalstr });
            }