Message-ID: <87vart71ad.fsf@enricoschumann.net>
Date: 2017-03-01T10:13:14Z
From: Enrico Schumann
Subject: Syntax - symbol problem
In-Reply-To: <281ECE85-4B83-4661-9800-EC23C2646C05@infomaniak.ch> (Christian Lear's message of "Wed, 1 Mar 2017 10:46:51 +0100")
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