SmartQuant Discussion
http://www.smartquant.com/forums/

Receiving bid/ask IQFeed
http://www.smartquant.com/forums/viewtopic.php?f=41&t=10894
Page 1 of 1

Author:  rfloydman [ Wed Feb 11, 2015 12:07 pm ]
Post subject:  Receiving bid/ask IQFeed

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

Author:  skuvv [ Wed Feb 11, 2015 12:41 pm ]
Post subject:  Re: Receiving bid/ask IQFeed

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

Author:  rfloydman [ Wed Feb 11, 2015 10:00 pm ]
Post subject:  Re: Receiving bid/ask IQFeed

Thanks for the info. Can i do that programmatically or do i need to do it via the IDE?

Author:  skuvv [ Wed Feb 11, 2015 10:22 pm ]
Post subject:  Re: Receiving bid/ask IQFeed

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.

Page 1 of 1 All times are UTC + 3 hours
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/