Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Commit

Permalink
generate code passes pyflakes
Browse files Browse the repository at this point in the history
  • Loading branch information
blampe committed Jul 24, 2012
1 parent 47ca450 commit 36d5020
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
8 changes: 3 additions & 5 deletions ib/ext/EClientSocket.py
Expand Up @@ -15,7 +15,6 @@

from logging import debug

from ib.ext.AnyWrapper import AnyWrapper
from ib.ext.ComboLeg import ComboLeg
from ib.ext.EClientErrors import EClientErrors
from ib.ext.EReader import EReader
Expand All @@ -25,7 +24,6 @@
from ib.lib import synchronized, Socket, DataInputStream, DataOutputStream
from ib.lib import Double, Integer

from socket import SHUT_RDWR
from threading import RLock
mlock = RLock()

Expand Down Expand Up @@ -144,7 +142,7 @@ def eConnect(self, host, port, clientId):
try:
socket = Socket(host, port)
self.eConnect(socket, clientId)
except (Exception, ), e:
except (Exception, ):
self.eDisconnect()
self.connectionError()

Expand Down Expand Up @@ -197,12 +195,12 @@ def eDisconnect(self):
try:
if self.reader is not None:
self.reader.interrupt()
except (Exception, ), e:
except (Exception, ):
pass
try:
if dos is not None:
dos.close()
except (Exception, ), e:
except (Exception, ):
pass

@synchronized(mlock)
Expand Down
6 changes: 4 additions & 2 deletions ib/ext/EReader.py
Expand Up @@ -24,6 +24,8 @@
from ib.ext.TickType import TickType
from ib.ext.UnderComp import UnderComp
from ib.ext.Util import Util
from ib.ext.TagValue import TagValue
from ib.ext.EClientErrors import EClientErrors

from ib.lib.logger import logger

Expand Down Expand Up @@ -391,14 +393,14 @@ def processMsg(self, msgId):
if not Util.StringIsEmpty(order.m_algoStrategy):
algoParamsCount = self.readInt()
if algoParamsCount > 0:
order.m_algoParams = Vector(algoParamsCount)
order.m_algoParams = list()
## for-while
i = 0
while i < algoParamsCount:
tagValue = TagValue()
tagValue.m_tag = self.readStr()
tagValue.m_value = self.readStr()
order.m_algoParams.add(tagValue)
order.m_algoParams.append(tagValue)
i += 1
orderState = OrderState()
if version >= 16:
Expand Down
8 changes: 5 additions & 3 deletions ib/ext/EWrapperMsgGenerator.py
Expand Up @@ -15,6 +15,8 @@

from ib.ext.AnyWrapperMsgGenerator import AnyWrapperMsgGenerator
from ib.ext.Util import Util
from ib.ext.TickType import TickType
from ib.ext.EClientSocket import EClientSocket

class EWrapperMsgGenerator(AnyWrapperMsgGenerator):
""" generated source for EWrapperMsgGenerator
Expand Down Expand Up @@ -42,7 +44,7 @@ def tickOptionComputation(cls, tickerId,
vega,
theta,
undPrice):
toAdd = "id=" + tickerId + " " + TickType.getField(field) + ": vol = " + Double.toString(impliedVol) if impliedVol >= 0 and (impliedVol != Double.MAX_VALUE) else "N/A" + " delta = " + Double.toString(delta) if Math.abs(delta) <= 1 else "N/A" + " gamma = " + Double.toString(gamma) if Math.abs(gamma) <= 1 else "N/A" + " vega = " + Double.toString(vega) if Math.abs(vega) <= 1 else "N/A" + " theta = " + Double.toString(theta) if Math.abs(theta) <= 1 else "N/A" + " optPrice = " + Double.toString(optPrice) if optPrice >= 0 and (optPrice != Double.MAX_VALUE) else "N/A" + " pvDividend = " + Double.toString(pvDividend) if pvDividend >= 0 and (pvDividend != Double.MAX_VALUE) else "N/A" + " undPrice = " + Double.toString(undPrice) if undPrice >= 0 and (undPrice != Double.MAX_VALUE) else "N/A"
toAdd = "id=" + tickerId + " " + TickType.getField(field) + ": vol = " + (impliedVol if impliedVol >= 0 and (impliedVol != float('inf')) else "N/A") + " delta = " + (delta if abs(delta) <= 1 else "N/A") + " gamma = " + (gamma if abs(gamma) <= 1 else "N/A") + " vega = " + (vega if abs(vega) <= 1 else "N/A") + " theta = " + (theta if abs(theta) <= 1 else "N/A") + " optPrice = " + (optPrice if optPrice >= 0 and (optPrice != float('inf')) else "N/A") + " pvDividend = " + (pvDividend if pvDividend >= 0 and (pvDividend != float('inf')) else "N/A") + " undPrice = " + (undPrice if undPrice >= 0 and (undPrice != float('inf')) else "N/A")
return toAdd

@classmethod
Expand Down Expand Up @@ -84,7 +86,7 @@ def openOrder(cls, orderId, contract, order, orderState):
if "BAG" == contract.m_secType:
if contract.m_comboLegsDescrip is not None:
msg += " comboLegsDescrip=" + contract.m_comboLegsDescrip
if (order.m_basisPoints != Double.MAX_VALUE):
if (order.m_basisPoints != float('inf')):
msg += " basisPoints=" + order.m_basisPoints
msg += " basisPointsType=" + order.m_basisPointsType
if contract.m_underComp is not None:
Expand Down Expand Up @@ -251,7 +253,7 @@ def scannerDataEnd(cls, reqId):

@classmethod
def currentTime(cls, time):
return "current time = " + time + " (" + DateFormat.getDateTimeInstance().format(Date(time * 1000)) + ")"
return "current time = " + time

@classmethod
def fundamentalData(cls, reqId, data):
Expand Down
1 change: 1 addition & 0 deletions ib/ext/TagValue.py
Expand Up @@ -14,6 +14,7 @@
# WARNING: all changes to this file will be lost.

from ib.lib.overloading import overloaded
from ib.ext.Util import Util

class TagValue(object):
""" generated source for TagValue
Expand Down

0 comments on commit 36d5020

Please sign in to comment.