SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Wed Nov 21, 2018 3:23 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Receiving bid/ask IQFeed
PostPosted: Wed Feb 11, 2015 12:07 pm 
Offline

Joined: Wed Feb 11, 2015 1:51 am
Posts: 11
Hi,

I have managed to connect to IQFeed as my real time data provider but i'm not seeing breakpoints getting hit in my strategy OnBid, OnAsk methods. I'm sure it's something obvious but i can't see what's wrong.

Any help appreciated.

Here's the code;

Code:
using System;

using SmartQuant;

namespace OpenQuant {

public class MyStrategy : InstrumentStrategy {
    public MyStrategy ( Framework framework, string name ) : base ( framework, name ) {
    }

    protected override void OnStrategyStart() {
        Console.WriteLine ( "Starting strategy" );
    }

    protected override void OnBid ( Instrument instrument, Bid bid ) {
        Console.WriteLine ( bid );
    }

    protected override void OnAsk ( Instrument instrument, Ask ask ) {
        Console.WriteLine ( ask );
    }

    protected override void OnBar ( Instrument instrument, Bar bar ) {
        Console.WriteLine ( bar );
    }
}

} // namespace


Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

using SmartQuant;

namespace OpenQuant {

public partial class Realtime : Scenario {
    public Realtime ( Framework framework ) : base ( framework ) {
    }

    public override void Run() {
        Initialize();

        Instrument instrument = InstrumentManager.Instruments["ES"];

        strategy = new MyStrategy ( framework, "Realtime" );
        strategy.AddInstrument ( instrument );

        // Connect to IQFeed for real time data
        Provider dataProvider = framework.ProviderManager.Providers["IQFeed"] as Provider;
        if ( dataProvider.Status == ProviderStatus.Disconnected ) {
            dataProvider.Connect();
        }
        while ( !dataProvider.IsConnected ) {
            Thread.Sleep ( 1000 );
        }

        // Set the strategy data provider.
        strategy.DataProvider = dataProvider as IDataProvider;

        BarFactory.Add ( instrument, BarType.Time, 300 );

        StartStrategy();
    }
}

} // namespace


Top
 Profile  
 
PostPosted: Wed Feb 11, 2015 12:41 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 441
Hello rfloydman.
First make sure that you correctly created Instrument.
You can do this by subscribing your Instrument in QuoteMonitor.
PS current valid ES ticker: @ESH15


Top
 Profile  
 
PostPosted: Wed Feb 11, 2015 10:00 pm 
Offline

Joined: Wed Feb 11, 2015 1:51 am
Posts: 11
Thanks for the info. Can i do that programmatically or do i need to do it via the IDE?


Top
 Profile  
 
PostPosted: Wed Feb 11, 2015 10:22 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 441
rfloydman wrote:
Thanks for the info. Can i do that programmatically or do i need to do it via the IDE?

Faster check it in GUI as I described.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 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