# [R-SIG-Finance] Artificial price series

Worik worik.stanton at gmail.com
Tue Apr 19 00:32:25 CEST 2011

```This is very interesting.  My take is that it is futile to try to
generate artificial price series using simple algorithmic processes that
have the properties of real price series.  (Return series are
equivalent, but price series make pretty graphs!)

My reasoning is theoretical so suspect.  Here goes:  Prices are self
referencing systems.  In that they are set by a group of intelligent
agents (not just people, there are plenty of robots with varying degrees
of intelligence trading out there).  They analyse price movements and
the surrounding systems (the "ecosystem" of prices if you like) and the
decisions they make are dependant on all the inputs in a very non-linear
manner.

Sorry that is not clear, I cannot do better right now in an email.

I am not saying that markets (the collection of these agents, their
interactions and the prices that result) are efficient, they are not in
a EMH sense.  I am saying that the price series that results is
unreproducible by simple algorithmic processes.

But that said, an artificial price series is a nice thing to have to
hand as its properties are well known.  For some one like me who is
studying and reproducing results from TA literature it is very useful.
If I feed the artificial price series to my TA algorithms I expect
random results.  It is just another test, neither sufficient nor
necessary, but nice to have, for all sorts of reasons.

So all in all there is no point putting a lot of research effort into
simple methods of generating artificial price series.

This is what I used, good enough for me....

getArtificialDataBrownian <- function(length=10000,
seed=round(exp(1)*1000)){
set.seed(seed)
r <- 1
sigma <- 0.5
x <- 10
N <- length   # number of end points of the grid including T
T <- 1 # length of the interval [0,T] in time units
Delta <- T/N # time increment
W <- numeric(N+1) # initialization of the vector W
t <- seq(0,T, length=N+1)
for(i in 2:(N+1))
W[i] <- W[i-1] + rnorm(1) * sqrt(Delta)
S <- x * exp((r-sigma^2/2)*t + sigma*W)

start <- as.Date("1900-01-01")
end <- start+length
dates <- seq(start, end, by="day")
ret <- xts(S, dates)
return(ret)
}

cheers
Worik

On 19/04/11 09:46, Ron Michael wrote:
> Thanks Horace and Mark for replying on my query. However I believe that my question was not properly understood or may be I could not understand your statement. Whatever it happened, I believe there is some miscommunication.
>
> I want to understand that: between these 2 candidates GBM&  RW (form of them I already mentioned in my previous mail), which could be better. I understand that both are very simplistic in modelling any price, however if I have to chose anyone from them then what should I chose? GBM or RW.
>
> Many previous mails seems to me that, they are in support of GBM, where I believe that there are no fundamental difference between them. Or perhaps I am missing something?
>
> Thanks,
>
> --- On Tue, 19/4/11, Horace Tso<Horace.Tso at pgn.com>  wrote:
>
>> From: Horace Tso<Horace.Tso at pgn.com>
>> Subject: RE: [R-SIG-Finance] Artificial price series
>> To: "Ron Michael"<ron_michael70 at yahoo.com>, "r-sig-finance at r-project.org"<r-sig-finance at r-project.org>
>> Date: Tuesday, 19 April, 2011, 1:44 AM
>> Ron&  others,
>>
>> I venture to give my 2 cent worth of opinion here. Many
>> (the Professors on the list please weigh in) have more
>> insight than I do.
>>
>> Here is what I find curious. As Worik pointed out in his
>> original post, if you use any of the R simulation functions
>> to generate a random walk or a fancier brownian motion
>> series, plot it with some real price data, let's say daily
>> closing level of the Dow Jones Industrial Average, you could
>> tell they are different. But it's hard to say exactly what
>> makes them look different to the human eyes.
>>
>> Not too long ago I played this trick on a friend of mine,
>> who claimed he had no prior knowledge of finance nor
>> familiar with securities price patterns. I sampled a number
>> of time series from Bloomberg. I think I picked daily
>> S&P, minute ticks of gold, nymex natural gas, the
>> Shanghai Composite stock index, and other unrelated real
>> prices. Then I simulated equal number of artificial data
>> series using different stochastic models. A few were just
>> straightforward random walk with varying sigma, others were
>> jump diffusion (EMJumpDiffusion) with different jump prob
>> and size. I plotted them along side and I was careful to
>> remove the axis labels so he couldn't see the scale of
>> things.
>>
>> I asked my friend to tell me which were real and which were
>> artificial data. Amazingly he got many of them right. (OK,
>> full disclosure here: this occurred in a bar after he had a
>> couple of beers.)
>>
>> I could see how even the most sophisticated simulation
>> models couldn't quite imitate reality. First, many stock
>> data have trend. The buy-and-hold crowd is right. Secondly,
>> the unobserved volatility parameter is in itself a
>> stochastic process (huge literature on this). Third, the
>> jump processes in simulation models are probably too
>> simplistic. Just plot Dow Jones from July to Dec, 1987.
>>
>> Horace
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: r-sig-finance-bounces at r-project.org
>> [mailto:r-sig-finance-bounces at r-project.org]
>> On Behalf Of Ron Michael
>> Sent: Monday, April 18, 2011 8:05 AM
>> To: r-sig-finance at r-project.org
>> Subject: [R-SIG-Finance] Artificial price series
>>
>> Hi Worik, I have been following this thread in "http://r.789695.n4.nabble.com/Artificial-price-series-td3443230.html",
>> for quite a time now, however could not convince myself in
>> one aspect. You said that simple RW model is not quite
>> satisfactory (Horace Tso:: evidence is clear that financial
>> prices are anything but brownian motion) hence, many people
>> suggested GBM for that. But I could not understand why they
>> are essentially different. I have:
>>
>> for vanilla RW:   log(S[t+1]) = log(S[t]) +
>> epsilon~N(.,.)
>> for vanilla GBM:  log(S[t+1]) = log(S[t]) + (mu -
>> 0.5sigma^2) + epsilon~N(.,.)
>>
>> Of course hare I am comparing both **vanilla** type and if
>> I want to incorporate other features like jump, heavy tail
>> etc., then I can incorporate those features in either case.
>> Therefore driven by some common sense, why those 2 models
>> would be fundamentally different? Only difference I see
>> that, I generally do not include Intercept in RW, because
>> including an Intercept signifies some deterministic trend in
>> the underlying price, which also makes sense.
>>
>> did he mean to say that **price** follows brownian motion?
>>
>> Any clarification would be highly appreciated.
>>
>> Thanks,
>>
>> _______________________________________________
>> R-SIG-Finance at r-project.org
>> 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.
>>
> _______________________________________________
> R-SIG-Finance at r-project.org 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.
>

--
If we amplify everything, we hear nothing.
--

```