DTN ProphetX® Web Services

Search Patterns

PXWeb web services use string pattern matching in some places to make a user's or administrator's job easier.  Patterns can be a powerful feature to help query large numbers of symbols with small wildcard expressions. 

Supported Operations

The search patterns described on this page work in the following operations: GetQuoteSnap, GetOptionGreeks, GetDailyHistory, GetMinuteHistory, GetTickHistory, and GetMarketHours

Special Characters

Patterns are described by some combination of special and normal characters. 
CharacterDefinition
?Match a single character.
<set>Match any single character contained in the set. For example, <0-2> will match with 0, 1, and 2.
{set}Match a substring composed of one or more of the characters described by the set.
#Match one numeric character. (This is equivalent to <0-9>.)
` (backquote)Match one month code letter.  (Month code letters are FGHJKMNQUVXZ, so the backquote is equivalent to <FGHJKMNQUVXZ>.)
' (quote)Match one second year month code letter.  (Second year month code letters are ABCDEILOPRST, so the quote is equivalent to <ABCDEILOPRST>.)
" (doublequote)Match one first or second year month code letter.  (doublequote is equivalent to <ABCDEFGHIJKLMNOPQRSTUVXZ>, or any letter except W and Y).
*Match a substring composed of one or more characters.
^Use a carat as the first character of your pattern to make a case-sensitive match.  (The carat is needed only if your pattern consists of all lowercase or all uppercase letters -- for example, ABC or abc.  By default, patterns containing mixed uppercase and lowercase letters are automatically treated as case sensitive.)
\The escape character.  This removes the special significance of the next character, allowing you to search for it as itself.  For example, \# matches the character # rather than any single numeric character.  To search for the escape character (backslash) itself, enter \\.
&The ampersand character.  The & represents itself with sets.  Outside of sets it is ignored, Unless it occurs within a fixed text substring of the pattern.  In that case, it has the effect of breaking fixed substrings into two substrings for the purpose of matched pattern substitution.  This is used in regular expression reformatting and in symbol translation. See the XLate documentation for examples of this usage.

Character Set Descriptions

^If the first character of a set is carat, then the opposite of set will be matched -- that is, everything except the pattern described by the set.
AA single character represents itself.
A-CTwo characters separated by a hyphen describe themselves and the range of characters between them.  For example, A-C will match A, a, B, b, C, and c.
-A hyphen at the beginning of the set (but after the ^ if there is one) represents itself.
\A backslash escapes the next character's special meaning.  It may be used to add any character to the set, including \ and > and }.

Fixed Substrings

Any substring of the pattern which is not a special character or a character set is considered a fixed substring of the pattern. 

Limits

The pattern can only contain ASCII 1-127. 

A pattern can have up to 10 components, where a component is either a fixed string, a # or * or ?, or a {set}. Multiple adjacent # or * or ? characters are considered a single component. 

The sum of the lengths of the fixed strings in the pattern is limited to about 200 characters (or less if sets are used). 

By default, patterns that consist of all lowercase or all uppercase letters are not case sensitive (AB will match AB, ab, Ab, and aB).  Patterns that consist of mixed cases are case sensitive (Ab will match only Ab). 

Basic Examples

PatternExample Matches
catMatches cat, CAT, Cat, cAt ...
^catMatches cat
cat*Matches cat, cattail, catawba ...
*catMatches cat, deadcat ...
ca*lMatches call, cattail ...
c*#4PMatches cat34P, c99xx234P, and c04P, but does not match c4p, c4P, or c04p
c*{0-9}4pMatches cat34p, c99xx234P, c8384204P
<a-cfr-t>Matches a A b B c C f F r R s S t T
{a-cfr-t}Matches caT, bat, bar, Barf, art, bass ...

Useful Patterns

General PatternSpecific PatternUse
ROOT`##@C`##Find symbols for all maturies for a given futures ROOT symbol.
ROOT`##<CP>{0-9-}QCL`##<CP>{0-9-}Find symbols for all futures options for a given option ROOT symbol
ROOT`##ROOT`##@S`##@S`##Find calendar spread symbols for a given futures ROOT.