UNPKG

@backtest/command-line

Version:

This project is a CLI build around Backtest, a library for trading developers

41 lines 1.98 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.importCSVPortal = importCSVPortal; const framework_1 = require("@backtest/framework"); const portals_1 = require("../../helpers/portals"); const csv_1 = require("../../helpers/csv"); const headers_1 = require("../../infra/headers"); function importCSVPortal() { return __awaiter(this, void 0, void 0, function* () { console.clear(); (0, headers_1.headerImportCSV)(); const base = (yield (0, portals_1.interactCLI)({ type: 'input', message: 'Base name (EX: BTC in BTCUSDT or APPL in APPL/USD):' })).toUpperCase(); const quote = (yield (0, portals_1.interactCLI)({ type: 'input', message: 'Quote name (EX: USDT in BTCUSDT or USD in APPL/USD):' })).toUpperCase(); const interval = yield (0, portals_1.interactCLI)({ type: 'autocomplete', message: 'Interval:', choices: (0, framework_1.getIntervals)() }); const path = yield (0, portals_1.interactCLI)({ type: 'input', message: 'Full Path to CSV:' }); return yield (0, csv_1.importCSV)({ interval, base, quote, path }); }); } //# sourceMappingURL=import-csv.js.map