Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Manipulating FinancialData[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106464] Re: [mg106365] Re: Manipulating FinancialData[]
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Wed, 13 Jan 2010 05:59:53 -0500 (EST)
  • Reply-to: hanlonr at cox.net

With the use of Members you can then get the symbols for the exchanges with

Clear[dc, sym]

dc[x_?VectorQ] :=
 DeleteCases[x, _?(StringFreeQ[#, ":"] &)]

exch = FinancialData["Exchanges"];

sym[exchange_?(MemberQ[exch, #] &)] := sym[exchange] =
  StringReplace[First[dc[
     FinancialData[exchange, "Members"]]],
   ":" ~~ __ -> ""]

sym /@ {"Bombay", "Frankfurt"}

{BO,F}


Bob Hanlon

---- Drago Ganic <dganic at vodatel.net> wrote: 

=============
Hi Syd,
to retrieve the financial instruments You should use the "Members" property 
of the group "Exchanges" and not the "Lookup" command.

So, this does not work:
    FinancialData["exchangeCode:*", "Lookup"]

but this
    FinancialData["exchangeName", "Members"]

will work because FinancialData["Exchanges"] returns a list of Exchange 
names (which work with "Members") and not Exchange codes (which work with 
Lookup"). Unfortunatly there is no simple functionality in FinancialData to 
extract the Exchange codes.

This code should work (except for bugs in FinancialData like 
FinancialData["^ASIN"] etc.):
==================================================
Manipulate[
 Column[{
   Row[{"FinancialData[", ToString[financialInstrumentName], "] = ",
     FinancialData[financialInstrumentName]}],
   Row[{"\nProperty = ", ToString[property]}],
   Row[{"\nfinancialDataExchange = ",
     ToString[financialDataExchange]}],
   Row[{"\nFinancialData[", ToString[financialInstrumentName],
     "," ToString[property], "] = ",
     FinancialData[financialInstrumentName, property]}]}
  ],
 {{financialDataExchange, "NASDAQ", "Exchange List"},
  FinancialData["Exchanges"]}, {{financialInstrumentName,
   "NASDAQ:AAPL", "Financial Instrument List"},
  FinancialData[financialDataExchange, "Members"]}, {{property,
   "Close", "Property List"}, FinancialData["Properties"]}]

Greetings from Croatia,
Drago

"Syd Geraghty" <sydgeraghty at me.com> wrote in message 
news:hi6t7r$a7u$1 at smc.vnet.net...
> Hi all,
>
> I have got stuck trying to play around with manipulating FinancialData[]!
>
> Manipulate[Column[{
>   Row[{"FinancialData[", ToString[financialInstrumentName], "] = ",
>     FinancialData[financialInstrumentName]}],
>   Row[{"\nProperty = ", ToString[property]}],
>   Row[{"\nfinancialDataExchange = ", ToString[financialDataExchange]}],
>   Row[{"\nFinancialData[", ToString[financialInstrumentName],
>     "," ToString[property], "] = ",
>     FinancialData[financialInstrumentName, property]}]
>                                     }],
> {{financialDataExchange, "NASDAQ", "Exchange List"},
>  FinancialData["Exchanges"]}, {{financialInstrumentName, "NASDAQ:AAPL",
>   "Financial Instrument List"},
>  FinancialData["NASDAQ:*", "Lookup"]}, {{property, "Close", "Property 
> List"},
>   FinancialData["Properties"]}]
>
>
> is a simple example which enables me to select an Exchange List, Financial 
> Instrument List, and a Property List.
>
> But I really want the Financial Instrument List to be derived from the 
> selected Exchange List when I subsequently select a member of that List. 
> (e.g. "ExchangeList Selection:Stock Name").
>
> So I tried variants of the following without success:
>
> Manipulate[Column[{
>   Row[{"FinancialData[", ToString[financialInstrumentName], "] = ",
>     FinancialData[financialInstrumentName]}],
>   Row[{"\nProperty = ", ToString[property]}],
>   Row[{"\nfinancialDataExchange = ", ToString[financialDataExchange]}],
>   Row[{"\nFinancialData[", ToString[financialInstrumentName],
>     "," ToString[property], "] = ",
>     FinancialData[financialInstrumentName, property]}]
>                                     }],
> {{financialDataExchange, "NASDAQ", "Exchange List"},
>  FinancialData["Exchanges"]}, {{financialInstrumentName, "NASDAQ:AAPL",
>   "Financial Instrument List"},
>  FinancialData[ToString[financialDataExchange <> ":" <> "*"],
>   "Lookup"]}, {{property, "Close", "Property List"},
>  FinancialData["Properties"]}]
>
>
> What I am trying to do probably becomes clearer after using the Manipulate 
> output from the 1st piece of code:
>
> After the 1st evaluation, which by default selects NASDAQ:AAPL, then 
> select another member of the Exchange List, say Singapore.
>
> What I want is for the Financial Instrument List to then allow selections 
> from the revised  list such as Singapore:AAPL, Singapore:AATI, Singapore: 
> .....
>
> I would appreciate help in solving this seemingly simple requirement.
>
>
> Cheers .... Syd
>
> Syd Geraghty B.Sc, M.Sc.
>
> sydgeraghty at mac.com
>
> Mathematica 7.0.1.0 for Mac OS X x86 (64 - bit) (12th September 2009)
> MacOS X V 10.6.1 Snow Leopard
> MacBook Pro 2.33 GHz Intel Core 2 Duo  2GB RAM
>


  • Prev by Date: Re: More /.{I->-1} craziness
  • Next by Date: Re: NonlinearModelFit and ParameterTable
  • Previous by thread: Re: Manipulating FinancialData[]
  • Next by thread: Re: export differential equation solution obtained through Mathematica