亲爱的交易者和API大师,
感谢你在前进。
背景:
在Visual Studio 2010中,C#语言,ActiveX的OCX API作为项目的参考。 在先后使用像reqAccountUpdate所提供的API的方法和使用事件接收有关帐户的更新信息。问题:
现在,我想需要大约像一个外汇对一个特定的金融工具的数据:AUD.USD一个。第1步:继承TWSLib类IContract的界面我的code是这里的图片和构造函数是具体的AUD.USD:
正如你可以看到,我修改了私有对象_combolLegs私人TWSLib.IComboLeg _comboLegs
乙。第2步:我也继承IComboleg和IUpdateComp到ComboLeg和UpdateComp,我不指定任何价值,他们,因为他们是没有关系的 到了AUD.USD外汇交易。
℃。现在,我创建了合同的实例,并尝试分配所需的所有信息,外汇合约,并提交我的查询。
Ð。它是一个运行时错误。请点击这里查看图片:
这似乎是我创建不能由API作为正式IContract实例接受合同的实例。从任何.NET大师知不知道?)
感谢很多提前再次,
谦逊的学习者。
灏
修改
有关IContract的细节我的一切SOFAR
解决方案
//试着改变你实现,你必须在接口/ CLASE方式
// - VAR auduse =新合同();
//根据装箱和拆箱从这个角度扭转它并执行以下操作
IContract iaudUse =新合同();
//那么你可以使用iaudUse。什么都的方法在你想要使用的接口。
Dear all trader and API Gurus,
Thank you in advance.
Background:
Visual Studio 2010, C# Language, ActiveX OCX API as reference of project. Successively to use the method provided by API like reqAccountUpdate and use the event to receive information about account update.Issue:
Now I would like to require data about one specific financial instrument like a forex pair: AUD.USD .a. Step 1: Inherit the interface of class IContract from TWSLib my Code is here as a picture and the constructor is specific for AUD.USD:
As you can see that I have change the private object _combolLegs to private TWSLib.IComboLeg _comboLegs
b. Step 2: I also inherit the IComboleg and IUpdateComp to ComboLeg and UpdateComp and I do not assign any value to them since they are not related to the the AUD.USD forex trading.
c. Now I create a instance of contract and try to assign all information forex contract required for and submit my query.
d. it is a runtime error. Please check the picture here:
It seems like the contract instance I created could not be accepted by the api as formal IContract instance. Any idea from any .NET gurus?:)
Thanks lot in advance again,
Humble learner.
Wenhao
Edit
about the detail of IContract all I got sofar
解决方案
//Try changing the way that you implement the Interface / Clase where you have
// -- var auduse = new Contract();
//depending on boxing and unboxing from this point try to reverse it and do the following
IContract iaudUse = new Contract();
//then you would use iaudUse. what ever method in the Interface that you are wanting to use.