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
from __future__ import print_function
import hashlib
import hmac
import json
@ -17,7 +18,7 @@ from threading import Thread
import requests
from jwt import PyJWS
from six.moves import input
REST_HOST = 'https://big.one/api/v2/'
@ -121,14 +122,14 @@ class BigoneRestApi(object):
#----------------------------------------------------------------------
def onError(self, code, error):
"""错误回调"""
print 'on error'
print code, error
print('on error')
print(code, error)
#----------------------------------------------------------------------
def onData(self, data, reqid):
"""通用回调"""
print 'on data'
print data, reqid
print('on data')
print(data, reqid)
@ -150,6 +151,4 @@ if __name__ == '__main__':
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
import requests
from six.moves import input
from queue import Queue, Empty
REST_HOST = 'https://api.bithumb.com'
@ -162,4 +163,4 @@ if __name__ == '__main__':
rest.addReq('POST', '/public/ticker/BTC', onBtcTick)
rest.addReq('POST', '/info/account', onAccountInfo, postdict={'currency': 'BTC'})
raw_input()
input()

View File

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

View File

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

View File

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

View File

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