本文整理汇总了Java中com.ib.client.ContractDetails类的典型用法代码示例。如果您正苦于以下问题:Java ContractDetails类的具体用法?Java ContractDetails怎么用?Java ContractDetails使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContractDetails类属于com.ib.client包,在下文中一共展示了ContractDetails类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRecUnderDetails
import com.ib.client.ContractDetails; //导入依赖的package包/类
protected void onRecUnderDetails(ArrayList<ContractDetails> list) {
if (list.size() != 1) {
ApiDemo.INSTANCE.show( "Error: " + list.size() + " underlying contracts returned");
return;
}
// request option chains
Contract optContract = new Contract();
optContract.symbol( m_underContract.symbol() );
optContract.currency( m_underContract.currency() );
optContract.exchange( m_optExch.getText() );
optContract.secType( SecType.OPT);
final ChainPanel symbolPanel = new ChainPanel();
m_tabbedPanel.addTab( optContract.symbol(), symbolPanel, true, true);
ApiDemo.INSTANCE.controller().reqContractDetails( optContract, symbolPanel);
}
示例2: onAdd
import com.ib.client.ContractDetails; //导入依赖的package包/类
protected void onAdd() {
Contract dn = new Contract();
dn.symbol( m_symbol.getText().toUpperCase() );
dn.secType( m_secType.getSelectedItem() );
dn.lastTradeDateOrContractMonth( m_lastTradeDateOrContractMonth.getText() );
dn.exchange( m_exchange.getText().toUpperCase() );
dn.currency( m_currency.getText().toUpperCase() );
ApiDemo.INSTANCE.controller().reqContractDetails(dn, new IContractDetailsHandler() {
@Override public void contractDetails(ArrayList<ContractDetails> list) {
if (list.size() == 1) {
Contract c = list.get( 0).contract();
m_dnContract = new DeltaNeutralContract( c.conid(), m_delta.getDouble(), m_price.getDouble() );
m_dnText.setText( String.format( "Delta-neutral: %s Delta: %s Price: %s", c.description(), m_delta.getText(), m_price.getText() ) );
}
else {
ApiDemo.INSTANCE.show( "DN description does not define a uniqe contract");
m_dnContract = null;
m_dnText.setText( null);
}
}
});
}
示例3: onSearch
import com.ib.client.ContractDetails; //导入依赖的package包/类
private void onSearch() {
m_contractPanel.onOK();
m_contract.conid(0);
m_contract.tradingClass(null);
ArrayList<ContractDetails> list = lookupContract();
m_contractList.clear();
for (ContractDetails el : list) {
m_contractList.addElement(el.contract());
}
m_contracts.updateUI();
pack();
}
示例4: contractDetails
import com.ib.client.ContractDetails; //导入依赖的package包/类
@Override public void contractDetails(ArrayList<ContractDetails> list) {
// set label
if (list.size() == 0) {
m_label.setText( "No matching contracts were found");
}
else if (list.size() > 1) {
m_label.setText( list.size() + " contracts returned; showing first contract only");
}
else {
m_label.setText( null);
}
// set text
if (list.size() == 0) {
m_text.setText( null);
}
else {
m_text.setText( list.get( 0).toString() );
}
}
示例5: onBtnPeg2Bench
import com.ib.client.ContractDetails; //导入依赖的package包/类
protected void onBtnPeg2Bench() {
showModalPanelDialog(new CallableWithParam() {@Override
public Object call(Object param) {
return new PegBenchPanel((JDialog)param, m_order, new ContractLookuper() {
@Override
public ArrayList<ContractDetails> lookupContract(Contract contract) {
try {
return m_parent.lookupContract(contract);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new ArrayList<ContractDetails>();
}
});
}
});
}
示例6: onBtnConditions
import com.ib.client.ContractDetails; //导入依赖的package包/类
protected void onBtnConditions() {
showModalPanelDialog(new CallableWithParam() {@Override
public Object call(Object param) {
return new ConditionsPanel((JDialog)param, m_order, new ContractLookuper() {
@Override
public ArrayList<ContractDetails> lookupContract(Contract contract) {
try {
return m_parent.lookupContract(contract);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new ArrayList<ContractDetails>();
}
});
}
});
}
示例7: getContractDetails
import com.ib.client.ContractDetails; //导入依赖的package包/类
/**
*
* @return
*/
public ContractDetails getContractDetails() {
// if (enterOrderRecord != null) {
// return enterOrderRecord.getContractDetails();
// }
//
// if (exitOrderRecord != null) {
// return exitOrderRecord.getContractDetails();
// }
if (!enterOrderRecords.isEmpty()) {
return enterOrderRecords.peek().getContractDetails();
}
if (!exitOrderRecords.isEmpty()) {
return exitOrderRecords.peek().getContractDetails();
}
return null;
}
示例8: setSecondContractDetails
import com.ib.client.ContractDetails; //导入依赖的package包/类
public void setSecondContractDetails(ContractDetails contractDetails) throws Exception {
if (contractDetails == null) {
return;
}
log(Level.INFO,
"secondContractDetails = {0}",
contractDetails.m_summary.m_localSymbol);
this.secondContractDetails = contractDetails;
this.secondContract = contractDetails.m_summary;
//SQL
if (Main.isSavingDataToSql()) {
Main.dataSchema.insertContract(contractDetails.m_summary);
Main.dataSchema.insertContractDetails(contractDetails);
}
}
示例9: initBacktest
import com.ib.client.ContractDetails; //导入依赖的package包/类
/**
* Initialise a backtest based on this strategy.
*
* @param dayId
* @param strategyId
* @param contractDetails
* @param tradingHours
* @param commission
*/
public void initBacktest(int dayId, int strategyId, ContractDetails contractDetails, TradingHours tradingHours, double commission) {
setState(true, State.BACKTESTING);
this.dayId = dayId;
this.strategyId = strategyId;
this.commission = commission;
this.contractDetails = contractDetails;
this.tradingContractDetails = contractDetails;
if (contractDetails != null) {
this.contract = contractDetails.m_summary;
this.tradingContract = contractDetails.m_summary;
}
this.tradingHours = tradingHours;
initPrimaryChart();
primaryChart.setBacktest(true);
addChangeListener(Main.backtestThread);
}
示例10: NewContractDetails
import com.ib.client.ContractDetails; //导入依赖的package包/类
public NewContractDetails( ContractDetails other) {
m_contract = new NewContract( other.m_summary);
m_marketName = other.m_marketName;
m_minTick = other.m_minTick;
m_priceMagnifier = other.m_priceMagnifier;
m_orderTypes = other.m_orderTypes;
m_validExchanges = other.m_validExchanges;
m_underConid = other.m_underConId;
m_longName = other.m_longName;
m_contractMonth = other.m_contractMonth;
m_industry = other.m_industry;
m_category = other.m_category;
m_subcategory = other.m_subcategory;
m_timeZoneId = other.m_timeZoneId;
m_tradingHours = other.m_tradingHours;
m_liquidHours = other.m_liquidHours;
m_evRule = other.m_evRule;
m_evMultiplier = other.m_evMultiplier;
m_secIdList = other.m_secIdList;
m_cusip = other.m_cusip;
m_ratings = other.m_ratings;
m_descAppend = other.m_descAppend;
m_bondType = other.m_bondType;
m_couponType = other.m_couponType;
m_callable = other.m_callable;
m_putable = other.m_putable;
m_coupon = other.m_coupon;
m_convertible = other.m_convertible;
m_maturity = other.m_maturity;
m_issueDate = other.m_issueDate;
m_nextOptionDate = other.m_nextOptionDate;
m_nextOptionType = other.m_nextOptionType;
m_nextOptionPartial = other.m_nextOptionPartial;
m_notes = other.m_notes;
}
示例11: bondContractDetails
import com.ib.client.ContractDetails; //导入依赖的package包/类
@Override public void bondContractDetails(int reqId, ContractDetails contractDetails) {
IInternalHandler handler = m_contractDetailsMap.get( reqId);
if (handler != null) {
handler.contractDetails(new NewContractDetails( contractDetails) );
}
else {
show( "Error: no bond contract details handler for reqId " + reqId);
}
recEOM();
}
示例12: scannerData
import com.ib.client.ContractDetails; //导入依赖的package包/类
@Override public void scannerData(int reqId, int rank, ContractDetails contractDetails, String distance, String benchmark, String projection, String legsStr) {
IScannerHandler handler = m_scannerMap.get( reqId);
if (handler != null) {
handler.scannerData( rank, new NewContractDetails( contractDetails), legsStr);
}
recEOM();
}
示例13: buildComboTicker
import com.ib.client.ContractDetails; //导入依赖的package包/类
@Override
public ComboTicker buildComboTicker(Ticker ticker1, int ratio1, Ticker ticker2, int ratio2) {
ContractDetails details1 = getContractDetails(ticker1);
ContractDetails details2 = getContractDetails(ticker2);
ComboTicker combo = new ComboTicker(ticker1, ticker2);
combo.setContractId1(details1.m_summary.m_conId);
combo.setFirstTickerRatio(ratio1);
combo.setContractId2(details2.m_summary.m_conId);
combo.setSecondTickerRatio(ratio2);
return combo;
}
示例14: contractDetailsReceived
import com.ib.client.ContractDetails; //导入依赖的package包/类
public void contractDetailsReceived(ContractDetails details) {
try {
contractDetailsQueue.put(details);
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例15: getContractDetails
import com.ib.client.ContractDetails; //导入依赖的package包/类
public ContractDetails getContractDetails(Ticker ticker) {
final Contract contract = ContractBuilderFactory.getContractBuilder(ticker).buildContract(ticker);
ibConnection.reqContractDetails(contractRequestId++, contract);
try {
return contractDetailsQueue.poll(2, TimeUnit.SECONDS);
} catch (InterruptedException ex) {
throw new IllegalStateException(ex);
}
}