diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index cc0d116..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include LICENSE \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 997cfaa..0000000 --- a/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -init: - pip install -r requirements.txt - -test: - nosetests tests diff --git a/README.md b/README.md index 3d9fcc2..efdd614 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,27 @@ IBstract ======== -IBstract is a high-level Pythonic interface to Interactive Brokers API, -wrapping historical and real-time market data access, as well as orders and -account management. The ultimate goal of Ibstract is to provide an easy-to-use -Pythonic IB interface for individual algorithmic back-testing and trading. +IBstract is a high-level Python library wrapping Interactive Brokers API, +providing historical data download, real-time market data streaming, and orders +and account management. The goal of Ibstract is to provide an easy-to-use +Pythonic IB interface for algorithmic trading and back-testing. Features ---------- - Read and write historical and market data in pandas formats. - Automatically merge and manage downloaded data by symbols, bar size and date/time. -- Store and cache historical data locally using sqlite. -- Real-time market data streaming and common technical signal generating. (To do) -- Order submission, status monitoring, and logging. (To do) -- Account management report and performance analysis. (To do) Requirements ------------ +- Interactive Brokers API <= 9.72 +- Interactive Brokers Gateway >= 959, <= 963.3h - Python >= 3.6 (Recommend Anaconda 4.4.0) - pandas >= 0.20.0 -- sqlite >= 3.13 -- SQLAlchemy >= 1.1.9 References ---------- -- [Rob Carver's Blog](http://qoppac.blogspot.co.uk/2017/03/interactive-brokers-native-python-api.html) -- [Interactive Brokers TWS API v9.72+](http://interactivebrokers.github.io/tws-api/) +- [Rob Carver: Using swigibpy so that Python will play nicely with Interactive Brokers API](https://qoppac.blogspot.com/2014/03/using-swigibpy-so-that-python-will-play.html) +- [Interactive Brokers API References v9.72](http://xavierib.github.io/twsapidocs/) diff --git a/ibstract/ibgateway.py b/ibstract/ibgateway.py index f1b119b..c96b7e5 100644 --- a/ibstract/ibgateway.py +++ b/ibstract/ibgateway.py @@ -383,18 +383,18 @@ def finished_flag(start_time): # test 2 if (not sys.argv[1:]) or (int(sys.argv[1]) == 2): - security_type = 'OPT' + security_type = 'STK' symbol = 'FB' - put_call = 'CALL' - strike = 121 - expiry = '20161021' - req_endtime = '20160920 13:00:00' + # put_call = 'CALL' + # strike = 170 + # expiry = '20170915' + req_endtime = '20170831 13:00:00' req_len = '1 day' req_barsize = '5 min' req_datatype = 'TRADES' req_contract = ibc.make_contract( - security_type, symbol, put_call, strike, expiry) + security_type, symbol) # , put_call, strike, expiry) hist_data_list = ibc.req_hist_data( req_contract, req_endtime, req_len, req_barsize, req_datatype) hist_data = MarketData(hist_data_list) @@ -412,7 +412,9 @@ def finished_flag(start_time): ticktype_names = ['mkt_price', ] contract = ibc.make_contract(security_type, symbol) - hist_data_list = ibc.req_mkt_data(contract, duration=duration) + mkt_data_list = ibc.req_mkt_data(contract, duration=duration) + mkt_data = MarketData(mkt_data_list) + print(mkt_data.depot) # close connection ibc.ec.eDisconnect() diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 4f58b86..0000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -pandas >= 0.20.0 -SQLAlchemy >= 1.1.9 -nose >= 1.3.7 -swigibpy >= 0.5.0 diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/context.py b/tests/context.py deleted file mode 100644 index 06caf88..0000000 --- a/tests/context.py +++ /dev/null @@ -1,11 +0,0 @@ -""" -Context imports for tests. -""" - - -import sys -import os -sys.path.insert(0, os.path.abspath( - os.path.join(os.path.dirname(__file__), '..'))) - -import ibstract diff --git a/tests/test_data_access.py b/tests/test_data_access.py deleted file mode 100644 index 0eecd64..0000000 --- a/tests/test_data_access.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -Test cases for data downloading, storing, access and management. -""" - - -import unittest - -from .context import ibstract - - -class DataDownloadSuite(unittest.TestCase): - """ - Test cases for downloading data from IB. - """ - - def test_download_hist_stk(self): - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_streaming.py b/tests/test_streaming.py deleted file mode 100644 index a6646a2..0000000 --- a/tests/test_streaming.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -Test cases for real-time data streaming and technical signal generating. -""" - - -import unittest - -from .context import ibstract - - -class DataStreamingSuite(unittest.TestCase): - """ - Test cases for real-time streaming data from IB. - """ - - def test_stream_stk(self): - pass - - -if __name__ == '__main__': - unittest.main()