I'm calling the IV using tickGeneric. It gets the IV but prints it 6 times, not sure why.
It prints it intermixed in the previous function tickPrice as well.
This is my current print out:
The IV is 0.3761491160881086
The IV is 0.3761491160881086
The last price is: 280.19
The IV is 0.3761491160881086
The IV is 0.3761491160881086
The IV is 0.3761491160881086
The current bid price is: 280.0
The current ask price is: 280.2
The IV is 0.3761491160881086
Here is my relevant code:
class TestApp(EWrapper, EClient):
...
def nextValidId(self, orderId):
self.start()
def tickPrice(self, reqId, tickType, price, attrib):
if tickType == 1 and reqId == 1:
print('The current bid price is: ', price)
if tickType == 2 and reqId == 1:
print('The current ask price is: ', price)
if tickType == 4 and reqId == 1:
print('The last price is: ', price)
def tickGeneric(self, reqId, tickType, value):
#super().tickGeneric(reqId, tickType, value)
print("The IV is", value)
...
def start(self):
#self.reqSecDefOptParams(1, "AAPL", "", "STK", 265598)
contract = Contract()
contract.symbol = 'AAPL'
contract.secType = 'STK'
contract.exchange = 'SMART'
contract.currency = 'USD'
contract.primaryExchange = 'NASDAQ'
contract.lastTradeDateOrContractMonth = '202010'
self.reqMktData(1, contract, '106', False, False, [])
def stop(self):
self.done = True
self.disconnect()
It prints it intermixed in the previous function tickPrice as well.
This is my current print out:
The IV is 0.3761491160881086
The IV is 0.3761491160881086
The last price is: 280.19
The IV is 0.3761491160881086
The IV is 0.3761491160881086
The IV is 0.3761491160881086
The current bid price is: 280.0
The current ask price is: 280.2
The IV is 0.3761491160881086
Here is my relevant code:
class TestApp(EWrapper, EClient):
...
def nextValidId(self, orderId):
self.start()
def tickPrice(self, reqId, tickType, price, attrib):
if tickType == 1 and reqId == 1:
print('The current bid price is: ', price)
if tickType == 2 and reqId == 1:
print('The current ask price is: ', price)
if tickType == 4 and reqId == 1:
print('The last price is: ', price)
def tickGeneric(self, reqId, tickType, value):
#super().tickGeneric(reqId, tickType, value)
print("The IV is", value)
...
def start(self):
#self.reqSecDefOptParams(1, "AAPL", "", "STK", 265598)
contract = Contract()
contract.symbol = 'AAPL'
contract.secType = 'STK'
contract.exchange = 'SMART'
contract.currency = 'USD'
contract.primaryExchange = 'NASDAQ'
contract.lastTradeDateOrContractMonth = '202010'
self.reqMktData(1, contract, '106', False, False, [])
def stop(self):
self.done = True
self.disconnect()