NexusFi: Find Your Edge


Home Menu

 





Creating a data feed connection provider for NT


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one rleplae with 23 posts (7 thanks)
    2. looks_two 33rdvirus with 7 posts (0 thanks)
    3. looks_3 KillerJukeBox with 6 posts (0 thanks)
    4. looks_4 sam028 with 5 posts (4 thanks)
      Best Posters
    1. looks_one Koepisch with 1 thanks per post
    2. looks_two zweistein with 1 thanks per post
    3. looks_3 sam028 with 0.8 thanks per post
    4. looks_4 rleplae with 0.3 thanks per post
    1. trending_up 29,314 views
    2. thumb_up 14 thanks given
    3. group 19 followers
    1. forum 55 posts
    2. attach_file 2 attachments




 
Search this Thread

Creating a data feed connection provider for NT

  #21 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863

you don't need another machine, but you need to create a program that will deliver
the datafeed, in case of your own symbols. on the diagram it is the red box called
new data provider. it is a program that will listen to requests from the proxy and
deliver the data in the right format.

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Increase in trading performance by 75%
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
My NQ Trading Journal
12 thanks
  #22 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


gztanwei View Post
Understand the concept , but how can we Point IQFeed to my own Database source?? are we need to build another machine to be "IQFeed" Server ? I would like to do something similar , which Point I need to start ??

In few words:
- in Ninja connect to the External Data Feed
- write a small program which will:
-> connect to port 36973 (the External Data Feed listening port)
-> read your data (csv, SQL, whatever...)
-> send these data through this socket
In Python sending the ask price will looks like this:
 
Code
                            
self.s.send('1\x00')

