print() is a function in Python 3

This commit is contained in:
cclauss 2018-08-05 17:13:40 +02:00
parent 8970554c2c
commit fddcb45481
6 changed files with 35 additions and 29 deletions

View File

@ -1,5 +1,6 @@
# encoding: UTF-8 # encoding: UTF-8
from __future__ import print_function
import hashlib import hashlib
import hmac import hmac
import json import json
@ -17,7 +18,7 @@ from threading import Thread
import requests import requests
from jwt import PyJWS from jwt import PyJWS
from six.moves import input
REST_HOST = 'https://big.one/api/v2/' REST_HOST = 'https://big.one/api/v2/'
@ -121,14 +122,14 @@ class BigoneRestApi(object):
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def onError(self, code, error): def onError(self, code, error):
"""错误回调""" """错误回调"""
print 'on error' print('on error')
print code, error print(code, error)
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def onData(self, data, reqid): def onData(self, data, reqid):
"""通用回调""" """通用回调"""
print 'on data' print('on data')
print data, reqid print(data, reqid)
@ -150,6 +151,4 @@ if __name__ == '__main__':
rest.addReq('GET', '/viewer/orders', rest.onData) rest.addReq('GET', '/viewer/orders', rest.onData)
raw_input() input()

View File

@ -7,6 +7,7 @@ from multiprocessing.dummy import Pool
from time import time from time import time
import requests import requests
from six.moves import input
from queue import Queue, Empty from queue import Queue, Empty
REST_HOST = 'https://api.bithumb.com' REST_HOST = 'https://api.bithumb.com'
@ -162,4 +163,4 @@ if __name__ == '__main__':
rest.addReq('POST', '/public/ticker/BTC', onBtcTick) rest.addReq('POST', '/public/ticker/BTC', onBtcTick)
rest.addReq('POST', '/info/account', onAccountInfo, postdict={'currency': 'BTC'}) rest.addReq('POST', '/info/account', onAccountInfo, postdict={'currency': 'BTC'})
raw_input() input()

View File

@ -1,5 +1,6 @@
# encoding: UTF-8 # encoding: UTF-8
from __future__ import print_function
import hashlib import hashlib
import hmac import hmac
import json import json
@ -17,6 +18,7 @@ from threading import Thread
import requests import requests
import websocket import websocket
from six.moves import input
REST_HOST = 'https://api.fcoin.com/v2' REST_HOST = 'https://api.fcoin.com/v2'
@ -146,14 +148,14 @@ class FcoinRestApi(object):
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def onError(self, code, error): def onError(self, code, error):
"""错误回调""" """错误回调"""
print 'on error' print('on error')
print code, error print(code, error)
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def onData(self, data, reqid): def onData(self, data, reqid):
"""通用回调""" """通用回调"""
print 'on data' print('on data')
print data, reqid print(data, reqid)
######################################################################## ########################################################################
@ -211,21 +213,21 @@ class FcoinWebsocketApi(object):
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def onConnect(self): def onConnect(self):
"""连接回调""" """连接回调"""
print 'connected' print('connected')
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def onData(self, data): def onData(self, data):
"""数据回调""" """数据回调"""
print '-' * 30 print('-' * 30)
l = data.keys() l = data.keys()
l.sort() l.sort()
for k in l: for k in l:
print k, data[k] print(k, data[k])
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def onError(self, msg): def onError(self, msg):
"""错误回调""" """错误回调"""
print msg print(msg)
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def sendReq(self, req): def sendReq(self, req):
@ -287,6 +289,6 @@ if __name__ == '__main__':
#ws.sendReq(req) #ws.sendReq(req)
raw_input() input()

View File

@ -1,7 +1,9 @@
# encoding: UTF-8 # encoding: UTF-8
from __future__ import print_function
from time import sleep from time import sleep
from six.moves import input
from vnpy.rpc import RpcClient from vnpy.rpc import RpcClient
from vnpy.trader.vtConstant import OFFSET_OPEN, DIRECTION_LONG from vnpy.trader.vtConstant import OFFSET_OPEN, DIRECTION_LONG
@ -18,7 +20,7 @@ class TestClient(RpcClient):
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def callback(self, topic, data): def callback(self, topic, data):
"""回调函数实现""" """回调函数实现"""
print('client received topic:', topic, ', data:', data) print(('client received topic:', topic, ', data:', data))
if __name__ == '__main__': if __name__ == '__main__':
@ -37,10 +39,10 @@ if __name__ == '__main__':
'offset': OFFSET_OPEN 'offset': OFFSET_OPEN
} }
algoName = tc.addAlgo(setting) algoName = tc.addAlgo(setting)
print u'启动算法,实例名', algoName print(u'启动算法,实例名', algoName)
sleep(5) sleep(5)
tc.stopAlgo(algoName) tc.stopAlgo(algoName)
print u'停止算法' print(u'停止算法')
raw_input() input()

View File

@ -3,6 +3,7 @@
''' '''
vnpy.api.bigone的gateway接入 vnpy.api.bigone的gateway接入
''' '''
from __future__ import print_function
import os import os
import json import json
@ -503,9 +504,9 @@ class RestApi(BigoneRestApi):
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def printDict(d): def printDict(d):
"""""" """"""
print '-' * 30 print('-' * 30)
l = d.keys() l = d.keys()
l.sort() l.sort()
for k in l: for k in l:
print k, d[k] print(k, d[k])

View File

@ -3,6 +3,7 @@
''' '''
vnpy.api.fcoin的gateway接入 vnpy.api.fcoin的gateway接入
''' '''
from __future__ import print_function
import os import os
import json import json
@ -573,9 +574,9 @@ class WebsocketApi(FcoinWebsocketApi):
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def printDict(d): def printDict(d):
"""""" """"""
print '-' * 30 print('-' * 30)
l = d.keys() l = d.keys()
l.sort() l.sort()
for k in l: for k in l:
print k, d[k] print(k, d[k])