SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Wed Oct 24, 2018 6:28 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to change Quotedata?
PostPosted: Thu Jan 04, 2018 2:15 pm 
Offline

Joined: Thu Mar 16, 2006 12:15 pm
Posts: 184
I try to filter quote data:
- I can delete bad quotes with something like this: DataManager.DeleteQuote(thisinstrument, quote.DateTime);
- But I cannot change a quote. E.g. I there is a mistake with the . that the quote is 1005 instead of 100.5...
How to solve that?

I mean I can do something like:
{lastquoteask = quote.Ask/10;
...
DataManager.Add(thisinstrument,myquote);

the problem is: I cannot save myquote, change a quote.

Thanks for help!

_________________
Expect the unexpected. May your MM/RM be with you.


Top
 Profile  
 
PostPosted: Tue Jan 09, 2018 11:08 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 438
Hello fliesch,
you cannot update quotes or other market data in database.
You should delete old record and next add updated record.

Script example:
Code:
public class MyScript : Script
{
   public override void Run()
   {
      Instrument instrument  = InstrumentManager.Instruments["DAX Mar18"];
      
      QuoteSeries quotes =  DataManager.GetHistoricalQuotes(instrument, DateTime.MinValue, DateTime.MaxValue);
      
      Console.WriteLine("total quotes: {0}", quotes.Count);

      foreach(Quote quote in quotes)
         Console.WriteLine(quote);
      
      Console.WriteLine("update quote");
      
      DataManager.DeleteQuote(instrument, quotes[0].DateTime);
      
      Quote newquote = new Quote(quotes[0].DateTime, quotes[0].Bid+1, quotes[0].BidSize, quotes[0].Ask+2, quotes[0].AskSize);
         
      DataManager.Add(instrument, newquote);

      quotes =  DataManager.GetHistoricalQuotes(instrument, DateTime.MinValue, DateTime.MaxValue);
      
      foreach(Quote quote in quotes)
         Console.WriteLine(quote);
   }
}


log:
Code:
Build succeeded.
total quotes: 1
09.01.2018 10:50:57 bidSize=1 bid=100 ask=102 askSize=2
update quote
09.01.2018 10:50:57 bidSize=1 bid=101 ask=104 askSize=2


Top
 Profile  
 
PostPosted: Tue Jan 09, 2018 12:36 pm 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6808
Hi, I think we are talking about OQ 3 here, correct?

OQ 2014 has DataSeries.Update method

public virtual void Update(Int64 index, DataObject obj)

Regards,
Anton


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group