indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Technical > Auto & Algo Trading

FXPrimus
Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-10-2017, 01:50 PM
rpsvinod rpsvinod is offline
Regular
 
Join Date: Sep 2015
Posts: 29
Thanks: 35
Thanked 62 Times in 29 Posts
rpsvinod is on a distinguished roadrpsvinod is on a distinguished road
Default Development of Algo Trading with NinjaTrader On Indian MCX Market thru Zerodha Kite

Hello to All,

I 'm trying to implement the Algo Trading on Indian MCX Market.

Broker Platform - Zerodha Kite with API Activated Bridge
Charting Platform - NinjaTrader with Order Routing Bridge

Step 1 : Activation of Kite API from Zerodha (2000/month)
Step 2 : NinjaTrader Configuration based on Indian MCX Crudeoil Script
Step 3 : RT Data feed to NinjaTrader thru Utility Bridge.
Step 4 : Development of Trading Strategies for Algo Execution.

Note : Is Anyone willing to share their Activated Kite API for test run, It Should be very helpful to Proceed.

Is anybody tried this Algo Trading thru NinjaTrader by using Kite API, Pls Share ur valuable experience here, for better understanding of this concept.

RPS . VINOD
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to rpsvinod For This Useful Post:
  #2 (permalink)  
Old 04-10-2017, 01:59 PM
rpsvinod rpsvinod is offline
Regular
 
Join Date: Sep 2015
Posts: 29
Thanks: 35
Thanked 62 Times in 29 Posts
rpsvinod is on a distinguished roadrpsvinod is on a distinguished road
Default

Originally Posted by darktrader View Post
I am trading with zerodha and I use Ninjatrader7 for charting. Zerodha Pi Bridge and Kite may be used to execute orders from NT7 charts. Can someone help me to execute orders from NT7 charts to Nest/Pi/Kite.

May be this query 'll be resolve after the test run, Just I hope.

RPS. VINOD
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to rpsvinod For This Useful Post:
  #3 (permalink)  
Old 04-10-2017, 02:03 PM
Trademaniac's Avatar
Trademaniac Trademaniac is offline
Regulars
 
Join Date: Nov 2013
Posts: 170
Thanks: 141
Thanked 311 Times in 133 Posts
Trademaniac has a spectacular aura aboutTrademaniac has a spectacular aura aboutTrademaniac has a spectacular aura aboutTrademaniac has a spectacular aura aboutTrademaniac has a spectacular aura about
Default

Originally Posted by rpsvinod View Post
Hello to All,

I 'm trying to implement the Algo Trading on Indian MCX Market.

Broker Platform - Zerodha Kite with API Activated Bridge
Charting Platform - NinjaTrader with Order Routing Bridge

Step 1 : Activation of Kite API from Zerodha (2000/month)
Step 2 : NinjaTrader Configuration based on Indian MCX Crudeoil Script
Step 3 : RT Data feed to NinjaTrader thru Utility Bridge.
Step 4 : Development of Trading Strategies for Algo Execution.

Note : Is Anyone willing to share their Activated Kite API for test run, It Should be very helpful to Proceed.

Is anybody tried this Algo Trading thru NinjaTrader by using Kite API, Pls Share ur valuable experience here, for better understanding of this concept.

RPS . VINOD

I've built & using trading algo's in Python using KITE API's. I have had issues with their data websockets and have raised many questions on their forums too, but for the time being i am satisfied 70% with their offerings at the given price. Order placing API's have not bugged me so far thankfully.

One issue i face is, order book data has some delays and sometimes freezes for fraction of seconds. This almost happens a few times everyday on thick volume scripts.

You can ask me if any questions in specific.
__________________
Stronger the WHY, easier the HOW
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 5 Users Say Thank You to Trademaniac For This Useful Post:
  #4 (permalink)  
Old 04-10-2017, 02:40 PM
rpsvinod rpsvinod is offline
Regular
 
Join Date: Sep 2015
Posts: 29
Thanks: 35
Thanked 62 Times in 29 Posts
rpsvinod is on a distinguished roadrpsvinod is on a distinguished road
Default

Originally Posted by Trademaniac View Post
I've built & using trading algo's in Python using KITE API's. I have had issues with their data websockets and have raised many questions on their forums too, but for the time being i am satisfied 70% with their offerings at the given price. Order placing API's have not bugged me so far thankfully.

One issue i face is, order book data has some delays and sometimes freezes for fraction of seconds. This almost happens a few times everyday on thick volume scripts.

You can ask me if any questions in specific.

Hi Trademaniac,

Thanks for ur quick response. Anyway I 've no idea about any Programming Skills about Python, Shall i use it as a trader mindset.

Doubts to be clarify :

Step 1 : Activation of Kite API from Zerodha (2000/month) - Done from my end.

What next Steps,

