public static bool GetPoloniexInitData() { dynamic ticker = JsonConvert.DeserializeObject(WebReq("https://poloniex.com/public?command=returnTicker")); dynamic currencies = JsonConvert.DeserializeObject(WebReq("https://poloniex.com/public?command=returnCurrencies")); var exchange = GlobalData.Exchange.Poloniex; GlobalData db = GlobalData.Instance; decimal transactionFee = 0.0025M; //hard coded taker fee of 0.25%. this lowers once volume goes over 600btc($1 800 000 as of his writing) per month //coin black list //disabled means transfers/withdrawls, frozen means market frozen. //just avoid both for now. foreach (var coin in currencies) { if (coin.First.disabled.Value == 1 || coin.First.frozen.Value == 1) { db.AddCoinToBlckList(new Currency(coin.Name, exchange)); } } //transaction black list //N/A. well.. this could be done from the frozen coins but it already get removed for now //master transaction list foreach (var trans in ticker) { Transaction transactionBuilder = new Transaction(); Currency currencyBuilder = new Currency(); string[] pairParser; pairParser = trans.Name.Split('_'); //TODO: add more information about currencies to init phase currencyBuilder.symbol = pairParser[1]; currencyBuilder.exchange = exchange; db.AddCurrencyToMasterList(currencyBuilder); transactionBuilder.baseCurrency = currencyBuilder; currencyBuilder = new Currency(); currencyBuilder.exchange = exchange; currencyBuilder.symbol = pairParser[0]; db.AddCurrencyToMasterList(currencyBuilder); transactionBuilder.quoteCurrency = currencyBuilder; //transactionBuilder.bid = decimal.Parse(trans.First.highestBid.Value); //transactionBuilder.ask = decimal.Parse(trans.First.lowestAsk.Value); transactionBuilder.identifier = trans.Name.ToString(); transactionBuilder.transactionType = Transaction.type.Trade; db.AddTransactionToMasterlist(transactionBuilder); } return(true); }
public static bool GetBittrexInitData() { dynamic ticker = JsonConvert.DeserializeObject(WebReq("https://bittrex.com/api/v1.1/public/getmarketsummaries")); dynamic transactions = JsonConvert.DeserializeObject(WebReq("https://bittrex.com/api/v1.1/public/getmarkets")); dynamic currencies = JsonConvert.DeserializeObject(WebReq("https://bittrex.com/api/v1.1/public/getcurrencies ")); var exchange = GlobalData.Exchange.Bittrex; GlobalData db = GlobalData.Instance; //coin black list foreach (var coin in currencies.result) { if (coin.IsActive.Value != true) { db.AddCoinToBlckList(new Currency(coin.Currency.Value, exchange)); } } //transaction black list //TODO: this needs to be done //foreach(var t in transactions.result) //{ // if(!t.IsActive) // { // db.AddTransactionToBlckList(new Transaction( // } //} //master transaction list foreach (var trans in ticker.result) { Transaction transactionBuilder = new Transaction(); Currency currencyBuilder = new Currency(); string[] pairParser; pairParser = trans.MarketName.Value.Split('-'); currencyBuilder.symbol = pairParser[1]; currencyBuilder.exchange = exchange; transactionBuilder.baseCurrency = currencyBuilder; currencyBuilder = new Currency(); currencyBuilder.symbol = pairParser[0]; currencyBuilder.exchange = exchange; transactionBuilder.quoteCurrency = currencyBuilder; //transactionBuilder.bid = decimal.Parse(trans.Bid.Value.ToString(), System.Globalization.NumberStyles.Float); //transactionBuilder.ask = decimal.Parse(trans.Ask.Value.ToString(), System.Globalization.NumberStyles.Float); transactionBuilder.identifier = trans.MarketName.Value.ToString(); transactionBuilder.transactionType = Transaction.type.Trade; db.AddTransactionToMasterlist(transactionBuilder); } return(true); }
public static bool GetCryptopiaInitData() { dynamic ticker = JsonConvert.DeserializeObject(WebReq("https://www.cryptopia.co.nz/api/GetMarkets")); dynamic currencies = JsonConvert.DeserializeObject(WebReq("https://www.cryptopia.co.nz/api/GetCurrencies")); var exchange = GlobalData.Exchange.Cryptopia; GlobalData db = GlobalData.Instance; //coin black list foreach (var coin in currencies.Data) { if (coin.Status.Value != "OK") { db.AddCoinToBlckList(new Currency(coin.Symbol.Value, exchange)); } } //transaction black list //master transaction list foreach (var trans in ticker.Data) { Transaction transactionBuilder = new Transaction(); Currency currencyBuilder = new Currency(); string[] pairParser; pairParser = trans.Label.Value.Split('/'); currencyBuilder.symbol = pairParser[0]; currencyBuilder.exchange = exchange; transactionBuilder.baseCurrency = currencyBuilder; currencyBuilder = new Currency(); currencyBuilder.symbol = pairParser[1]; currencyBuilder.exchange = exchange; transactionBuilder.quoteCurrency = currencyBuilder; //transactionBuilder.bid = decimal.Parse(trans.BidPrice.Value.ToString(),System.Globalization.NumberStyles.Float); //transactionBuilder.ask = decimal.Parse(trans.AskPrice.Value.ToString(),System.Globalization.NumberStyles.Float); transactionBuilder.identifier = trans.TradePairId.Value.ToString(); transactionBuilder.transactionType = Transaction.type.Trade; db.AddTransactionToMasterlist(transactionBuilder); } return(true); }