开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育
Date

Re: TWS API earning dates..

 

Hi,

?

with Wall Street Horizon subscription, reqFundamentalData(reqId:10000001, Contract:<XOM>, FundamentalType.CalendarReport) gives:

<?xml version="1.0" ?>

<WSHData>

<Company>

<Name>Exxon Mobil Corp.</Name>

<Ticker>XOM</Ticker>

<ISIN>US30231G1022</ISIN>

<Exchange>NYSE</Exchange>

<Country>USA</Country>

<conid>177017693</conid>

<conid>38708363</conid>

<conid>242506913</conid>

<conid>13977</conid>

<conid>12973868</conid>

<EarningsList>

<Earnings>

<Q1>4/30/2021</Q1>

<Q2>7/31/2020</Q2>

<Q3>10/30/2020</Q3>

<TimeZone>EST</TimeZone>

<Q4>2/2/2021</Q4>

<Period>Q1</Period>

<Time>Before Market</Time>

<Etype>Completed</Etype>

<Date>4/30/2021</Date>

<TimeStamp>4/28/2021 5:32:18 PM</TimeStamp>

</Earnings>

</EarningsList>

<EarningsCallList>

<EarningsCall>

<TimeZone>EST</TimeZone>

<GotoBroadcast>http://mmm.wallstreethorizon.com/u.asp?u=379567</GotoBroadcast>

<Time>9:30 AM</Time>

<Date>4/30/2021</Date>

<TimeStamp>4/28/2021 5:32:18 PM</TimeStamp>

</EarningsCall>

</EarningsCallList>

<EarningsCallTranscriptList>

<EarningsCallTranscript>

<TimeZone>EST</TimeZone>

<Period>Q1 2021</Period>

<URL>https://seekingalpha.com/article/4422992-exxon-mobil-corporation-xom-ceo-darren-woods-on-q1-2021-results-earnings-call-transcript?utm_source=wallstreethorizon.com&amp;utm_medium=referral</URL>

<TimeStamp>4/28/2021 5:32:18 PM</TimeStamp>

</EarningsCallTranscript>

</EarningsCallTranscriptList>

<ShareHolderMeetingList>

<ShareHolderMeeting>

<Type>S</Type>

<TimeZone>EST</TimeZone>

<Date>5/26/2021</Date>

<TimeStamp>4/28/2021 5:32:18 PM</TimeStamp>

</ShareHolderMeeting>

</ShareHolderMeetingList>

</Company>

</WSHData>

?


Re: TWS API earning dates..

 

hi Robbo , I tried the same, not getting results, Do I need WSJ subs? I tried it with that too. but not getting

<Annual endMonth="12" fYear="2021" fyNum="0" periodLength="12" periodUnit="MNS">
<Interim endCalYear="2021" endMonth="3" periodLength="3" periodNum="1" periodUnit="MNS" type="Q"/>
<Interim endCalYear="2021" endMonth="6" periodLength="3" periodNum="2" periodUnit="MNS" type="Q"/>
<Interim endCalYear="2021" endMonth="9" periodLength="3" periodNum="3" periodUnit="MNS" type="Q"/>
<Interim endCalYear="2021" endMonth="12" periodLength="3" periodNum="4" periodUnit="MNS" type="Q"/>
?


Re: The 'EtradeOnly' order attribute is not supported.

Nick
 

开云体育

If TWS allows a connection from your version of the API then the attributes themselves are supported. It's particular values of the attributes that are no longer accepted so setting to False is the right thing to do.


On 4/30/2021 3:55 PM, neil@... wrote:

This is untested, but since the two attributes are unsupported, I feel comfortable just setting them to False when I create the order object.
```
order_object = self.create_order(order)
order_object.eTradeOnly = False
order_object.firmQuoteOnly = False
```
The error messages went away.


Re: The 'EtradeOnly' order attribute is not supported.

 

