Exemplo n.º 1
0
        public override void Initialize()
        {
            _gateway = "rnuF96W4SZoCJmbHYBFoJZpR8eCaxNvekK"/*RippleCN.com*/;        //TODO: Simply no
            _currencyCode = "CNY";                                                  //TODO: I say no

            _operativeAmount = double.Parse(_config.GetValue("operative_amount"));
            log(String.Format("Wide spread trader for RippleCN initialized with operative={0}; MinSpread={1}", _operativeAmount, MIN_SPREAD));

            string dataApiUrl = _config.GetValue("data_api_url");
            if (String.IsNullOrEmpty(dataApiUrl))
            {
                throw new Exception("Configuration value data_api_url not found!");
            }

            //Cleanup in order this is re-initialization after crash
            _sellOrderId = -1;
            _buyOrderId = -1;

            _requestor = new RippleApi(_config, _logger, _feeProvider, _txSigner, dataApiUrl, _gateway, _currencyCode);
            _requestor.Init();
        }
Exemplo n.º 2
0
        public override void Initialize()
        {
            _operativeAmount = double.Parse(_config.GetValue("operative_amount"));
            _minWallVolume = double.Parse(_config.GetValue("min_volume"));
            _maxWallVolume = double.Parse(_config.GetValue("max_volume"));
            _gateway = _config.GetValue("gateway_address");
            if (null == _gateway)
            {
                throw new Exception("Configuration key 'gateway_address' missing");
            }
            _currencyCode = _config.GetValue("currency_code");
            if (null == _currencyCode)
            {
                throw new Exception("Configuration key 'currency_code' missing");
            }
            _minDifference = double.Parse(_config.GetValue("trade_spread"));
            _minPriceUpdate = double.Parse(_config.GetValue("min_price_update"));
            _minXrpBalance = double.Parse(_config.GetValue("min_xrp_balance"));

            string dataApiUrl = _config.GetValue("data_api_url");
            if (String.IsNullOrEmpty(dataApiUrl))
            {
                throw new Exception("Configuration value data_api_url not found!");
            }

            //Cleanup in order this is re-initialization after crash
            _sellOrderId = -1;
            _buyOrderId = -1;
            _counter = 0;

            _requestor = new RippleApi(_config, _logger, _feeProvider, _txSigner, dataApiUrl, _gateway, _currencyCode);
            _requestor.Init();

            log(String.Format("CST trader started for currency {0} with operative={1}; MinWall={2}; MaxWall={3}",
                              _currencyCode, _operativeAmount, _minWallVolume, _maxWallVolume));
        }
Exemplo n.º 3
0
        public override void Initialize()
        {
            _baseAssetCode = _config.GetValue("base_asset_code");
            _arbAssetCode = _config.GetValue("arbitrage_asset_code");

            _baseGateway = _config.GetValue("base_gateway_address");
            _baseGatewayName = _config.GetValue("base_gateway_name");

            _arbGateway = _config.GetValue("arbitrage_gateway_address");
            _arbGatewayName = _config.GetValue("arbitrage_gateway_name");

            _baseMinPrice = double.Parse(_config.GetValue("min_base_price"));
            _arbMinPrice = double.Parse(_config.GetValue("min_arb_price"));
            _baseMaxPrice = _config.GetValue("max_base_price") != null
                                ? double.Parse(_config.GetValue("max_base_price"))
                                : Double.MaxValue;
            _arbMaxPrice = _config.GetValue("max_arb_price") != null
                            ? double.Parse(_config.GetValue("max_arb_price"))
                            : Double.MaxValue;
            base_threshold = double.Parse(_config.GetValue("base_amount_threshold"));
            arb_threshold = double.Parse(_config.GetValue("arb_amount_threshold"));

            if (null != _config.GetValue("base_min_price_update"))
            {
                _baseMinPriceUpdate = double.Parse(_config.GetValue("base_min_price_update"));
            }
            if (null != _config.GetValue("arb_min_price_update"))
            {
                _arbMinPriceUpdate = double.Parse(_config.GetValue("arb_min_price_update"));
            }

            _intervalMs = 15000;

            string dataApiUrl = _config.GetValue("data_api_url");
            if (String.IsNullOrEmpty(dataApiUrl))
            {
                throw new Exception("Configuration value data_api_url not found!");
            }

            //Cleanup in order this is re-initialization after crash
            _baseOrderId = -1;
            _arbOrderId = -1;
            _counter = 0;

            _baseRequestor = new RippleApi(_config, _logger, _feeProvider, _txSigner, dataApiUrl, _baseGateway, _baseAssetCode);
            _baseRequestor.Init();
            _arbRequestor = new RippleApi(_config, _logger, _feeProvider, _txSigner, dataApiUrl, _arbGateway, _arbAssetCode);
            _arbRequestor.Init();

            log(String.Format("Direct arbitrage trader started for pair {0}.{1} / {2}.{3}; base_min={4:0.0000}; arb_min={5:0.0000}",
                              _baseAssetCode, _baseGatewayName, _arbAssetCode, _arbGatewayName, _baseMinPrice, _arbMinPrice));
        }