├── README.md ├── ltcAll.py └── btcAll.py /README.md: -------------------------------------------------------------------------------- 1 | # OkcoinHuobiTickerSpider 2 | 1.okcoin和火币网价格抓取工具,基于公开api借口,抓取频率是1s,使用mysql数据库,使用协程并发框架gevent,使用前请安装相应包。 3 | 2.数据库创建时候,注意创建索引。大概一个月数据量在2G左右(比特币和莱特币都算)。 4 | -------------------------------------------------------------------------------- /ltcAll.py: -------------------------------------------------------------------------------- 1 | from gevent import monkey; monkey.patch_all() 2 | import time 3 | import urllib2 4 | import json 5 | import MySQLdb 6 | import gevent 7 | conn= MySQLdb.connect( 8 | host='127.0.0.1', 9 | port = 3306, 10 | user='root', 11 | passwd='', 12 | db ='ltc', 13 | ) 14 | cur = conn.cursor() 15 | def OkCnSpotTicker(): 16 | # print time.time() 17 | url='https://www.okcoin.cn/api/v1/ticker.do?symbol=ltc_cny' 18 | try: 19 | response = urllib2.urlopen(url) 20 | except urllib2.URLError,e: 21 | if hasattr(e,"reason"): 22 | print "Failed to reach the server" 23 | print "The reason:",e.reason 24 | elif hasattr(e,"code"): 25 | print "The server couldn't fulfill the request" 26 | print "Error code:",e.code 27 | print "Return content:",e.read() 28 | else: 29 | pass 30 | # print time.time() 31 | ret = response.read() 32 | dict = json.loads(ret) 33 | # print(dict["ticker"]["last"]) 34 | date = dict['date'] 35 | buy = dict['ticker']['buy'] 36 | high = dict['ticker']['high'] 37 | last = dict['ticker']['last'] 38 | low = dict['ticker']['low'] 39 | sell = dict['ticker']['sell'] 40 | vol = dict['ticker']['vol'] 41 | sqli= "insert into okcnspotticker(date,ticker_buy,ticker_high,ticker_last,ticker_low,ticker_sell,ticker_vol) values ('%s','%s','%s','%s','%s','%s','%s')" %(date,buy,high,last,low,sell,vol) 42 | cur.execute(sqli) 43 | # print time.time() 44 | def OkComSpotTicker(): 45 | url='https://www.okcoin.com/api/v1/ticker.do?symbol=ltc_usd' 46 | try: 47 | response = urllib2.urlopen(url) 48 | except urllib2.URLError,e: 49 | if hasattr(e,"reason"): 50 | print "Failed to reach the server" 51 | print "The reason:",e.reason 52 | elif hasattr(e,"code"): 53 | print "The server couldn't fulfill the request" 54 | print "Error code:",e.code 55 | print "Return content:",e.read() 56 | else: 57 | pass 58 | ret = response.read() 59 | dict = json.loads(ret) 60 | # print(dict["ticker"]["last"]) 61 | date = dict['date'] 62 | buy = dict['ticker']['buy'] 63 | high = dict['ticker']['high'] 64 | last = dict['ticker']['last'] 65 | low = dict['ticker']['low'] 66 | sell = dict['ticker']['sell'] 67 | vol = dict['ticker']['vol'] 68 | sqli= "insert into okcomspotticker(date,ticker_buy,ticker_high,ticker_last,ticker_low,ticker_sell,ticker_vol) values ('%s','%s','%s','%s','%s','%s','%s')" %(date,buy,high,last,low,sell,vol) 69 | cur.execute(sqli) 70 | def OkComFutureTickerThisWeek(): 71 | url='https://www.okcoin.com/api/v1/future_ticker.do?symbol=ltc_usd&contract_type=this_week' 72 | try: 73 | response = urllib2.urlopen(url) 74 | except urllib2.URLError,e: 75 | if hasattr(e,"reason"): 76 | print "Failed to reach the server" 77 | print "The reason:",e.reason 78 | elif hasattr(e,"code"): 79 | print "The server couldn't fulfill the request" 80 | print "Error code:",e.code 81 | print "Return content:",e.read() 82 | else: 83 | pass 84 | ret = response.read() 85 | dict = json.loads(ret) 86 | # print(dict["ticker"]["last"]) 87 | date = dict['date'] 88 | buy = dict['ticker']['buy'] 89 | high = dict['ticker']['high'] 90 | last = dict['ticker']['last'] 91 | low = dict['ticker']['low'] 92 | sell = dict['ticker']['sell'] 93 | vol = dict['ticker']['vol'] 94 | contract_id = dict['ticker']['contract_id'] 95 | unit_amount = dict['ticker']['unit_amount'] 96 | sqli= "insert into okcomfuturetickerthisweek(date,ticker_buy,ticker_high,ticker_last,ticker_low,ticker_sell,ticker_vol,ticker_contract_id,ticker_unit_amount) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s')" %(date,buy,high,last,low,sell,vol,contract_id,unit_amount) 97 | cur.execute(sqli) 98 | def OkComFutureTickerNextWeek(): 99 | url='https://www.okcoin.com/api/v1/future_ticker.do?symbol=ltc_usd&contract_type=next_week' 100 | try: 101 | response = urllib2.urlopen(url) 102 | except urllib2.URLError,e: 103 | if hasattr(e,"reason"): 104 | print "Failed to reach the server" 105 | print "The reason:",e.reason 106 | elif hasattr(e,"code"): 107 | print "The server couldn't fulfill the request" 108 | print "Error code:",e.code 109 | print "Return content:",e.read() 110 | else: 111 | pass 112 | ret = response.read() 113 | dict = json.loads(ret) 114 | # print(dict["ticker"]["last"]) 115 | date = dict['date'] 116 | buy = dict['ticker']['buy'] 117 | high = dict['ticker']['high'] 118 | last = dict['ticker']['last'] 119 | low = dict['ticker']['low'] 120 | sell = dict['ticker']['sell'] 121 | vol = dict['ticker']['vol'] 122 | contract_id = dict['ticker']['contract_id'] 123 | unit_amount = dict['ticker']['unit_amount'] 124 | sqli= "insert into okcomfuturetickernextweek(date,ticker_buy,ticker_high,ticker_last,ticker_low,ticker_sell,ticker_vol,ticker_contract_id,ticker_unit_amount) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s')" %(date,buy,high,last,low,sell,vol,contract_id,unit_amount) 125 | cur.execute(sqli) 126 | def OkComFutureTickerQuarter(): 127 | url='https://www.okcoin.com/api/v1/future_ticker.do?symbol=ltc_usd&contract_type=quarter' 128 | try: 129 | response = urllib2.urlopen(url) 130 | except urllib2.URLError,e: 131 | if hasattr(e,"reason"): 132 | print "Failed to reach the server" 133 | print "The reason:",e.reason 134 | elif hasattr(e,"code"): 135 | print "The server couldn't fulfill the request" 136 | print "Error code:",e.code 137 | print "Return content:",e.read() 138 | else: 139 | pass 140 | ret = response.read() 141 | dict = json.loads(ret) 142 | # print(dict["ticker"]["last"]) 143 | date = dict['date'] 144 | buy = dict['ticker']['buy'] 145 | high = dict['ticker']['high'] 146 | last = dict['ticker']['last'] 147 | low = dict['ticker']['low'] 148 | sell = dict['ticker']['sell'] 149 | vol = dict['ticker']['vol'] 150 | contract_id = dict['ticker']['contract_id'] 151 | unit_amount = dict['ticker']['unit_amount'] 152 | sqli= "insert into okcomfuturetickerquarter(date,ticker_buy,ticker_high,ticker_last,ticker_low,ticker_sell,ticker_vol,ticker_contract_id,ticker_unit_amount) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s')" %(date,buy,high,last,low,sell,vol,contract_id,unit_amount) 153 | cur.execute(sqli) 154 | def HuoCnSpotTicker(): 155 | url='http://api.huobi.com/staticmarket/ticker_ltc_json.js' 156 | try: 157 | response = urllib2.urlopen(url) 158 | except urllib2.URLError,e: 159 | if hasattr(e,"reason"): 160 | print "Failed to reach the server" 161 | print "The reason:",e.reason 162 | elif hasattr(e,"code"): 163 | print "The server couldn't fulfill the request" 164 | print "Error code:",e.code 165 | print "Return content:",e.read() 166 | else: 167 | pass 168 | ret = response.read() 169 | dict = json.loads(ret) 170 | buy = dict['ticker']['buy'] 171 | high = dict['ticker']['high'] 172 | last = dict['ticker']['last'] 173 | low = dict['ticker']['low'] 174 | sell = dict['ticker']['sell'] 175 | vol = dict['ticker']['vol'] 176 | sqli= "insert into huocnspotticker(ticker_buy,ticker_high,ticker_last,ticker_low,ticker_sell,ticker_vol) values ('%s','%s','%s','%s','%s','%s')" %(buy,high,last,low,sell,vol) 177 | cur.execute(sqli) 178 | def BitVcFutureThisTicker(): 179 | url='http://market.bitvc.com/futures/ticker_ltc_week.js' 180 | try: 181 | response = urllib2.urlopen(url) 182 | except urllib2.URLError,e: 183 | if hasattr(e,"reason"): 184 | print "Failed to reach the server" 185 | print "The reason:",e.reason 186 | elif hasattr(e,"code"): 187 | print "The server couldn't fulfill the request" 188 | print "Error code:",e.code 189 | print "Return content:",e.read() 190 | else: 191 | pass 192 | ret = response.read() 193 | 194 | dict = json.loads(ret) 195 | buy = dict['buy'] 196 | high = dict['high'] 197 | last = dict['last'] 198 | low = dict['low'] 199 | sell = dict['sell'] 200 | vol = dict['vol'] 201 | hold = dict['hold'] 202 | ticker_open = dict['open'] 203 | limit_highest_price = dict['limit_highest_price'] 204 | limit_lowest_price = dict['limit_lowest_price'] 205 | contract_type = dict['contract_type'] 206 | contract_id = dict['contract_id'] 207 | ticker_time = dict['time'] 208 | sqli= "insert into bitvcfuturetickerthisweek(buy,high,last,low,sell,vol,hold,open,limit_highest_price,limit_lowest_price,contract_type,contract_id,time) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')" %(buy,high,last,low,sell,vol,hold,ticker_open,limit_highest_price,limit_lowest_price,contract_type,contract_id,ticker_time) 209 | cur.execute(sqli) 210 | def GetNowTime(): 211 | return time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time())) 212 | x = 0 213 | while True: 214 | # x = 0 215 | t1 = time.time() 216 | print x 217 | gevent.joinall([ 218 | gevent.spawn(OkCnSpotTicker), 219 | gevent.spawn(OkComSpotTicker), 220 | gevent.spawn(OkComFutureTickerThisWeek), 221 | gevent.spawn(OkComFutureTickerNextWeek), 222 | gevent.spawn(OkComFutureTickerQuarter), 223 | gevent.spawn(HuoCnSpotTicker), 224 | gevent.spawn(BitVcFutureThisTicker), 225 | ]) 226 | x = x + 1 227 | t2 = time.time() 228 | print t2-t1 229 | # print GetNowTime() 230 | time.sleep(1) 231 | 232 | 233 | -------------------------------------------------------------------------------- /btcAll.py: -------------------------------------------------------------------------------- 1 | from gevent import monkey; monkey.patch_all() 2 | import time 3 | import urllib2 4 | import json 5 | import MySQLdb 6 | import gevent 7 | conn= MySQLdb.connect( 8 | host='127.0.0.1', 9 | port = 3306, 10 | user='root', 11 | passwd='', 12 | db ='btc', 13 | ) 14 | cur = conn.cursor() 15 | def OkCnSpotTicker(): 16 | # print time.time() 17 | url='https://www.okcoin.cn/api/v1/ticker.do?symbol=btc_cny' 18 | try: 19 | response = urllib2.urlopen(url) 20 | except urllib2.URLError,e: 21 | if hasattr(e,"reason"): 22 | print "Failed to reach the server" 23 | print "The reason:",e.reason 24 | elif hasattr(e,"code"): 25 | print "The server couldn't fulfill the request" 26 | print "Error code:",e.code 27 | print "Return content:",e.read() 28 | else: 29 | pass 30 | # print time.time() 31 | ret = response.read() 32 | dict = json.loads(ret) 33 | # print(dict["ticker"]["last"]) 34 | date = dict['date'] 35 | buy = dict['ticker']['buy'] 36 | high = dict['ticker']['high'] 37 | last = dict['ticker']['last'] 38 | low = dict['ticker']['low'] 39 | sell = dict['ticker']['sell'] 40 | vol = dict['ticker']['vol'] 41 | sqli= "insert into okcnspotticker(date,ticker_buy,ticker_high,ticker_last,ticker_low,ticker_sell,ticker_vol) values ('%s','%s','%s','%s','%s','%s','%s')" %(date,buy,high,last,low,sell,vol) 42 | cur.execute(sqli) 43 | # print time.time() 44 | def OkComSpotTicker(): 45 | url='https://www.okcoin.com/api/v1/ticker.do?symbol=btc_usd' 46 | try: 47 | response = urllib2.urlopen(url) 48 | except urllib2.URLError,e: 49 | if hasattr(e,"reason"): 50 | print "Failed to reach the server" 51 | print "The reason:",e.reason 52 | elif hasattr(e,"code"): 53 | print "The server couldn't fulfill the request" 54 | print "Error code:",e.code 55 | print "Return content:",e.read() 56 | else: 57 | pass 58 | ret = response.read() 59 | dict = json.loads(ret) 60 | # print(dict["ticker"]["last"]) 61 | date = dict['date'] 62 | buy = dict['ticker']['buy'] 63 | high = dict['ticker']['high'] 64 | last = dict['ticker']['last'] 65 | low = dict['ticker']['low'] 66 | sell = dict['ticker']['sell'] 67 | vol = dict['ticker']['vol'] 68 | sqli= "insert into okcomspotticker(date,ticker_buy,ticker_high,ticker_last,ticker_low,ticker_sell,ticker_vol) values ('%s','%s','%s','%s','%s','%s','%s')" %(date,buy,high,last,low,sell,vol) 69 | cur.execute(sqli) 70 | def OkComFutureTickerThisWeek(): 71 | url='https://www.okcoin.com/api/v1/future_ticker.do?symbol=btc_usd&contract_type=this_week' 72 | try: 73 | response = urllib2.urlopen(url) 74 | except urllib2.URLError,e: 75 | if hasattr(e,"reason"): 76 | print "Failed to reach the server" 77 | print "The reason:",e.reason 78 | elif hasattr(e,"code"): 79 | print "The server couldn't fulfill the request" 80 | print "Error code:",e.code 81 | print "Return content:",e.read() 82 | else: 83 | pass 84 | ret = response.read() 85 | dict = json.loads(ret) 86 | # print(dict["ticker"]["last"]) 87 | date = dict['date'] 88 | buy = dict['ticker']['buy'] 89 | high = dict['ticker']['high'] 90 | last = dict['ticker']['last'] 91 | low = dict['ticker']['low'] 92 | sell = dict['ticker']['sell'] 93 | vol = dict['ticker']['vol'] 94 | contract_id = dict['ticker']['contract_id'] 95 | unit_amount = dict['ticker']['unit_amount'] 96 | sqli= "insert into okcomfuturetickerthisweek(date,ticker_buy,ticker_high,ticker_last,ticker_low,ticker_sell,ticker_vol,ticker_contract_id,ticker_unit_amount) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s')" %(date,buy,high,last,low,sell,vol,contract_id,unit_amount) 97 | cur.execute(sqli) 98 | def OkComFutureTickerNextWeek(): 99 | url='https://www.okcoin.com/api/v1/future_ticker.do?symbol=btc_usd&contract_type=next_week' 100 | try: 101 | response = urllib2.urlopen(url) 102 | except urllib2.URLError,e: 103 | if hasattr(e,"reason"): 104 | print "Failed to reach the server" 105 | print "The reason:",e.reason 106 | elif hasattr(e,"code"): 107 | print "The server couldn't fulfill the request" 108 | print "Error code:",e.code 109 | print "Return content:",e.read() 110 | else: 111 | pass 112 | ret = response.read() 113 | dict = json.loads(ret) 114 | # print(dict["ticker"]["last"]) 115 | date = dict['date'] 116 | buy = dict['ticker']['buy'] 117 | high = dict['ticker']['high'] 118 | last = dict['ticker']['last'] 119 | low = dict['ticker']['low'] 120 | sell = dict['ticker']['sell'] 121 | vol = dict['ticker']['vol'] 122 | contract_id = dict['ticker']['contract_id'] 123 | unit_amount = dict['ticker']['unit_amount'] 124 | sqli= "insert into okcomfuturetickernextweek(date,ticker_buy,ticker_high,ticker_last,ticker_low,ticker_sell,ticker_vol,ticker_contract_id,ticker_unit_amount) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s')" %(date,buy,high,last,low,sell,vol,contract_id,unit_amount) 125 | cur.execute(sqli) 126 | def OkComFutureTickerQuarter(): 127 | url='https://www.okcoin.com/api/v1/future_ticker.do?symbol=btc_usd&contract_type=quarter' 128 | try: 129 | response = urllib2.urlopen(url) 130 | except urllib2.URLError,e: 131 | if hasattr(e,"reason"): 132 | print "Failed to reach the server" 133 | print "The reason:",e.reason 134 | elif hasattr(e,"code"): 135 | print "The server couldn't fulfill the request" 136 | print "Error code:",e.code 137 | print "Return content:",e.read() 138 | else: 139 | pass 140 | ret = response.read() 141 | dict = json.loads(ret) 142 | # print(dict["ticker"]["last"]) 143 | date = dict['date'] 144 | buy = dict['ticker']['buy'] 145 | high = dict['ticker']['high'] 146 | last = dict['ticker']['last'] 147 | low = dict['ticker']['low'] 148 | sell = dict['ticker']['sell'] 149 | vol = dict['ticker']['vol'] 150 | contract_id = dict['ticker']['contract_id'] 151 | unit_amount = dict['ticker']['unit_amount'] 152 | sqli= "insert into okcomfuturetickerquarter(date,ticker_buy,ticker_high,ticker_last,ticker_low,ticker_sell,ticker_vol,ticker_contract_id,ticker_unit_amount) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s')" %(date,buy,high,last,low,sell,vol,contract_id,unit_amount) 153 | cur.execute(sqli) 154 | def HuoCnSpotTicker(): 155 | url='http://api.huobi.com/staticmarket/ticker_btc_json.js' 156 | try: 157 | response = urllib2.urlopen(url) 158 | except urllib2.URLError,e: 159 | if hasattr(e,"reason"): 160 | print "Failed to reach the server" 161 | print "The reason:",e.reason 162 | elif hasattr(e,"code"): 163 | print "The server couldn't fulfill the request" 164 | print "Error code:",e.code 165 | print "Return content:",e.read() 166 | else: 167 | pass 168 | ret = response.read() 169 | dict = json.loads(ret) 170 | buy = dict['ticker']['buy'] 171 | high = dict['ticker']['high'] 172 | last = dict['ticker']['last'] 173 | low = dict['ticker']['low'] 174 | sell = dict['ticker']['sell'] 175 | vol = dict['ticker']['vol'] 176 | sqli= "insert into huocnspotticker(ticker_buy,ticker_high,ticker_last,ticker_low,ticker_sell,ticker_vol) values ('%s','%s','%s','%s','%s','%s')" %(buy,high,last,low,sell,vol) 177 | cur.execute(sqli) 178 | def HuoComSpotTicker(): 179 | url='http://api.huobi.com/usdmarket/ticker_btc_json.js' 180 | try: 181 | response = urllib2.urlopen(url) 182 | except urllib2.URLError,e: 183 | if hasattr(e,"reason"): 184 | print "Failed to reach the server" 185 | print "The reason:",e.reason 186 | elif hasattr(e,"code"): 187 | print "The server couldn't fulfill the request" 188 | print "Error code:",e.code 189 | print "Return content:",e.read() 190 | else: 191 | pass 192 | ret = response.read() 193 | dict = json.loads(ret) 194 | buy = dict['ticker']['buy'] 195 | high = dict['ticker']['high'] 196 | last = dict['ticker']['last'] 197 | low = dict['ticker']['low'] 198 | sell = dict['ticker']['sell'] 199 | vol = dict['ticker']['vol'] 200 | sqli= "insert into huocomspotticker(ticker_buy,ticker_high,ticker_last,ticker_low,ticker_sell,ticker_vol) values ('%s','%s','%s','%s','%s','%s')" %(buy,high,last,low,sell,vol) 201 | cur.execute(sqli) 202 | def BitVcFutureThisTicker(): 203 | 204 | url='http://market.bitvc.com/futures/ticker_btc_week.js' 205 | try: 206 | response = urllib2.urlopen(url) 207 | except urllib2.URLError,e: 208 | if hasattr(e,"reason"): 209 | print "Failed to reach the server" 210 | print "The reason:",e.reason 211 | elif hasattr(e,"code"): 212 | print "The server couldn't fulfill the request" 213 | print "Error code:",e.code 214 | print "Return content:",e.read() 215 | else: 216 | pass 217 | ret = response.read() 218 | 219 | dict = json.loads(ret) 220 | buy = dict['buy'] 221 | high = dict['high'] 222 | last = dict['last'] 223 | low = dict['low'] 224 | sell = dict['sell'] 225 | vol = dict['vol'] 226 | hold = dict['hold'] 227 | ticker_open = dict['open'] 228 | limit_highest_price = dict['limit_highest_price'] 229 | limit_lowest_price = dict['limit_lowest_price'] 230 | contract_type = dict['contract_type'] 231 | contract_id = dict['contract_id'] 232 | ticker_time = dict['time'] 233 | sqli= "insert into bitvcfuturetickerthisweek(buy,high,last,low,sell,vol,hold,open,limit_highest_price,limit_lowest_price,contract_type,contract_id,time) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')" %(buy,high,last,low,sell,vol,hold,ticker_open,limit_highest_price,limit_lowest_price,contract_type,contract_id,ticker_time) 234 | cur.execute(sqli) 235 | def BitVcFutureNextTicker(): 236 | url='http://market.bitvc.com/futures/ticker_btc_next_week.js' 237 | try: 238 | response = urllib2.urlopen(url) 239 | except urllib2.URLError,e: 240 | if hasattr(e,"reason"): 241 | print "Failed to reach the server" 242 | print "The reason:",e.reason 243 | elif hasattr(e,"code"): 244 | print "The server couldn't fulfill the request" 245 | print "Error code:",e.code 246 | print "Return content:",e.read() 247 | else: 248 | pass 249 | ret = response.read() 250 | dict = json.loads(ret) 251 | buy = dict['buy'] 252 | high = dict['high'] 253 | last = dict['last'] 254 | low = dict['low'] 255 | sell = dict['sell'] 256 | vol = dict['vol'] 257 | hold = dict['hold'] 258 | ticker_open = dict['open'] 259 | limit_highest_price = dict['limit_highest_price'] 260 | limit_lowest_price = dict['limit_lowest_price'] 261 | contract_type = dict['contract_type'] 262 | contract_id = dict['contract_id'] 263 | ticker_time = dict['time'] 264 | sqli= "insert into bitvcfuturetickernextweek(buy,high,last,low,sell,vol,hold,open,limit_highest_price,limit_lowest_price,contract_type,contract_id,time) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')" %(buy,high,last,low,sell,vol,hold,ticker_open,limit_highest_price,limit_lowest_price,contract_type,contract_id,ticker_time) 265 | cur.execute(sqli) 266 | def GetNowTime(): 267 | return time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time())) 268 | x = 0 269 | while True: 270 | # x = 0 271 | t1 = time.time() 272 | print x 273 | gevent.joinall([ 274 | gevent.spawn(OkCnSpotTicker), 275 | gevent.spawn(OkComSpotTicker), 276 | gevent.spawn(OkComFutureTickerThisWeek), 277 | gevent.spawn(OkComFutureTickerNextWeek), 278 | gevent.spawn(OkComFutureTickerQuarter), 279 | gevent.spawn(HuoCnSpotTicker), 280 | gevent.spawn(HuoComSpotTicker), 281 | gevent.spawn(BitVcFutureThisTicker), 282 | gevent.spawn(BitVcFutureNextTicker), 283 | ]) 284 | x = x + 1 285 | t2 = time.time() 286 | print t2-t1 287 | # print GetNowTime() 288 | time.sleep(1) 289 | 290 | 291 | --------------------------------------------------------------------------------