Quantcast

Syntax - symbol problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Syntax - symbol problem

Christian Lear
Hi,

I’m using Interactive Brokers (IB) data feed running through R code (R studio) with moving average filters on futures contracts.

I have listed the contracts in an excel sheet.  The sheet has 4 columns, contract (or ticker) i.e. “CLJ7" for April 2007 Crude Oil, Security Type “Future”, Exchange “NYMEX” and Use 1 or 0 to activate the excel line (contract) or not.  

My program works perfectly for Nymex energy contracts (CL, NG, RB, HO), Nymex metals (GC, SI, etc.), Globex mini S&P (ES).  However, the program stops working and has an error when running Globex Euro FX (6E), Japanese Yen (6J) and the other currencies.  Note that the currency contracts have the same syntax as the Nymex Energy, and Nymex metals, namely “TickerMonthYear" (6EM7, CLJ7, GCJ7 etc.)  

1.  Does anyone know why the program fails to recognize the currency futures contracts?  Any suggestions?

Grains are also a problem.  IB uses a different symbol structure, namely Ticker MONth YEar  “ZS MONabbrev YEar” (ZS JUL 17).

2.  How would you solve for one code to read both the CL contracts and the Grains ticker, knowing that the symbol structure is different?  Any ideas?

I can send a short code and excel sheet test list to better demonstrate the issue.  

Thanks for your help.

Christian

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Syntax - symbol problem

Enrico Schumann-2
On Wed, 01 Mar 2017, Christian Lear writes:

> Hi,
>
> I’m using Interactive Brokers (IB) data feed running through R code (R
> studio) with moving average filters on futures contracts.
>
> I have listed the contracts in an excel sheet.  The sheet has 4
> columns, contract (or ticker) i.e. “CLJ7" for April 2007 Crude Oil,
> Security Type “Future”, Exchange “NYMEX” and Use 1 or 0 to activate
> the excel line (contract) or not.
>
> My program works perfectly for Nymex energy contracts (CL, NG, RB,
> HO), Nymex metals (GC, SI, etc.), Globex mini S&P (ES).  However, the
> program stops working and has an error when running Globex Euro FX
> (6E), Japanese Yen (6J) and the other currencies.  Note that the
> currency contracts have the same syntax as the Nymex Energy, and Nymex
> metals, namely “TickerMonthYear" (6EM7, CLJ7, GCJ7 etc.)
>
> 1.  Does anyone know why the program fails to
> recognize the currency futures contracts?  Any
> suggestions?
>
> Grains are also a problem.  IB uses a different symbol structure,
> namely Ticker MONth YEar “ZS MONabbrev YEar” (ZS JUL 17).
>
> 2.  How would you solve for one code to read both the
> CL contracts and the Grains ticker, knowing that the
> symbol structure is different?  Any ideas?
>
> I can send a short code and excel sheet test list to better
> demonstrate the issue.
>
> Thanks for your help.
>
> Christian
>

1) In my experience, you need four attributes to
   reliably specify a contract: the local symbol, the
   exchange, the currency and the security type. For
   6E futures, that would mean

   symbol = 6EH7
   exchange = GLOBEX
   currency = USD
   type = FUT

2) An easy and _safe_ way is to keep a list/database of
   contracts with the four mentioned attributes, and
   then refer to this list when contract information is
   needed.


--
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Syntax - symbol problem

Christian Lear
Thank you, Enrico, for your suggestion.

It does not seem to get the data from IB on the currency contracts.  Looking at the database / list closer, the second page defining the moving averages has a default USD input.  So I do have 4 attributes, which may be the reason I am getting data for metals and energies.  If anyone out there is using IB successfully on currency futures contracts, grains and options on all of the above, thanks for letting me know outside of the mailing list to avoid clogging it.

Cheers,

Christian

> On Mar 1, 2017, at 11:13 AM, Enrico Schumann <[hidden email]> wrote:
>
> On Wed, 01 Mar 2017, Christian Lear writes:
>
>> Hi,
>>
>> I’m using Interactive Brokers (IB) data feed running through R code (R
>> studio) with moving average filters on futures contracts.
>>
>> I have listed the contracts in an excel sheet.  The sheet has 4
>> columns, contract (or ticker) i.e. “CLJ7" for April 2007 Crude Oil,
>> Security Type “Future”, Exchange “NYMEX” and Use 1 or 0 to activate
>> the excel line (contract) or not.
>>
>> My program works perfectly for Nymex energy contracts (CL, NG, RB,
>> HO), Nymex metals (GC, SI, etc.), Globex mini S&P (ES).  However, the
>> program stops working and has an error when running Globex Euro FX
>> (6E), Japanese Yen (6J) and the other currencies.  Note that the
>> currency contracts have the same syntax as the Nymex Energy, and Nymex
>> metals, namely “TickerMonthYear" (6EM7, CLJ7, GCJ7 etc.)
>>
>> 1.  Does anyone know why the program fails to
>> recognize the currency futures contracts?  Any
>> suggestions?
>>
>> Grains are also a problem.  IB uses a different symbol structure,
>> namely Ticker MONth YEar “ZS MONabbrev YEar” (ZS JUL 17).
>>
>> 2.  How would you solve for one code to read both the
>> CL contracts and the Grains ticker, knowing that the
>> symbol structure is different?  Any ideas?
>>
>> I can send a short code and excel sheet test list to better
>> demonstrate the issue.
>>
>> Thanks for your help.
>>
>> Christian
>>
>
> 1) In my experience, you need four attributes to
>   reliably specify a contract: the local symbol, the
>   exchange, the currency and the security type. For
>   6E futures, that would mean
>
>   symbol = 6EH7
>   exchange = GLOBEX
>   currency = USD
>   type = FUT
>
> 2) An easy and _safe_ way is to keep a list/database of
>   contracts with the four mentioned attributes, and
>   then refer to this list when contract information is
>   needed.
>
>
> --
> Enrico Schumann
> Lucerne, Switzerland
> http://enricoschumann.net
>

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Syntax - symbol problem