self.s.send('0\x00')
self.s.send(instrument+'\x00')
self.s.send(ask+'\x00')
self.s.send(volume+'\x00')
self.s.send(dateTime+'\x00'
The second char sent is '0' for ask, '1' for bid, '2' for last.

If everything works you should be able to feed Ninja with whatever you want, like on this screenshot (forget about the very sophisticated GUI )

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
Thanked by:
  #23 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863



sam028 View Post
In few words:

-> connect to port 36973 (the External Data Feed listening port)
-> read your data (csv, SQL, whatever...)
-> send these data through this socket
In Python sending the ask price will looks like this:
 
Code
                            
self.s.send('1\x00')

self.s.send('0\x00')
self.s.send(instrument+'\x00')
self.s.send(ask+'\x00')
self.s.send(volume+'\x00')
self.s.send(dateTime+'\x00'
The second char sent is '0' for ask, '1' for bid, '2' for last.

This is the ATI interface, this not the native external data feed.
You can also call the NTdirect.dll function (which inside will do the socket thing as @sam028 explains)

The DLL Interface functions are contained in NTDirect.dll located in the C:\WINDOWS\system32 folder.

DLL Interface Functions
int Ask(string instrument, double price, int size)
Sets the ask price and size for the specified instrument. A return value of 0 indicates success and -1 indicates an error.

int AskPlayback(string instrument, double price, int size, string timestamp)
Sets the ask price and size for the specified instrument for use when synchronizing NinjaTrader playback with an external application playback. A return value of 0 indicates success and -1 indicates an error. The timestamp parameter format is "yyyyMMddhhmmss".


int Bid(string instrument, double price, int size)
Sets the bid price and size for the specified instrument. A return value of 0 indicates success and -1 indicates an error.

int BidPlayback(string instrument, double price, int size, string timestamp)
Sets the bid price and size for the specified instrument for use when synchronizing NinjaTrader playback with an external application playback. A return value of 0 indicates success and -1 indicates an error. The timestamp parameter format is "yyyyMMddhhmmss".

For one instrument this can work, for many instruments this has a performance issue
Personally i found the NTdirect and the ATI interface to be very buggy, especially if you make multiple connections
with theardown, there is a memory leak inside somewhere

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #24 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863

With a true data provider interface, you can make various charts, any bar, tick, 1 min, 5 min, 1 hour,
daily, etc and any other type of chars, as NT will request the data that it needs through the dataprovider
interface as and when it needs the data.

Depending on what you want to do , you can write a data provider or you can push data, one by one
to NT through the NTdirect.dll interface (or the direct socket way as @sam028 explained) , these are two
different options to get your data inside NT.

For the data provider interface, you can 'mimick' any existsing interface that NT has.

You can 'reverse engineer an interface' like @sam028 did, or you can take an interface that is documented
and implement it as documented (iqfeed progammers spec, IFX standard, any other documented I/F)

These are just a few options...

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #25 (permalink)
33rdvirus
navi mumbai
 
Posts: 7 since Nov 2016
Thanks Given: 0
Thanks Received: 0


sam028 View Post
You can do this using the External connector, but it won't allow another regular data feed.
If you want a custom data feed to run in parallel with a regular one an option would be create a fake IB connector for example, instead of using the external connector. As the IB API is well documented I assume it won't be too painful to create a service/daemon which will reply to NT requests in a coherent format.

Please can elaborate it a bit more. I am not a coder and looking for a freelancer to do it for me. But I don't even understand what should I exactly tell him. Would indeed be a great help if you could just briefly explain how it can be done.
thank you.

Reply With Quote
  #26 (permalink)
33rdvirus
navi mumbai
 
Posts: 7 since Nov 2016
Thanks Given: 0
Thanks Received: 0


rleplae View Post
With a true data provider interface, you can make various charts, any bar, tick, 1 min, 5 min, 1 hour,
daily, etc and any other type of chars, as NT will request the data that it needs through the dataprovider
interface as and when it needs the data.

Depending on what you want to do , you can write a data provider or you can push data, one by one
to NT through the NTdirect.dll interface (or the direct socket way as @sam028 explained) , these are two
different options to get your data inside NT.

For the data provider interface, you can 'mimick' any existsing interface that NT has.

You can 'reverse engineer an interface' like @sam028 did, or you can take an interface that is documented
and implement it as documented (iqfeed progammers spec, IFX standard, any other documented I/F)

These are just a few options...

Sir, how to write a data provider?? If its not too much of trouble please can you explain it briefly.
thank you

Reply With Quote
  #27 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


33rdvirus View Post
Sir, how to write a data provider?? If its not too much of trouble please can you explain it briefly.
thank you

There are many ways you can skin this cat.

1. You can create a FIX server and connect NT to your own FIX server.
FIX specifications are open and free

Tech / Specs - FIX Trading Community

2. You can 'mimic' one of the existing protocols (iqfeed, rithmic

3. As mentioned before, you can also use the NTDirect.dll, if you are
talking about smaller amount of data.

4. You can also call data from an indicator, and then draw the chart.

It all depends what problem you are trying to solve ?

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #28 (permalink)
33rdvirus
navi mumbai
 
Posts: 7 since Nov 2016
Thanks Given: 0
Thanks Received: 0


rleplae View Post
There are many ways you can skin this cat.

1. You can create a FIX server and connect NT to your own FIX server.
FIX specifications are open and free


2. You can 'mimic' one of the existing protocols (iqfeed, rithmic

3. As mentioned before, you can also use the NTDirect.dll, if you are
talking about smaller amount of data.

4. You can also call data from an indicator, and then draw the chart.

It all depends what problem you are trying to solve ?

Hello. You being an elite member, I really didn't expect such a quick reply. But thank you for that. My exact problem is, my broker released rest-like APIs sometime back and they are (obviously) not supported by ninjatrader. So I searching for a way to connect ninjatrader with my broker, to place orders and receive live & historical data from the same connection.
thank you.

Reply With Quote
  #29 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


33rdvirus View Post
Hello. You being an elite member, I really didn't expect such a quick reply. But thank you for that. My exact problem is, my broker released rest-like APIs sometime back and they are (obviously) not supported by ninjatrader. So I searching for a way to connect ninjatrader with my broker, to place orders and receive live & historical data from the same connection.
thank you.

OK

Then you don't only need a datafeed, but also a broker (order) connection.

You could take the rithmic spec's or the IB spec's and make a bridge.

This would look like this :

NT -> {rithmic or IB} <-- you bridge app --> {your broker rest APIs}

you bridge app would then be responsible for parsing and mapping back and forward.
that belongs to the kind of 'heavy' lifting category, not easy but not impossible.

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #30 (permalink)
33rdvirus
navi mumbai
 
Posts: 7 since Nov 2016
Thanks Given: 0
Thanks Received: 0



rleplae View Post
OK

Then you don't only need a datafeed, but also a broker (order) connection.

You could take the rithmic spec's or the IB spec's and make a bridge.

This would look like this :

NT -> {rithmic or IB} <-- you bridge app --> {your broker rest APIs}

you bridge app would then be responsible for parsing and mapping back and forward.
that belongs to the kind of 'heavy' lifting category, not easy but not impossible.

And sir where can I find rithmics spec's or IB spec's? and by specs do you mean the protocol?

Reply With Quote




Last Updated on March 7, 2020


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts