softwarespartan / IB4m

Interactive Brokers API for Matlab
GNU General Public License v2.0
62 stars 21 forks source link

Please enter a valid security type #60

Open lopezfelipe93 opened 4 years ago

lopezfelipe93 commented 4 years ago

Hello Abel, Thanks for the framework it is a great way for mac users to connect to IB since the trading toolbox is not enabled for mac.

I'm getting this message error while working the Historical Data Example and I can't seem to work around it. Can you give me some insight please?

session.eClientSocket.reqHistoricalData(1000001,contract,'20141230 16:00:00','1 Y','1 day','TRADES',1,1,false,[]); pause(0.5);

1000001 321 Error validating request:-'bP' : cause - Please enter a valid security type

Thanks a lot.

softwarespartan commented 4 years ago

Hi Felipe

Thanks for reaching out.

Are you able to share how the contract was configured? This usually means that contract.secType() has not been set/configured properly.

Be sure to check out the IB API docs here:

https://interactivebrokers.github.io/tws-api/basic_contracts.html

For example:

contract.secType("STK");
contract.currency("USD");
contract.exchange("SMART");
contract.primaryExch("ISLAND");
lopezfelipe93 commented 4 years ago

Thanks for replying,

The issue is when working with ISLAND I get an error of no market permission.

162 Historical Market Data Service error message:No market data permissions for ISLAND STK

softwarespartan commented 4 years ago

Yep, that is a valid error. This happens when your IB account doesn’t have the right permissions to access certain data.

See the docs here:

https://interactivebrokers.github.io/tws-api/market_data.html

Historical market data has same subscription requirements.

On Aug 3, 2019, at 12:15 PM, lopezfelipe93 notifications@github.com wrote:

Thanks for replying,

The issue is when working with ISLAND I get an error of no market permission.

162 Historical Market Data Service error message:No market data permissions for ISLAND STK

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/softwarespartan/IB4m/issues/60?email_source=notifications&email_token=ABC2VVDB5ADXVLNEOBELGGDQCWVKVA5CNFSM4IJDKWHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3PRI7I#issuecomment-517936253, or mute the thread https://github.com/notifications/unsubscribe-auth/ABC2VVBY25TIZNCJR64I6ODQCWVKVANCNFSM4IJDKWHA.

lopezfelipe93 commented 4 years ago

Oh I see, I'm using a demo account while I get to know around the API so I guess I need a full account to work this examples?

Thanks a lot for your help

ecpgieicg commented 4 years ago

@lopezfelipe93 Since you have received a valid error from the server, you can get more info by reaching out to the IB customer service. ext 5 for api/software support. One of the things the API support is able to do is to tell you what each error code means and where to look such things up. That's a good resource to keep in mind.