
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
ntdirect32
Advanced tools
NodeJS Wrapper for the Ninja Trader 7 NtDirect.dll api
This is a 32-bit windows only module, due to dll supporting only 32-bit
You must install Ninja trader 7 in order to use this module (also must be running for interaction)
This library allows you to interact with the Ninja trader 7 application using the NtDirect.dll provided api. You can view more details on this dll library in the Ninja Trader documentations: Documentation
This libray can be installed using:
npm install -g node-gypnpm install ntdirect32 --saveExtra:
npm install -g nw-gypThis script can be loaded using Nodes require method
var NTDirect = require("ntdirect32");
You may add a config.json to your projects root directory to configure a startup config or call the config method. Any method that requires one of these items allows leaving out that param and the default config will then just be used.
Host tells where the application is located. default is localhost
Port tells which port to find the application on. default is 36973
Account is the account that you will be using for trading. Required, no default
Instrument is the name of the instrument you would like to use by default. Required, no default
{
"host": "192.168.0.205",
"port": 1337,
"account": "Continuum",
"instrument": "ES"
}
The public methods that are available in the library
Sets the last price and size for the specified instrument. A return value of 1 indicates success and 0 indicates an error.
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 1 indicates success and 0 indicates an error.
Gets the average entry price for the specified instrument/account combination.
Gets the average entry price for the specified orderId.
Sets the bid price and size for the specified instrument. A return value of 1 indicates success and 0 indicates an error.
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 1 indicates success and 0 indicates an error.
Gets the buying power for the specified account. *Not all brokerage technologies support this value.
Gets the cash value for the specified account. *Not all brokerage technologies support this value.
This will cancel all active orders across all accounts and broker connections.
This will cancel all active orders and flatten all positions across all accounts and broker connections.
This will close an ATM Strategy. The strategy ID value must match a strategy ID given to a strategy in the placeOrder method. This will close the specified strategy.
This will close a position. The instrument name value is the name of the NinjaTrader instrument including the exchange name. For equities, the symbol is sufficient. This will cancel any working orders and flatten the position.
This will cancel an order. The order ID value must match either the order ID value given to an order placed through the placeBuyOrder/placeSellOrder command or, an order name such as ENTRY*, EXIT*, STOP*, SIMSTOP* or TARGET*. The star (*) represents an integer value such as TARGET1 or TARGET2. Order names are only valid if a valid strategy ID value is passed. The strategy ID value must match a strategy ID value given to a strategy in the placeBuyOrder/placeSellOrder method.
This will change the parameters of an order. The order ID value must match either the order ID value given to an order placed through the placeBuyOrder/placeSellOrder method or, an order name such as ENTRY*, EXIT*, STOP*, SIMSTOP* or TARGET*. The star (*) represents an integer value such as TARGET1 or TARGET2. Order names are only valid if a valid strategy ID value is passed. Pass in zero (0) values for limitprice, stopprice and quantity if you do not wish to change these order parameters. Price values must be in US decimal format (1212.25 is correct while 1212,25 is not).
This will place a buy order, place orders that initiate a NinjaTrader ATM Strategy, or place orders that are applied to an active NinjaTrader position ATM Strategy. Providing the optional strategy name field with a valid ATM Strategy template name will result in execution of that ATM Strategy once the order is partially or completely filled. Pass in an optional unique string value for the strategy ID in order to reference that ATM Strategy via other commands. To apply an order to an active ATM Strategy (existing strategies Stop Loss and Profit Target orders are amended) pass in the active strategy ID value and leave the strategy name field blank. Pass in an optional unique string value for the order ID in order to reference that order via other methods. If specifying an ATM Strategy template name, there is no need to pass in an order ID as the strategy based orders can be referenced by their internally generated names such as TARGET1, STOP1 and so on.
This will place a sell order, place orders that initiate a NinjaTrader ATM Strategy, or place orders that are applied to an active NinjaTrader position ATM Strategy. Providing the optional strategy name field with a valid ATM Strategy template name will result in execution of that ATM Strategy once the order is partially or completely filled. Pass in an optional unique string value for the strategy ID in order to reference that ATM Strategy via other commands. To apply an order to an active ATM Strategy (existing strategies Stop Loss and Profit Target orders are amended) pass in the active strategy ID value and leave the strategy name field blank. Pass in an optional unique string value for the order ID in order to reference that order via other methods. If specifying an ATM Strategy template name, there is no need to pass in an order ID as the strategy based orders can be referenced by their internally generated names such as TARGET1, STOP1 and so on.
This will close the current position and place an order in the opposite direction. The field requirements are identical to the placeBuyOrder method.
This will close the current position and place an order in the opposite direction. The field requirements are identical to the placeSellOrder method.
The parameter confirm indicates if an order confirmation message will appear. This toggles the global option that can be set manually in the NinjaTrader Control Center by selecting the Tools menu and the menu item Options, then checking the "Confirm order placement" checkbox.
Returns a value of 1 if a connection has been established to the NinjaTrader server (application) and if the ATI is currently enabled or, 0 if it is disconnected. Calling any function in the library will automatically initiate a connection to the server. The parameter showMessage indicates if a message box is displayed in case the connection cannot be established.
Gets the number of contracts/shares filled for the orderId.
Sets the last price and size for the specified instrument. A return value of 1 indicates success and 0 indicates an error.
Sets the last price and size for the specified instrument for use when synchronizing NinjaTrader playback with an external application playback. A return value of 1 indicates success and 0 indicates an error.
Gets the most recent price for the specified instrument and data type. last, bid, ask. You must first call the instrument(instrument (string)) or subscribeMarketData(instrument (string)(optional)) functions prior to calling this function.
Gets the market position for an instrument/account combination. Returns flat, short, or long.
Creates a new unique order ID.
Gets the order state (Initialized|PendingSubmit|Accepted|Working|PendingChange|PendingCancel|Cancelled|Rejected|PartFilled|Filled) for the orderId. Returns an empty string if the order ID value provided does not return an order.
Gets the realized profit and loss of an account.
Optional function to set the host and port number. The default port number can be set via the General tab under Options. If you change these default values, this function must be called before any other function. A return value of 1 indicates success and 0 indicates an error.
returns an array of order ID's of all Stop Loss orders of an ATM Strategy. Internal token ID value is used since it is guaranteed to be unique.
Gets an array of strategy ID's of all ATM Strategies of an account. Duplicate ID values can be returned if strategies were initiated outside of the ATI.
Gets the position for a strategy. Returns flat, short, or long.
Starts a market data stream for the specific instrument or instruments. Call the MarketData() function to retrieve prices. Make sure you call the UnSubscribeMarketData() function to close the data stream. A return value of 1 indicates success and 0 indicates an error. subscribeMarketData is also called when the instrument config default is set.
Gets an array of order ID's of all Profit Target orders of an ATM Strategy. Internal token ID value is used since it is guaranteed to be unique.
Disconnects the DLL from the NinjaTrader server. A return value of 1 indicates success and 0 indicates an error. This automatically happens when node crashes or exits.
Stops a market data stream for the specific instrument or instruments. A return value of 1 indicates success and 0 indicates an error. unsubscribeMarketData is also called when the instrument config changes the default instrument.
If You would like to contribute here are the steps
npm inpm run rebuild or for debug npm run rebuild:devYou can view the license here: License
FAQs
a nodejs wrapper for the Ninja Trader NtDirect dll
The npm package ntdirect32 receives a total of 32 weekly downloads. As such, ntdirect32 popularity was classified as not popular.
We found that ntdirect32 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.