Metadata-Version: 2.4
Name: NxCore
Version: 1.0.0
Summary: NxCore Python wrapper. Requires the native NxCore library.
Author-email: Nanex LLC <support@nanex.net>
License: BSD 3-Clause
Project-URL: Homepage, https://www.nxcoredata.com
Project-URL: Documentation, https://nxcoreapi.com/doc
Project-URL: Getting Started, https://nxcoreapi.com/doc/concept_BasicTrade_Python.html
Project-URL: Required Native Library, https://www.nxcoredata.com/downloads/NxCoreAPI_SampleApps.zip
Keywords: Nanex,NxCore,NxCoreAPI,libnx,stock,stocks,option,options,future,futures,tick,market data,feed,wrapper,nx2,nx3
Classifier: Development Status :: 5 - Production/Stable
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX :: Linux
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license
Dynamic: license-file

# NxCore Python Wrapper

Process the NxCore market data feed and historical tape files. Requires the native NxCore Library(libnx.so, libnx.dylib, or NxCoreAPI64.dll depending on the operating system). Documentation can be found [online](https://nxcoreapi.com/doc/) or using docstrings(i.e. *print(NxCore.ProcessTape.\_\_doc\_\_)*).

## Quick Start
```shell
pip install NxCore
```

Download and extract the [demo](https://www.nxcoredata.com/downloads/NxCoreAPI_SampleApps.zip).  
Change directory to extracted folder and run:

```python
import NxCore

def OnNxCoreCallback(NxCoreSys, NxCoreMsg):
    if NxCoreMsg.MessageType == NxCore.NxMSG_TRADE:

        header = NxCoreMsg.coreHeader
        symbol = header.pnxStringSymbol.String
        timestamp = header.nxExgTimestamp

        trade = NxCoreMsg.coreData.Trade
        price = NxCore.PriceToFloat(trade.Price,trade.PriceType)
        size = trade.Size

        print("Trade for {} at {:02d}:{:02d}:{:02d} for {} shares at ${:.2f}" \
            .format( symbol, timestamp.Hour, timestamp.Minute, timestamp.Second, size, price))
    return NxCore.NxCALLBACKRETURN_CONTINUE

#NxCoreAPI64.dll for Windows, libnx.so for x86 linux, libnx_aarch64.so for aarch64 linux, or libnx.dylib for macOS
if NxCore.LoadNxCore("NxCoreAPI64.dll"):
    returnValue = NxCore.ProcessTape("demo.XU.nx2", 0, 0, 0, OnNxCoreCallback)
    NxCore.ProcessReturnValue(returnValue)
else:
    print("loading library failed")
```

Further examples and more detailed guides can be found on the [NxCore Getting Started Webpage](https://nxcoreapi.com/doc/concept_BasicTrade_Python.html).

## Full Installation
```shell
pip install NxCore
```
Download the [latest Native Libraries](https://www.nxcoredata.com/downloads/NxCoreAPI_SampleApps.zip).  
Download an [NxCore Sample tape](https://www.nxcoredata.com/sample-nxcore-data/#sample-nxcore-data-download).