This is untested, but since the two attributes are unsupported, I feel comfortable just setting them to False when I create the order object.
```
order_object = self.create_order(order)
order_object.eTradeOnly = False
order_object.firmQuoteOnly = False
```
The error messages went away.


Re: Long on the stock, want to exit but: Order rejected The contract is not available for short sale

 

开云体育

Ace, my experience of the paper-trading system, which I actively use all day every trading day, would lead me to suggest that it's unlikely that what you describe indicates a flaw in the system. My bet would be that there's something you've overlooked in your program.

?

As a ?general suggestion, I'd say that if you cannot prove from your logs that your position was exactly what you think it was and that your closing order was for exactly that quantity, then you're probably not logging enough information.

?

And if you can prove it from your logs, then you should raise it with IB because I'm quite certain that they'd be keen to know of such a flaw.

?

Richard

?

?

From: [email protected] <[email protected]> On Behalf Of Ace
Sent: 30 April 2021 18:48
To: [email protected]
Subject: Re: [TWS API] Long on the stock, want to exit but: Order rejected The contract is not available for short sale

?

Hi Peter,

I found the paper trading testing of algo to be pretty good...up to now.

Are there other major quirks of the paper trading I should be aware of?

Thank you


Re: Long on the stock, want to exit but: Order rejected The contract is not available for short sale

 

Hi Peter,

I found the paper trading testing of algo to be pretty good...up to now.

Are there other major quirks of the paper trading I should be aware of?

Thank you


Re: Long on the stock, want to exit but: Order rejected The contract is not available for short sale

 

A,? If it's in your paper account, welcome to IB..

If it's production, check that the contractID is the same, and the exchange is right (SMART, or whatever came on the Position record itself). If IB were to think it was a different security, your sell would be from a basis of 0 making it a short.

Otherwise report it IB, and send in your logs.

-Peter


Re: Long on the stock, want to exit but: Order rejected The contract is not available for short sale

 

No, it tried to sell half the position.
A


Re: Long on the stock, want to exit but: Order rejected The contract is not available for short sale

 

Is your algorithm trying to sell more shares than what the position holds? Maybe the fill quantity was slightly smaller than what the algorithm had ordered?

JR


On Thu, Apr 29, 2021 at 09:02 PM, Ace wrote:
Hi,

My algo took a long position on a stock and when target was reached and wanted to exit I got this message:
201 Order rejected - reason:The contract is not available for short sale.

I'm aware of? this message if I want to go short on a stock.
But if I bought and own the shares why does this happen?

The algo runs in paper trading account so is it related?
Can this really happen live?

Thanks
A


Long on the stock, want to exit but: Order rejected The contract is not available for short sale

 

Hi,

My algo took a long position on a stock and when target was reached and wanted to exit I got this message:
201 Order rejected - reason:The contract is not available for short sale.

I'm aware of? this message if I want to go short on a stock.
But if I bought and own the shares why does this happen?

The algo runs in paper trading account so is it related?
Can this really happen live?

Thanks
A


Re: Custom Scanners?

 

Patrick,

Re: "we cannot pull our already made scanners in TWS into Python?"
No, we can not, but we can look inside the already made scanner?to get all the associated attributes names etc.
Click on the floppy-disk icon in the top-right corner of the TWS classic scanner window and choose "Save template":

image.png

and store the file, then look inside that file and you'll see "internals" of your custom scanner:

image.png

Another place to have a sneak-peek inside your TWS scanners is to analyze TWS log lines around the time when you sent the scanner request. It will be serialized to one loong string with all the parameters and their values.

Cheers,
Dmitry Shevkoplyas


On Thu, Apr 29, 2021 at 3:14 PM hymagik via <hymagik=[email protected]> wrote:
On Thu, Apr 29, 2021 at 07:08 AM, Despair wrote:

LOW_OPEN_GAP, HIGH_OPEN_GAP,

