Use of TimeSeries

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Use of TimeSeries

colman
Hi all,

The point of this post is to find out how to make the best use of some data I have captured.  For example using it for an option price (by viewing the equityOption example close enough or a martingale path calculation etc).  I don't know for sure at the moment, but some use of this kind.

I have some data with the following format:
Cisco Systems Inc. Registered Shares DL-,001 2012-09-25 20:00:17.897 18.665 USD

When I use a timeseries object my code will look like the following, for 100 values, say:
TimeSeries<double>* ts = new TimeSeries<double>(Date(24,September,2012), values, &values[101]);

I would like to set the time and value more accurately than just to the date and then get an example running with that timeseries.

So I'm looking for
1) How best to pair date with time and value
2)  Which example would be best to modify to work with a list of values, e.g. to calculate an option price


Thanks for reading,
Colman
Reply | Threaded
Open this post in threaded view
|

Re: Use of TimeSeries

Luigi Ballabio
Hi Colman,
    currently we don't have support for time inside a Date instance,
so unfortunately TimeSeries are limited to one entry per day.  If
that's acceptable and you just want to store the time with the value,
you can define a struct holding the time and the value and use a
TimeSeries<YourStruct>.  Otherwise, you'd have to add a time field to
the Date class, but that's a large change since you'd have to keep
track of it in the whole set of Date operations.

As for the example, I'm not sure what you mean by "work with a list of
values, e.g. to calculate an option price".  Anyway, I would probably
write a new example to highlight TimeSeries use, rather than add it to
an existing one (mostly to keep them relatively simple and focused on
just one thing).  The historical backtesting you wrote about might be
such an idea.

Later,
    Luigi


On Thu, Dec 20, 2012 at 5:47 PM, colman <[hidden email]> wrote:

> Hi all,
>
> The point of this post is to find out how to make the best use of some data
> I have captured.  For example using it for an option price (by viewing the
> equityOption example close enough or a martingale path calculation etc).  I
> don't know for sure at the moment, but some use of this kind.
>
> I have some data with the following format:
> Cisco Systems Inc. Registered Shares DL-,001    2012-09-25 20:00:17.897 18.665
> USD
>
> When I use a timeseries object my code will look like the following, for 100
> values, say:
> TimeSeries<double>* ts = new TimeSeries<double>(Date(24,September,2012),
> values, &values[101]);
>
> I would like to set the time and value more accurately than just to the date
> and then get an example running with that timeseries.
>
> So I'm looking for
> 1) How best to pair date with time and value
> 2)  Which example would be best to modify to work with a list of values,
> e.g. to calculate an option price
>
>
> Thanks for reading,
> Colman
>
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Use-of-TimeSeries-tp13815.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Use of TimeSeries

colman
Hi Luigi,


Thanks for the reply!  From what I gather, should a field be set with the time to the second, it wont matter that much.  I had imagined that the quantlib could be used to generate HFT signals.  From my position, I have some data and would like to work with it in the quantlib.  As you may guess, I'm new to the quantlib, so there is much work ahead of me to get to know it.  My starting place, was to try and get some data going into it, get it to compute something of interest (e.g. backtesting), one of the existing examples will probably do fine too, then have a result from these learning tasks.

So right now I don't have any further questions.  

Thanks for the info,
Colman.    
Reply | Threaded
Open this post in threaded view
|

Re: Use of TimeSeries

colman
In reply to this post by Luigi Ballabio
Hi,

Can you tell me, as this library is not setup for intra-day values, say for HFT trading, should the values for the instruments, e.g. EquityOption, be set with EOD values?

Thanks,
Colman
Reply | Threaded
Open this post in threaded view
|

Re: Use of TimeSeries

Luigi Ballabio
I guess it depends on what you want to do.  But yes, EOD values
probably make most sense.


Luigi

On Thu, Jan 24, 2013 at 1:59 PM, colman <[hidden email]> wrote:

> Hi,
>
> Can you tell me, as this library is not setup for intra-day values, say for
> HFT trading, should the values for the instruments, e.g. EquityOption, be
> set with EOD values?
>
> Thanks,
> Colman
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Use-of-TimeSeries-tp13815p13941.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Use of TimeSeries

