コード例 #1
0
ファイル: Coin.cs プロジェクト: Serghii/Rig
    public override int GetHashCode()
    {
        int hash = 13;

        hash = (hash * 7) + Name.GetHashCode();
        hash = (hash * 7) + Hashrate.GetHashCode();
        return(hash);
    }
コード例 #2
0
        private async Task RunExample()
        {
            // Using the ApiCredentials Class
            // Client = new Api(new ApiCredentials(CexUsername, CexApiKey, CexApiSecret));
            // Or not
            // CexClient = new CexApi(CexUsername, CexApiKey, CexApiSecret);
            // ApiCredentials/(Username, ApiKey, ApiSecret) not needed for public functions
            CexClient = new CexApi();

            // Get Ticker Data
            Ticker tickerData = await CexClient.Ticker(SymbolPair.BTC_USD);

            // Get Order Book
            OrderBook orderBook = await CexClient.OrderBook(SymbolPair.BTC_USD);

            // Get Trade history
            IEnumerable <Trade> tradeHistory = await CexClient.TradeHistory(SymbolPair.BTC_USD);

            // ApiCredentials required for user specific calls or "Private Functions"
            CexClient = new CexApi(CexUsername, CexApiKey, CexApiSecret);

            // Get Account Balance
            Balance accountBalance = await CexClient.AccountBalance();

            // Get Open Orders
            IEnumerable <OpenOrder> openOrders = await CexClient.OpenOrders(SymbolPair.LTC_BTC);

            // Place an order
            OpenOrder openOrder = await CexClient.PlaceOrder(
                SymbolPair.BTC_USD,
                new Order
            {
                Amount = 1.00m,
                Price  = 0.04644000m,
                Type   = OrderType.Buy
            });

            // Cancel an order
            bool didSucceed = await CexClient.CancelOrder(openOrder.Id);

            // GHash.IO Example
            GhashClient = new GhashApi(new ApiCredentials(CexUsername, CexApiKey, CexApiSecret));

            // Get Hash Rate
            Hashrate hashrate = await GhashClient.Hashrate();

            // Get Workers Hash Rate
            IEnumerable <KeyValuePair <string, WorkerHashrate> > workerHashRate = await GhashClient.WorkersHashRate();
        }
コード例 #3
0
 private void PrintNetworkInfo()
 {
     _logger.Information("symbol: {0:l} algorithm: {1:l} " +
                         "version: {2:l} protocol: {3} wallet: {4} " +
                         "network difficulty: {5:0.00000000} block difficulty: {6:0.00} network hashrate: {7:l} " +
                         "network: {8:l} peers: {9} blocks: {10} errors: {11:l} ",
                         _poolConfig.Coin.Symbol,
                         _poolConfig.Coin.Algorithm,
                         CoinVersion,
                         ProtocolVersion,
                         WalletVersion,
                         Difficulty,
                         Difficulty * _hashAlgorithm.Multiplier,
                         Hashrate.GetReadableHashrate(),
                         Testnet ? "testnet" : "mainnet",
                         Connections,
                         Round - 1,
                         string.IsNullOrEmpty(Errors) ? "none" : Errors);
 }
コード例 #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = Id;
         hashCode = (hashCode * 397) ^ (ServiceEntry != null ? ServiceEntry.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (PriceId != null ? PriceId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (AlgoName != null ? AlgoName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ UseWindow.GetHashCode();
         hashCode = (hashCode * 397) ^ MinProfit.GetHashCode();
         hashCode = (hashCode * 397) ^ Hashrate.GetHashCode();
         hashCode = (hashCode * 397) ^ Power.GetHashCode();
         hashCode = (hashCode * 397) ^ (Priority != null ? Priority.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Affinity;
         hashCode = (hashCode * 397) ^ (Folder != null ? Folder.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Command != null ? Command.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Arguments != null ? Arguments.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DonationFolder != null ? DonationFolder.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DonationCommand != null ? DonationCommand.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DonationArguments != null ? DonationArguments.GetHashCode() : 0);
         return(hashCode);
     }
 }