Python based utility, Is it a stand alone product to execute the orders from NinjaTrader Strategies?

If yes, How can we get the RT Data feed for NT?

And What about NT Strategies development Support?

And seen ur another reply regarding this,

Originally Posted by Trademaniac View Post
Zerodha uses Omnesys API to place/modify/cancel/convert/square off orders. There are separate API calling for each tasks. I've not used their product, but in case they provide the API access to clients, you can place order using any software, its just a matter of mapping the values with the API request (as specified in the API Doc) and getting a response. Here's how a request/response form looks like.





In case, you have the access, let me know, i can help you with the order form integration.


RPS. VINOD
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 3 Users Say Thank You to rpsvinod For This Useful Post:
  #5 (permalink)  
Old 04-10-2017, 03:30 PM
rpsvinod rpsvinod is offline
Regular
 
Join Date: Sep 2015
Posts: 29
Thanks: 35
Thanked 62 Times in 29 Posts
rpsvinod is on a distinguished roadrpsvinod is on a distinguished road
Default

Originally Posted by devdas View Post
But first confirm, is Zerodha authorized broker by NT ?

However, If i am not too optimistic , i can custom code and hook easily Nest Trader API with NT. It will be a bit of work making custom drawing objects to handle order events, but its the only possible solution i see.

But i am really lazy to open an account for this to access Nest Trader and its API and all BS of new brokers. If anyone here trust me and give access of his Nest Trader ( API enabled ) to develop then i will code that for free.

Originally Posted by rpsvinod View Post
Hi DD,
We can start this project, i trust u can test and complete it successfully thru my Live NT Key nd Zerodha Nest Access..But how can i contact u to share the details? i'm new to this forum. sharing email may be wrong..i m not sure.

Note : I'm having only MCX Segment access

RPS. VINOD

Recap of this development : Exactly bfore 2 years some discussions had with Senior Member Devdas, But unfortunately didn't proceed further step due to time restraints.

Now Hope its time to Proceed from available Source.

RPS. VINOD
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to rpsvinod For This Useful Post:
  #6 (permalink)  
Old 04-10-2017, 03:32 PM
Trademaniac's Avatar
Trademaniac Trademaniac is offline
Regulars
 
Join Date: Nov 2013
Posts: 170
Thanks: 141
Thanked 311 Times in 133 Posts
Trademaniac has a spectacular aura aboutTrademaniac has a spectacular aura aboutTrademaniac has a spectacular aura aboutTrademaniac has a spectacular aura aboutTrademaniac has a spectacular aura about
Default

This code maybe helpful, i used it in NT before, but not anymore since i don't use charts in my strategy/logic development.

Quote:
from kiteconnect import WebSocket
import json
import ctypes
from ctypes import *
from pprint import pprint
from pprint import pprint
import sys
import os

kws = WebSocket("api_key", "public_token", "user_id")

os.chdir("C:\\WINDOWS\\system32")
#os.chdir("C:\\Program Files (x86)\\NinjaTrader 7\\bin")

# cats = ctypes.CDLL('NTDirect')
# cats.Last.argtypes = [ctypes.c_wchar_p , ctypes.c_double, ctypes.c_int]
# cats.Last.restype = ctypes.c_int

NTDLL = ctypes.WinDLL ("NTDirect.dll")

# Callback for tick reception.
def on_tick(tick, ws):
#print("TEST", tick[0]["last_price"], tick[0]["volume"])

# Set up the variables and call the Python name with them.
p1 = ctypes.c_wchar_p("TEST1")
p2 = ctypes.c_double(tick[0]["last_price"])
p3 = ctypes.c_int(tick[0]["volume"])

NTDllApiProto = ctypes.WINFUNCTYPE(ctypes.c_int, ctypes.c_wchar_p, ctypes.c_double, ctypes.c_int)

NTDllApiParams = (1, "instrument", "TEST1"), (1, "price", 0.0), (1, "size", 0),

# Actually map the call (setDACValue) to a Python name.
CATSDllApi = NTDllApiProto(("Last", NTDLL), NTDllApiParams)

res = CATSDllApi(p1, p2, p3)
print(res)
print(tick)

def on_connect(ws):
ws.subscribe([53417223])
ws.set_mode(ws.MODE_FULL, [53417223])

# Assign the callbacks.
kws.on_tick = on_tick
kws.on_connect = on_connect

# Infinite loop on the main thread. Nothing after this will run.
# You have to use the pre-defined callbacks to manage subscriptions.
kws.connect()

# Callback for successful connection.


Make sure you place the NTDirect dll in the system32 folder. Add your API keys & list all the symbol codes eg. 53417223. You can add more fields that you want from the response.

Here is the interface functions available in the DLL:

https://ninjatrader.com/support/help..._interface.htm

Here is how Kite's full response looks like (SBI LIFE):