colman
Hi Luigi,

My goal is unfortunately, quite general, I want to learn how to use the library.  I'm starting with the examples, specifically focused on the equity option example.  
I would like to write something as a proof of ability, such as a back testing tool.

Colman.
Reply | Threaded
Open this post in threaded view
|

Re: Use of TimeSeries

Luigi Ballabio
If I can make a suggestion, time series are about the least relevant
part of the library. If you think you'll be using them a lot, go
ahead; otherwise, I'd try to become familiar with the general
architecture first. For instance, you might read the docs I've
published at <https://sites.google.com/site/luigiballabio/qlbook> to
get the idea.

Luigi


On Thu, Jan 24, 2013 at 2:11 PM, colman <[hidden email]> wrote:

> Hi Luigi,
>
> My goal is unfortunately, quite general, I want to learn how to use the
> library.  I'm starting with the examples, specifically focused on the equity
> option example.
> I would like to write something as a proof of ability, such as a back
> testing tool.
>
> Colman.
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Use-of-TimeSeries-tp13815p13943.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Use of TimeSeries

colman
ok, now you have underlined that address for me, I will pay more attention to them.  Debugging has also been quite good to show the internals.  At some later point I will have to come back to you with a simple sketch, (where & how), of something new to add to the library.  


Many thanks,
Colman
Reply | Threaded
Open this post in threaded view
|

Re: Use of TimeSeries

colman
I am digesting those documents.  Not so far as to setup the pricing engine/instrument with the data I have.  Something did strike me, how is it, there is docs 1 - 4 and 6?  Do you mean it this way or is pdf number five missing?
Reply | Threaded
Open this post in threaded view
|

Re: Use of TimeSeries

Luigi Ballabio
Number 5 is missing because I haven't written it yet :)
You can see it in the table of contents, though.

Luigi

On Tue, Feb 5, 2013 at 4:20 PM, colman <[hidden email]> wrote:

> I am digesting those documents.  Not so far as to setup the pricing
> engine/instrument with the data I have.  Something did strike me, how is it,
> there is docs 1 - 4 and 6?  Do you mean it this way or is pdf number five
> missing?
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Use-of-TimeSeries-tp13815p13998.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013
> and get the hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Use of TimeSeries

colman
This post was updated on .
aha, ok no problem.
Reply | Threaded
Open this post in threaded view
|

Re: Use of TimeSeries

Luigi Ballabio
As I see it:

the current stock value is an observable and will be stored in the
instrument (probably as a Handle<Quote>). Based on this, the
instrument will be able to calculate its own value.

The stock value can then be set different values, which might be those
of past quotes if you're interested in a historical analysis. Every
time it is set to a different value, you'll get back a different
instrument value from the instrument's NPV() method.

To store the stock values and the corresponding values, you can use
vector<Real>, TimeSeries or whatever container you find more
convenient.  But those will be stored outside the instrument.

Luigi



On Tue, Feb 5, 2013 at 4:56 PM, colman <[hidden email]> wrote:

> aha, ok no problem.
>
> I would like to put into text where about I am, as it may help make things
> clearer!
> My goal is, to use my collection of intra-day values to set a parameter such
> as volatility.
>
> As I understand, the stock values of the day are observables which are set
> in the observer (an  instrument).
> These methods in the instrument class seem very interesting:
> setPricingEngine
> setupArguments
>
> The VanillaOption, is a base class for such instruments.
>
> I expect to find/use an object like vector<real>, which can be used to store
> my observables and used in the instruments calculate method.
>
> Does this sound reasonable?
>
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Use-of-TimeSeries-tp13815p14000.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013
> and get the hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Use of TimeSeries

colman
Hi,

Nice explanation.  I got to the bottom of what I wanted to do for the moment by taking a look at the slides with the testingBlackScholesCalculator example.  The spot values get sent in as a changing parameter

From this point of view (your above statement), on how to work with the instruments, I can begin to compute something of interest.


Thanks again,
Colman