pINET implements a Python interface for the NASDAQ INET XML service. pINET allows access to real-time stock orders, executions, and statistics.
Installation:
· Place pINET.py in the directory your source resides in (site-lib, if you'd like, but there's no setup.py yet)
· Replace the token variable with your INET developer token (http://data.inetats.com/members/ws/newtoken.jsp)
· import pINET ...
Examples:
· test.st.py: single-threaded example
· test.mt.py: multi-threaded example
API:
Single-threaded (see test.st.py)
· requestOrders (symbol): returns up to 50 open orders on both sides in form:
{ 'buy':
[{'price': ..., 'shares': ..., 'type': ...}, ...],
'sell':
[{'price': ..., 'shares': ..., 'type': ...}, ...]
}
· requestExecs (symbol): returns up to last 100 INET executions in form:
[ {'price': ..., 'shares': ..., 'time': ..., 'type': ...} ... ]
· requestStats (symbol): returns open, booked, and matched share statistics in form:
{ 'book': {'shares': ..., 'orders': ...},
'open': {'shares': ..., 'orders': ...},
'match': {'shares': ..., 'price': ...}
}
Multi-threaded (see test.mt.py)
· class RequesterThread
RequesterThread(symbol, type):
-symbol: NASDAQ symbol
-type: {reqOrders, reqExecs, reqStats}
RequesterThread.ID contains the thread's job ID, which in turn is used as the key by the pINET.jobQueue dictionary.
What's New in This Release:
· The Top List API has been implemented and the source has been fully documented with examples via pydoc.
· The setup.py install script and unit.py test script have also been integrated into the release.
· Lastly among minor fixes, there is also a beta Tk interface that allows tracking of the top volume list and any NASDAQ symbol, displaying price, ask and bid, volume, and five-day graph.
Product's homepage