<commit_before>#include "parameters.h"

#include <iostream>
#include <stdlib.h>


Parameters::Parameters(std::string fileName)
{
  std::ifstream configFile(fileName.c_str());
  spreadEntry = getDouble(getParameter("SpreadEntry", configFile));
  spreadTarget = getDouble(getParameter("SpreadTarget", configFile));
  maxLength = getUnsigned(getParameter("MaxLength", configFile));
  priceDeltaLim = getDouble(getParameter("PriceDeltaLimit", configFile));
  trailingLim = getDouble(getParameter("TrailingSpreadLim", configFile));
  trailingCount = getUnsigned(getParameter("TrailingSpreadCount", configFile));
  orderBookFactor = getDouble(getParameter("OrderBookFactor", configFile));
  demoMode = getBool(getParameter("DemoMode", configFile));
  verbose = getBool(getParameter("Verbose", configFile));
  gapSec = getUnsigned(getParameter("GapSec", configFile));
  debugMaxIteration = getUnsigned(getParameter("DebugMaxIteration", configFile));
  useFullCash = getBool(getParameter("UseFullCash", configFile));
  cashForTesting = getDouble(getParameter("CashForTesting", configFile));
  maxExposure = getDouble(getParameter("MaxExposure", configFile));
  useVolatility = getBool(getParameter("UseVolatility", configFile));
  volatilityPeriod = getUnsigned(getParameter("VolatilityPeriod", configFile));
  cacert = getParameter("CACert", configFile);

  bitfinexApi = getParameter("BitfinexApiKey", configFile);
  bitfinexSecret = getParameter("BitfinexSecretKey", configFile);
  bitfinexFees = getDouble(getParameter("BitfinexFees", configFile));
  okcoinApi = getParameter("OkCoinApiKey", configFile);
  okcoinSecret = getParameter("OkCoinSecretKey", configFile);
  okcoinFees = getDouble(getParameter("OkCoinFees", configFile));
  bitstampClientId = getParameter("BitstampClientId", configFile);
  bitstampApi = getParameter("BitstampApiKey", configFile);
  bitstampSecret = getParameter("BitstampSecretKey", configFile);
  bitstampFees = getDouble(getParameter("BitstampFees", configFile));
  geminiApi = getParameter("GeminiApiKey", configFile);
  geminiSecret = getParameter("GeminiSecretKey", configFile);
  geminiFees = getDouble(getParameter("GeminiFees", configFile));
  krakenApi = getParameter("KrakenApiKey", configFile);
  krakenSecret = getParameter("KrakenSecretKey", configFile);
  krakenFees = getDouble(getParameter("KrakenFees", configFile));
  itbitApi = getParameter("ItBitApiKey", configFile);
  itbitSecret = getParameter("ItBitSecretKey", configFile);
  itbitFees = getDouble(getParameter("ItBitFees", configFile));
  btceApi = getParameter("BTCeApiKey", configFile);
  btceSecret = getParameter("BTCeSecretKey", configFile);
  btceFees = getDouble(getParameter("BTCeFees", configFile));
  poloniexApi = getParameter("PoloniexApiKey", configFile);
  poloniexSecret = getParameter("PoloniexSecretKey", configFile);
  poloniexFees = getDouble(getParameter("PoloniexFees", configFile));
  gdaxApi = getParameter("GDAXApiKey", configFile);
  gdaxSecret = getParameter("GDAXSecretKey", configFile);
  gdaxFees = getDouble(getParameter("GDAXFees", configFile));

  sendEmail = getBool(getParameter("SendEmail", configFile));
  senderAddress = getParameter("SenderAddress", configFile);
  senderUsername = getParameter("SenderUsername", configFile);
  senderPassword = getParameter("SenderPassword", configFile);
  smtpServerAddress = getParameter("SmtpServerAddress", configFile);
  receiverAddress = getParameter("ReceiverAddress", configFile);

  dbFile = getParameter("DBFile", configFile);

  configFile.close();
}

void Parameters::addExchange(std::string n, double f, bool h, bool m)
{
  exchName.push_back(n);
  fees.push_back(f);
  canShort.push_back(h);
  isImplemented.push_back(m);
}<commit_msg>Simplified ifstream usage in parameters.cpp.<commit_after>#include "parameters.h"

#include <iostream>
#include <stdlib.h>