Look what you look for.
As stated below also if you make a call to reqScannerParameters()?
You will get back an XML with some specifics related to each classe of instruments
But I suspect that you do not need theses (while they can be helpfull by allowing finer screening based on corporate key factors like DIVYIELD, PRICE_2_SALES, PERATIO

In case you consider it, the answer is something like a series or entries alike this single one below (for STK)

Sorry the "Past" remove some '>' and '<' but you should get the idea.

?? ???? <Instrument
?? ???? ??? <name US Stocks /name>
?? ???? ??? <type STK /type>
?? ???? ??? <filters AFTERHRSCHANGEPERC,AVGOPTVOLUME,AVGPRICETARGET,AVGRATING,AVGTARGET2PRICERATIO,AVGVOLUME,AVGVOLUME_USD,CHANGEOPENPERC,CHANGEPERC,EMA_20,EMA_50,EMA_100,EMA_200,PRICE_VS_EMA_20,PRICE_VS_EMA_50,PRICE_VS_EMA_100,PRICE_VS_EMA_200,DIVIB,DIVYIELD,DIVYIELDIB,FEERATE,FIRSTTRADEDATE,GROWTHRATE,HALTED,HASOPTIONS,HISTDIVIB,HISTDIVYIELDIB,IMBALANCE,IMBALANCEADVRATIOPERC,IMPVOLAT,IMPVOLATOVERHIST,INSIDEROFFLOATPERC,INSTITUTIONALOFFLOATPERC,MACD,MACD_SIGNAL,MACD_HISTOGRAM,MKTCAP,MKTCAP_USD,NEXTDIVAMOUNT,NEXTDIVDATE,NUMPRICETARGETS,NUMRATINGS,NUMSHARESINSIDER,NUMSHARESINSTITUTIONAL,OPENGAPPERC,OPTVOLUME,OPTVOLUMEPCRATIO,PERATIO,PPO,PPO_SIGNAL,PPO_HISTOGRAM,PRICE,PRICE2BK,PRICE2TANBK,PRICERANGE,PRICE_USD,QUICKRATIO,REBATERATE,REGIMBALANCE,REGIMBALANCEADVRATIOPERC,RETEQUITY,SHORTABLESHARES,SHORTSALERESTRICTED,SIC,ISSUER_COUNTRY_CODE,SOCSACT,SOCSNET,STKTYPE,STVOLUME_3MIN,STVOLUME_5MIN,STVOLUME_10MIN,TRADECOUNT,TRADERATE,UNSHORTABLE,VOLUME,VOLUMERATE,VOLUME_USD,RCGLTCLASS,RCGLTENDDATE,RCGLTIVALUE,RCGLTTRADE,RCGITCLASS,RCGITENDDATE,RCGITIVALUE,RCGITTRADE,RCGSTCLASS,RCGSTENDDATE,RCGSTIVALUE,RCGSTTRADE,ESG_SCORE,ESG_COMBINED_SCORE,ESG_CONTROVERSIES_SCORE,ESG_RESOURCE_USE_SCORE,ESG_EMISSIONS_SCORE,ESG_ENV_INNOVATION_SCORE,ESG_WORKFORCE_SCORE,ESG_HUMAN_RIGHTS_SCORE,ESG_COMMUNITY_SCORE,ESG_PRODUCT_RESPONSIBILITY_SCORE,ESG_MANAGEMENT_SCORE,ESG_SHAREHOLDERS_SCORE,ESG_CSR_STRATEGY_SCORE,ESG_ENV_PILLAR_SCORE,ESG_SOCIAL_PILLAR_SCORE,ESG_CORP_GOV_PILLAR_SCORE,IV_RANK13,IV_RANK26,IV_RANK52,IV_PERCENTILE13,IV_PERCENTILE26,IV_PERCENTILE52,HV_RANK13,HV_RANK26,HV_RANK52,HV_PERCENTILE13,HV_PERCENTILE26,HV_PERCENTILE52,PRICE_2_SALES,EQUITY_PER_SHARE,UTILIZATION,SSCORE,SCHANGE,SVSCORE,SVCHANGE /filters>
?? ???? ??? <group STK.GLOBAL /group>
?? ???? ??? <shortName US /shortName>
?? ???? ??? <cloudScanNotSupported false /cloudScanNotSupported>
?? ???? </Instrument>


Re: Reporting Script Code, I think its awesome, you might like it too!

 

Here's a photo of sample output. Just saw the Mark To Market is wrong, should say $2,680 with $378 in Commissions. It's a pretty neat output. You're going to have to go into the code and change that lol.?


code/script in API to close/shutdown TWS

 

Hi Josh/Group,

Please pardon if ever disclosed. Does anyone know if there exists corresponding code/script in API to close/shutdown TWS from within java, i.e. from within an IDE?? Reboot/refresh purposes.?? Please advise. ?


Thank you,
Rv


Re: CANNOT COMPILE C++ CODE WITH VISUAL STUDIO 2017

 

The project come with default SDK /Plateform settings (generally Win 8.1)
This is your responsibility as the owner or teh compiler to setup/reset the proper setting according to your Microsoft SDK setup
Go in project setting and adjust the "Windows SDK version" to something that is suggest By VS because already installed.

Like below



Check also


Which are specifics to my MS VS Studio setting
And it work like a charm with basic projet setup


Re: Do I need to create a GUI for using the IBAPI sample program TestCppClient. Thanks.

 

Yes!

In case you want to dig UI like, run the C# version (if you have VS STudio), it have some UI that may give a seed for something assuming you know or will master a little of C#
But I suspect that as Richard explained it, you need to master the UI yourself, or see

Not sure how official is this shell


Re: Custom Scanners?

 

On Thu, Apr 29, 2021 at 07:08 AM, Despair wrote:

LOW_OPEN_GAP, HIGH_OPEN_GAP,

Look what you look for.
As stated below also if you make a call to reqScannerParameters()?
You will get back an XML with some specifics related to each classe of instruments
But I suspect that you do not need theses (while they can be helpfull by allowing finer screening based on corporate key factors like DIVYIELD, PRICE_2_SALES, PERATIO

In case you consider it, the answer is something like a series or entries alike this single one below (for STK)

Sorry the "Past" remove some '>' and '<' but you should get the idea.

?? ???? <Instrument
?? ???? ??? <name US Stocks /name>
?? ???? ??? <type STK /type>
?? ???? ??? <filters AFTERHRSCHANGEPERC,AVGOPTVOLUME,AVGPRICETARGET,AVGRATING,AVGTARGET2PRICERATIO,AVGVOLUME,AVGVOLUME_USD,CHANGEOPENPERC,CHANGEPERC,EMA_20,EMA_50,EMA_100,EMA_200,PRICE_VS_EMA_20,PRICE_VS_EMA_50,PRICE_VS_EMA_100,PRICE_VS_EMA_200,DIVIB,DIVYIELD,DIVYIELDIB,FEERATE,FIRSTTRADEDATE,GROWTHRATE,HALTED,HASOPTIONS,HISTDIVIB,HISTDIVYIELDIB,IMBALANCE,IMBALANCEADVRATIOPERC,IMPVOLAT,IMPVOLATOVERHIST,INSIDEROFFLOATPERC,INSTITUTIONALOFFLOATPERC,MACD,MACD_SIGNAL,MACD_HISTOGRAM,MKTCAP,MKTCAP_USD,NEXTDIVAMOUNT,NEXTDIVDATE,NUMPRICETARGETS,NUMRATINGS,NUMSHARESINSIDER,NUMSHARESINSTITUTIONAL,OPENGAPPERC,OPTVOLUME,OPTVOLUMEPCRATIO,PERATIO,PPO,PPO_SIGNAL,PPO_HISTOGRAM,PRICE,PRICE2BK,PRICE2TANBK,PRICERANGE,PRICE_USD,QUICKRATIO,REBATERATE,REGIMBALANCE,REGIMBALANCEADVRATIOPERC,RETEQUITY,SHORTABLESHARES,SHORTSALERESTRICTED,SIC,ISSUER_COUNTRY_CODE,SOCSACT,SOCSNET,STKTYPE,STVOLUME_3MIN,STVOLUME_5MIN,STVOLUME_10MIN,TRADECOUNT,TRADERATE,UNSHORTABLE,VOLUME,VOLUMERATE,VOLUME_USD,RCGLTCLASS,RCGLTENDDATE,RCGLTIVALUE,RCGLTTRADE,RCGITCLASS,RCGITENDDATE,RCGITIVALUE,RCGITTRADE,RCGSTCLASS,RCGSTENDDATE,RCGSTIVALUE,RCGSTTRADE,ESG_SCORE,ESG_COMBINED_SCORE,ESG_CONTROVERSIES_SCORE,ESG_RESOURCE_USE_SCORE,ESG_EMISSIONS_SCORE,ESG_ENV_INNOVATION_SCORE,ESG_WORKFORCE_SCORE,ESG_HUMAN_RIGHTS_SCORE,ESG_COMMUNITY_SCORE,ESG_PRODUCT_RESPONSIBILITY_SCORE,ESG_MANAGEMENT_SCORE,ESG_SHAREHOLDERS_SCORE,ESG_CSR_STRATEGY_SCORE,ESG_ENV_PILLAR_SCORE,ESG_SOCIAL_PILLAR_SCORE,ESG_CORP_GOV_PILLAR_SCORE,IV_RANK13,IV_RANK26,IV_RANK52,IV_PERCENTILE13,IV_PERCENTILE26,IV_PERCENTILE52,HV_RANK13,HV_RANK26,HV_RANK52,HV_PERCENTILE13,HV_PERCENTILE26,HV_PERCENTILE52,PRICE_2_SALES,EQUITY_PER_SHARE,UTILIZATION,SSCORE,SCHANGE,SVSCORE,SVCHANGE /filters>
?? ???? ??? <group STK.GLOBAL /group>
?? ???? ??? <shortName US /shortName>
?? ???? ??? <cloudScanNotSupported false /cloudScanNotSupported>
?? ???? </Instrument>


Re: Can a bracket order have two take profit orders to exit a position at two different profit levels?

 

Yeah, AFAIK it's not possible to set different sizes in a simple bracket order so it's pretty perplexing that IB support would suggest that. It is possible with the pair-trade variety of the bracket order but even then the sizes are not set independently but using a beta-ratio.


Re: Model Portfolios functionality in TWS API

 

Is this possible using the TWS API?


Re: Custom Scanners?

 

In addition here are the some specific filters:

ScannerSubscription scannerSubsctiption = new ScannerSubscription();
?
scannerSubsctiption.numberOfRows(scannerResultRows);
scannerSubsctiption.scanCode("HOT_BY_PRICE");
scannerSubsctiption.instrument("STK");
scannerSubsctiption.locationCode("STK.US.MAJOR");
scannerSubsctiption.stockTypeFilter("ALL");
scannerSubsctiption.abovePrice(abovePrice);
scannerSubsctiption.belowPrice(belowPrice);

? ? ? ? ? ? ? ? List<TagValue> scannerTagValues?= Arrays.asList(new TagValue("volumeRateAbove", "2000"));

? ? ? ? ? ? ? ? socket.reqScannerSubscription(scannerId, scannerSubsctiption, null,? scannerTagValues);



Re: Can a bracket order have two take profit orders to exit a position at two different profit levels?

 

Forgot to attached a couple screen grabs.

First the five orders. Please note that 23.1 was placed with a quantity of 500.via the API.



Attempt to change quantity of 23.1 via API fails without error and TWS quanitty field is greyed out.