# TeaFile discrete logic - how to write [closed]

I have been working with TeaFile from discreteLogic and I'm strugling to understand how i can insert data inside a file.

Let's take this example:

using (var tf = TeaFile<Tick>.OpenWrite(filename))
{
tf.Write(new Tick { Time = t, Price = p });
tf.Write(new Tick { Price = 15, Time = DateTime.Now, Volume = 1700 });
}


If you want to use this function one time only, the following line:

tf.Write(new Tick { Price = 15, Time = DateTime.Now, Volume = 1700 });


will write all the information inside the file, so it works fine!

But if you have data coming from any data provider you need to use this other function where t and p obviously change all the time:

tf.Write(new Tick { Time = t, Price = p });


The problem is that inside the file you will find only the latest value and not a list, it it overwriting the latest value every time without creating a list.

So the question is how can I insert one after the other, creating a list of values instead of overwriting the same row all the time? Into the website (http://discretelogics.com/teafiles/) there are examples that are considering the most simple scenario obviously.

Thanks!

• I'm voting to close this question as off-topic because this seems to be a programming issue
– Attack68
Feb 14 '20 at 18:19
• Attack68 maybe you need to read why TeaFile has been created, the nature of the application and what it is used for, that would defintely help you to understand that you can not do finance without programming. I'm struggling to understand how you could have wrote that this is off-topic. Pls study a bit it will help you out! ;-) May 22 '20 at 7:46
• I certainly will take your advice and study a bit, thank you kindly. If I may also impart some helpful advice: stack overflow provides excellent responses to programming questions which are relevant to all kinds of industries, including finance.
– Attack68
May 22 '20 at 8:09

 using (var tf = TeaFile<Tick>.OpenWrite(filename))