Adrian Trapletti-2
In reply to this post by Christian Lear
Christian,

In some old configuration file, I found the following for IB currency futures:

Symbol,Expiry,Exchange,Type
EUR,201206,GLOBEX,FUT

Maybe it helps.

Dr. Adrian Trapletti

Steinstrasse 9b, 8610 Uster, Switzerland
P +41 44 994 56 30  |  M +41 79 103 71 31
[hidden email]  |  www.trapletti.org

On Thu, Mar 2, 2017 at 12:00 PM, <[hidden email]> wrote:

>
>
> Message: 1
> Date: Wed, 1 Mar 2017 22:26:52 +0100
> From: Christian Lear <[hidden email]>
> To: Enrico Schumann <[hidden email]>
> Cc: [hidden email]
> Subject: Re: [R-SIG-Finance] Syntax - symbol problem
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset=utf-8
>
> Thank you, Enrico, for your suggestion.
>
> It does not seem to get the data from IB on the currency contracts.  Looking at the database / list closer, the second page defining the moving averages has a default USD input.  So I do have 4 attributes, which may be the reason I am getting data for metals and energies.  If anyone out there is using IB successfully on currency futures contracts, grains and options on all of the above, thanks for letting me know outside of the mailing list to avoid clogging it.
>
> Cheers,
>
> Christian
>
> > On Mar 1, 2017, at 11:13 AM, Enrico Schumann <[hidden email]> wrote:
> >
> > On Wed, 01 Mar 2017, Christian Lear writes:
> >
> >> Hi,
> >>
> >> I?m using Interactive Brokers (IB) data feed running through R code (R
> >> studio) with moving average filters on futures contracts.
> >>
> >> I have listed the contracts in an excel sheet.  The sheet has 4
> >> columns, contract (or ticker) i.e. ?CLJ7" for April 2007 Crude Oil,
> >> Security Type ?Future?, Exchange ?NYMEX? and Use 1 or 0 to activate
> >> the excel line (contract) or not.
> >>
> >> My program works perfectly for Nymex energy contracts (CL, NG, RB,
> >> HO), Nymex metals (GC, SI, etc.), Globex mini S&P (ES).  However, the
> >> program stops working and has an error when running Globex Euro FX
> >> (6E), Japanese Yen (6J) and the other currencies.  Note that the
> >> currency contracts have the same syntax as the Nymex Energy, and Nymex
> >> metals, namely ?TickerMonthYear" (6EM7, CLJ7, GCJ7 etc.)
> >>
> >> 1.  Does anyone know why the program fails to
> >> recognize the currency futures contracts?  Any
> >> suggestions?
> >>
> >> Grains are also a problem.  IB uses a different symbol structure,
> >> namely Ticker MONth YEar ?ZS MONabbrev YEar? (ZS JUL 17).
> >>
> >> 2.  How would you solve for one code to read both the
> >> CL contracts and the Grains ticker, knowing that the
> >> symbol structure is different?  Any ideas?
> >>
> >> I can send a short code and excel sheet test list to better
> >> demonstrate the issue.
> >>
> >> Thanks for your help.
> >>
> >> Christian
> >>
> >
> > 1) In my experience, you need four attributes to
> >   reliably specify a contract: the local symbol, the
> >   exchange, the currency and the security type. For
> >   6E futures, that would mean
> >
> >   symbol = 6EH7
> >   exchange = GLOBEX
> >   currency = USD
> >   type = FUT
> >
> > 2) An easy and _safe_ way is to keep a list/database of
> >   contracts with the four mentioned attributes, and
> >   then refer to this list when contract information is
> >   needed.
> >
> >
> > --
> > Enrico Schumann
> > Lucerne, Switzerland
> > http://enricoschumann.net
> >

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Buying at Current Close Price

Diego Peroni
Hi everybody,

can help me to understand exactly how this rule works?

add.rule(my.strategy, name='ruleSignal',
          arguments = list(sigcol='upTrend', sigval=TRUE,
                           replace=TRUE,
                           prefer='open',
                           orderside='long',
                           ordertype='stoplimit',
order.price=quote(mktdata$close[timestamp]),
                           orderqty=1,
                           time.in.force=180),
          type='enter',
          label='LE')

More in detail if price is 100,00$ at signal time (timestamp), does this
rule buy JUST if price will be 100,00$ or MORE within 3 minutes after
current bar?

Does prefer='open' anticipate buying if price is the same at next open bar?

Thanks in advance for your help

Regards

Diego

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Loading...