Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Programmatic Access to Instruments Database
Collapse
X
-
Programmatic Access to Instruments Database
I'm running NinjaTrader version 8.0.21.1 64-bit, and I'd like to programmatically read-from and write-to my local instrument database. I'd like to know if it's possible to do this, either internally to NT8 using NinjaScript, or externally to NT8 using Python/C#/VBA? If it is possible, then I'd appreciate any guidance you might provide for how to do it. Thank you.Tags: None
-
Hello NtFan,
That really depends on what your local database format is, NinjaScript is just C# programming language so you could use any C# means to interface with external data. You can also reference libraries if needed in case you are using a database or something that requires an actual library to use.
I would suggest to first review what you need to access the data and then search online for C# examples for that. For example if your database was a csv file you could search for "C# read csv file" to get some examples which would apply in NinjaScript.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
-
Hi Jesse,
The "local database" that I want to read-from and write-to is the NinjaTrader instrument database that is installed on my local computer. With regard to this database, here are two things I'd like to do:
1a. Using NinjaScript, I'd like to read from it to check if an instrument having a specific name (i.e. ticker) exists; and
1b. Ditto, but using Python/C#/VBA.
And, here are two more things I'd like to do:
2a. Using NinjaScript, I'd like to write to it to add an instrument that doesn't exist; and
2b. Ditto, but using Python/C#/VBA.
Are any/all of these four things possible? If yes, then I'd appreciate any guidance you might provide regarding how to do them.
Thank you,
NtFan
Comment
-
Hello NtFan,
There is no suggestion I can make for accessing the NT databases directly, you could look up an instrument in NinjaScript using the method to do that but I could not advise for any external use case outside of NinjaScript. In general the database files and other data files NinjaTrader stores are not accessible from outside the platform.
Creating instruments from NinjaScript is also very limited, technically you can try to Instrument.GetInstrument("name", true) and it will add a default stock type instrument but there is no supported way to modify/add instruments in the database through code. It is only suggested to manually define instruments so that you can ensure the configuration is correct before you try to use it.
I look forward to being of further assistance.
JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by suroot, 04-10-2017, 02:18 AM
|
4 responses
3,021 views
0 likes
|
Last Post
by truepenny
Today, 08:01 AM
|
||
Started by Stanfillirenfro, Today, 07:23 AM
|
1 response
6 views
0 likes
|
Last Post Today, 07:37 AM | ||
Started by cmtjoancolmenero, Yesterday, 03:58 PM
|
2 responses
22 views
0 likes
|
Last Post Today, 07:24 AM | ||
Started by olisav57, Yesterday, 07:39 PM
|
1 response
9 views
0 likes
|
Last Post Today, 07:23 AM | ||
Started by cocoescala, 10-12-2018, 11:02 PM
|
7 responses
944 views
0 likes
|
Last Post
by Jquiroz1975
Today, 07:21 AM
|
Comment