Parameters::Parameters(std::string fileName)
{
  std::ifstream configFile(fileName);
  spreadEntry = getDouble(getParameter("SpreadEntry", configFile));
  spreadTarget = getDouble(getParameter("SpreadTarget", configFile));
  maxLength = getUnsigned(getParameter("MaxLength", configFile));
  priceDeltaLim = getDouble(getParameter("PriceDeltaLimit", configFile));
  trailingLim = getDouble(getParameter("TrailingSpreadLim", configFile));
  trailingCount = getUnsigned(getParameter("TrailingSpreadCount", configFile));
  orderBookFactor = getDouble(getParameter("OrderBookFactor", configFile));
  demoMode = getBool(getParameter("DemoMode", configFile));
  verbose = getBool(getParameter("Verbose", configFile));
  gapSec = getUnsigned(getParameter("GapSec", configFile));
  debugMaxIteration = getUnsigned(getParameter("DebugMaxIteration", configFile));
  useFullCash = getBool(getParameter("UseFullCash", configFile));
  cashForTesting = getDouble(getParameter("CashForTesting", configFile));
  maxExposure = getDouble(getParameter("MaxExposure", configFile));
  useVolatility = getBool(getParameter("UseVolatility", configFile));
  volatilityPeriod = getUnsigned(getParameter("VolatilityPeriod", configFile));
  cacert = getParameter("CACert", configFile);

  bitfinexApi = getParameter("BitfinexApiKey", configFile);
  bitfinexSecret = getParameter("BitfinexSecretKey", configFile);
  bitfinexFees = getDouble(getParameter("BitfinexFees", configFile));
  okcoinApi = getParameter("OkCoinApiKey", configFile);
  okcoinSecret = getParameter("OkCoinSecretKey", configFile);
  okcoinFees = getDouble(getParameter("OkCoinFees", configFile));
  bitstampClientId = getParameter("BitstampClientId", configFile);
  bitstampApi = getParameter("BitstampApiKey", configFile);
  bitstampSecret = getParameter("BitstampSecretKey", configFile);
  bitstampFees = getDouble(getParameter("BitstampFees", configFile));
  geminiApi = getParameter("GeminiApiKey", configFile);
  geminiSecret = getParameter("GeminiSecretKey", configFile);
  geminiFees = getDouble(getParameter("GeminiFees", configFile));
  krakenApi = getParameter("KrakenApiKey", configFile);
  krakenSecret = getParameter("KrakenSecretKey", configFile);
  krakenFees = getDouble(getParameter("KrakenFees", configFile));
  itbitApi = getParameter("ItBitApiKey", configFile);
  itbitSecret = getParameter("ItBitSecretKey", configFile);
  itbitFees = getDouble(getParameter("ItBitFees", configFile));
  btceApi = getParameter("BTCeApiKey", configFile);
  btceSecret = getParameter("BTCeSecretKey", configFile);
  btceFees = getDouble(getParameter("BTCeFees", configFile));
  poloniexApi = getParameter("PoloniexApiKey", configFile);
  poloniexSecret = getParameter("PoloniexSecretKey", configFile);
  poloniexFees = getDouble(getParameter("PoloniexFees", configFile));
  gdaxApi = getParameter("GDAXApiKey", configFile);
  gdaxSecret = getParameter("GDAXSecretKey", configFile);
  gdaxFees = getDouble(getParameter("GDAXFees", configFile));

  sendEmail = getBool(getParameter("SendEmail", configFile));
  senderAddress = getParameter("SenderAddress", configFile);
  senderUsername = getParameter("SenderUsername", configFile);
  senderPassword = getParameter("SenderPassword", configFile);
  smtpServerAddress = getParameter("SmtpServerAddress", configFile);
  receiverAddress = getParameter("ReceiverAddress", configFile);

  dbFile = getParameter("DBFile", configFile);
}

void Parameters::addExchange(std::string n, double f, bool h, bool m)
{
  exchName.push_back(n);
  fees.push_back(f);
  canShort.push_back(h);
  isImplemented.push_back(m);
}
{'fraction_non_alphanumeric': 0.12748522299838796, 'fraction_numerical': 0.0, 'mean_word_length': 9.129251700680273, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2440555', 'n_tokens_mistral': 2276, 'n_tokens_neox': 2249, 'n_words': 363}