Recent content by chami

  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
Back
Top