public void btcchina_btc_cny_trade() { string max_id = BtcHelper.get_trade_max_id("btcchina"); string result = BtcchinaApi.trade_by_id(Pair.btc_cny.ToString(), max_id); BsonArray list = MongoHelper.get_array_from_str(result); for (int i = 0; i < list.Count; i++) { BtcHelper.insert_trade("btcchina", list[i]["tid"].ToString(), list[i]["date"].ToString() + "000", list[i]["price"].ToString(), list[i]["amount"].ToString(), list[i]["type"].ToString(), "btc_cny", "btc"); } }
public void okcoin_cn_btc_cny_trade() { string max_id = BtcHelper.get_trade_max_id("okcoin_cn"); string result = OkcCNApi.trade(max_id); BsonArray list = MongoHelper.get_array_from_str(result); for (int i = 0; i < list.Count; i++) { BtcHelper.insert_trade("okcoin_cn", list[i]["tid"].ToString(), list[i]["date_ms"].ToString(), list[i]["price"].ToString(), list[i]["amount"].ToString(), list[i]["type"].ToString(), "btc_cny", "btc"); } }
public void get_data_trade() { string max_id = BtcHelper.get_trade_max_id("btcchina"); string sql = "select * from trade_btcchina where tid={0}"; sql = string.Format(sql, max_id); DataTable dt_temp = SQLServerHelper.get_table(sql); sb.Append("BTCCHINA".PR(10) + dt_temp.Rows[0]["tid"].ToString().PR(15) + UnixTime.get_local_time_long(Convert.ToUInt64(dt_temp.Rows[0]["time"].ToString())).ToString("yyyy-MM-dd HH:mm:ss") + M.N); max_id = BtcHelper.get_trade_max_id("okcoin_cn"); sql = "select * from trade_okcoin_cn where tid={0}"; sql = string.Format(sql, max_id); dt_temp = SQLServerHelper.get_table(sql); sb.Append("OKCOIN_CN:".PR(10) + dt_temp.Rows[0]["tid"].ToString().PR(15) + UnixTime.get_local_time_long(Convert.ToUInt64(dt_temp.Rows[0]["time"].ToString())).ToString("yyyy-MM-dd HH:mm:ss") + M.N); this.txt_result.Text = sb.PRINT(); if (cb_btcchina_btc_cny_trade.Checked) { Thread thread_btcchina_btc_cny_trade = new Thread(new ThreadStart(btcchina_btc_cny_trade)); thread_btcchina_btc_cny_trade.Start(); } if (cb_okcoin_cn_btc_cny_trade.Checked) { Thread thread_okcoin_cn_btc_cny_trade = new Thread(new ThreadStart(okcoin_cn_btc_cny_trade)); thread_okcoin_cn_btc_cny_trade.Start(); } }