Search results

  1. C

    How to loop through contractDetails to get option prices?

    Oh no you used the right word. I just chose to use a dataframe instead of a list, basically I made a table with columns "strike | right | expiry..." and iterate through each row. I haven't figured out which is faster though, will have to compare performance with a list but I don't think it's...
  2. C

    How to loop through contractDetails to get option prices?

    Thanks I used a dataframe instead of a list and that worked. Only problem now is I'm getting errors "Error: 641 101 Max number of tickers has been reached" Don't know if I can solve that by using a timer so there is more time in between each request. I also obviously don't need to request...
  3. C

    How to loop through contractDetails to get option prices?

    I want to call reqContractDetails() to get many different option strikes and expiry dates. Then use those to get the option prices. So for e.g I pass everything except for strike, and right (call or put) for 2020 to reqContractDetails. It then returns a list of all the different options in 2020...
  4. C

    How to loop through contractDetails to get option prices?

    Ok my bad. The error is that I'm not able to take the results from reqContractDetails() and use them as inputs for reqMktData()
  5. C

    How to loop through contractDetails to get option prices?

    How do I pass the attributes to tickPrice()? I don't think I explained myself well. I know which attributes I need, and how to get them. Right now I'm storing them in a dataframe. I just am not able to pass them from contractDetails() to tickPrice(). I've tried nesting tickPrice() in...
  6. C

    How to loop through contractDetails to get option prices?

    I tested it before to get the right parameters. it works if I set the parameters from the get go, but I want to loop through the different parameters from contractDetails
  7. C

    How to loop through contractDetails to get option prices?

    I want to call contractDetails and feed the values from there ('right', 'lastTradeDateOrContractMonth', and 'strike') into tickPrice to get the option prices. How do I update the "contract" in the contractDetails function? Right now it tells me "contract is not defined". Which I understand why...
  8. C

    How to export contractDetails to csv from TWS API in Python>?

    Thanks that worked. Just had to change app.outCsv = csv.writer(open(r"mycsv.csv",'wb')) to app.outCsv = csv.writer(open(r"mycsv.csv",'w')) or else it throws a "binary" typeerror
  9. C

    How to export contractDetails to csv from TWS API in Python>?

    I get an error "NameError: name 'self' is not defined" from the line " self.outCsv = csv.writer(open(r"mycsv.csv",'wb'))" in the main() function.
  10. C

    How to export contractDetails to csv from TWS API in Python>?

    I'm trying to export data from "contractDetails" to csv. So far I've only managed to make it rewrite itself and print out the last line from contractDetails. Here is the relevant code: class TestApp(EWrapper, EClient): def __init__(self): EWrapper.__init__(self)...
  11. C

    Why does tickGeneric print multiple times?

    a) I get "Error: 1 321 Error validating request:-'bW' : cause - Snapshot market data subscription is not applicable to generic ticks" b) I get "tickType 24" for each IV value. Am I supposed to use one "reqMktData()" function for all the market requests?
  12. C

    Why does tickGeneric print multiple times?

    That makes sense, one time I ran it and the last value printed was different than the first 5. It always prints 6 times though, like that's a default or something. Is there a way to stop it after it runs once? I suppose if I'll be saving it to a variable it doesn't really matter how many times...
  13. C

    Why does tickGeneric print multiple times?

    + tickPrice just prints once. I don't get why it prints IV first, then tickPrice. I would've assumed tickPrice and tickGeneric would run one after the other
  14. C

    Why does tickGeneric print multiple times?

    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...
  15. C

    How to disconnect from TWS

    T Thank you that solution to install an older version worked.
  16. C

    How to disconnect from TWS

    Is there a simple script to run to disconnect? It comes with a connection script, but replacing connect() with disconnect() doesn't seem to be the solution.
  17. C

    How to disconnect from TWS

    I've been trying out scripts to get a feel of using the API, and in the process of changing the client ID I now have several connections through port 7497. How can I disconnect from them? Either one at a time or all at once? Here is what I've tried without success: from ibapi.client import...
  18. C

    Python API will print the first time only

    Ok I see, thank you. It now seems to work when I change the Client ID to a random number. I was trying with just changing it from 0 to 1 before but maybe 1 is already used? Anyway if I just put 110 or something instead it works now. I still haven't gotten it to work with the cancelreq and...
  19. C

    Python API will print the first time only

    Yes and I'm following the IB tutorial to the letter from youtube here: I've updated my code with the app.disconnect() and app.cancelHistorialData() as well. I still get the same thing. The code runs with no errors. In TWS shows no connections prior to running the script, then it shows...
  20. C

    Python API will print the first time only

    Debug what? I've literally copied the code from IB's webinar here: https://www.youtube.com/watch?v=dzOilFBDmJI&list=PL71vNXrERKUpPreMb3z1WGx6fOTCzMaH1 It runs without errors. What would I debug? I ran it in PyCharm (a real IDE) too and it also ran with no errors. There are no errors in the...
Back
Top