Quote:
[
{
'tradeable': True,
'mode': 'full',
'instrument_token': 5582849,
'last_price': 704.15,
'last_quantity': 16,
'average_price': 704.38,
'volume': 2988380,
'buy_quantity': 168302,
'sell_quantity': 795868,
'ohlc': {
'open': 710.15,
'high': 710.75,
'low': 699.0,
'close': 707.55
},
'change': -0.48053141120768533,
'depth': {
'buy': [
{
'quantity': 262,
'price': 704.1,
'orders': 1
},
{
'quantity': 10,
'price': 703.3,
'orders': 1
},
{
'quantity': 25,
'price': 703.25,
'orders': 1
},
{
'quantity': 500,
'price': 703.2,
'orders': 1
},
{
'quantity': 157,
'price': 703.15,
'orders': 2
}
],
'sell': [
{
'quantity': 26,
'price': 704.15,
'orders': 2
},
{
'quantity': 963,
'price': 704.25,
'orders': 3
},
{
'quantity': 110,
'price': 704.3,
'orders': 2
},
{
'quantity': 92,
'price': 704.4,
'orders': 3
},
{
'quantity': 217,
'price': 704.45,
'orders': 5
}
]
}
}
]

__________________
Stronger the WHY, easier the HOW
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 4 Users Say Thank You to Trademaniac For This Useful Post:
  #7 (permalink)  
Old 04-10-2017, 04:14 PM
rpsvinod rpsvinod is offline
Regular
 
Join Date: Sep 2015
Posts: 29
Thanks: 35
Thanked 62 Times in 29 Posts
rpsvinod is on a distinguished roadrpsvinod is on a distinguished road
Default

Originally Posted by Trademaniac View Post
This code maybe helpful, i used it in NT before, but not anymore since i don't use charts in my strategy/logic development.

Make sure you place the NTDirect dll in the system32 folder.

Add your API keys & list all the symbol codes eg. 53417223. You can add more fields that you want from the response.

Thanks for more detailed explanation. Shall i PM to u for Some Clarifications?
BTW I 'm Sure.NTDirect dll in the system32 folder.Rest of the things 'll do, But no more idea about it. Step by Step 'll proceed.

RPS. VINOD
Attached Images
File Type: png nt direct.png (73.2 KB, 7 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to rpsvinod For This Useful Post:
  #8 (permalink)  
Old 04-10-2017, 04:51 PM
Trademaniac's Avatar
Trademaniac Trademaniac is offline
Regulars
 
Join Date: Nov 2013
Posts: 170
Thanks: 141
Thanked 311 Times in 133 Posts
Trademaniac has a spectacular aura aboutTrademaniac has a spectacular aura aboutTrademaniac has a spectacular aura aboutTrademaniac has a spectacular aura aboutTrademaniac has a spectacular aura about
Default

Originally Posted by rpsvinod View Post
Thanks for more detailed explanation. Shall i PM to u for Some Clarifications?
BTW I 'm Sure.NTDirect dll in the system32 folder.Rest of the things 'll do, But no more idea about it. Step by Step 'll proceed.

RPS. VINOD

Sure, no problem.
__________________
Stronger the WHY, easier the HOW
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 3 Users Say Thank You to Trademaniac For This Useful Post:
  #9 (permalink)  
Old 29-10-2017, 11:23 PM
rpsvinod rpsvinod is offline
Regular
 
Join Date: Sep 2015
Posts: 29
Thanks: 35
Thanked 62 Times in 29 Posts
rpsvinod is on a distinguished roadrpsvinod is on a distinguished road
Default

Originally Posted by Trademaniac View Post
Sure, no problem.

Hello Trademaniac,

Any Update.,? Eagerly waiting for ur support.

RPS. VINOD
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to rpsvinod For This Useful Post:
  #10 (permalink)  
Old 16-11-2017, 12:47 PM
rpsvinod rpsvinod is offline
Regular
 
Join Date: Sep 2015
Posts: 29
Thanks: 35
Thanked 62 Times in 29 Posts
rpsvinod is on a distinguished roadrpsvinod is on a distinguished road
Default

I 'm testing Some other 3rd Party tool to fire the Orders based on NinjaTrader Strategy.Works fine.,Due to very limited Support from developer Side, Modify the strategy part is very difficult.

Actually no rocket science technology.,Normal Super Trend Strategy.,I wanna some custom logic for orders and stop.

If anyone aware about this NT7 Coding Part, I 'll be very helpful. I 'll explain in details along with Strategy.

RPS.VINOD
Attached Images
File Type: png SILVERMIC.png (329.5 KB, 6 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to rpsvinod For This Useful Post:
Reply

indiTraders - Forum for the Active Indian Trader > Technical > Auto & Algo Trading


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


FXPrimus

All times are GMT +5.5. The time now is 06:59 PM.


vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2