summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-pysentosa.spec279
-rw-r--r--sources1
3 files changed, 281 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..ccac6e6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/pysentosa-0.1.32.tar.gz
diff --git a/python-pysentosa.spec b/python-pysentosa.spec
new file mode 100644
index 0000000..f408be0
--- /dev/null
+++ b/python-pysentosa.spec
@@ -0,0 +1,279 @@
+%global _empty_manifest_terminate_build 0
+Name: python-pysentosa
+Version: 0.1.32
+Release: 1
+Summary: pysentosa - Python API for sentosa trading system
+License: GPL
+URL: http://www.quant365.com
+Source0: https://mirrors.aliyun.com/pypi/web/packages/fb/d3/184a674d2fcab4dfdc0bd0c231b0a2eb5e7d5e2eedf48f81ccd3ad8b9916/pysentosa-0.1.32.tar.gz
+BuildArch: noarch
+
+
+%description
+pysentosa - Python API for sentosa trading system
+
+.. image:: http://www.quant365.com/static/merlion.png
+
+
+- pysentosa is the Python API for sentosa trading system written by Wu Fuheng
+
+- WebSite: http://www.quant365.com (Quant365 - Trading with Science and Technology)
+
+- OS: Linux Ubuntu 15.10 64bit
+
+- Installation:
+
+ .. code-block:: bash
+
+ GITURL=https://raw.githubusercontent.com/henrywoo/pysentosa/master
+ wget $GITURL/install_nanomsg.sh -O install_nanomsg.sh
+ chmod u+x install_nanomsg.sh
+ ./install_nanomsg.sh
+
+ wget $GITURL/install_yaml_cpp.sh -O install_yaml_cpp.sh
+ chmod u+x install_yaml_cpp.sh
+ ./install_yaml_cpp.sh
+
+ sudo apt-get install -y python-pip libboost-all-dev
+ sudo pip install -U pysentosa pyyaml netifaces websocket-client nanomsg \
+ setproctitle psutil
+
+- Launch your IB TWS.
+
+- Run your strategy to trade
+
+ Run demo:
+
+ .. code-block:: python
+
+ from pysentosa.demo import run_demo
+ run_demo()
+
+ Sample code:
+
+ .. code-block:: python
+
+ from pysentosa import Merlion
+ from ticktype import *
+
+ m = Merlion()
+ target = 'SPY'
+ m.track_symbol([target, 'BITA'])
+ bounds = {target: [220, 250]}
+ while True:
+ symbol, ticktype, value = m.get_mkdata()
+ if symbol == target:
+ if ticktype == ASK_PRICE and value < bounds[symbol][0]:
+ oid = m.buy(symbol, 5)
+ while True:
+ ord_st = m.get_order_status(oid)
+ print ORDSTATUS[ord_st]
+ if ord_st == FILLED:
+ bounds[symbol][0] -= 20
+ break
+ sleep(2)
+ elif ticktype == BID_PRICE and value > bounds[symbol][1]:
+ oid = m.sell(symbol, 100)
+ bounds[symbol][1] += 20
+
+
+.. image:: https://d2weczhvl823v0.cloudfront.net/henrywoo/pysentosa/trend.png
+ :alt: Bitdeli badge
+ :target: https://bitdeli.com/free
+
+%package -n python3-pysentosa
+Summary: pysentosa - Python API for sentosa trading system
+Provides: python-pysentosa
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-pysentosa
+pysentosa - Python API for sentosa trading system
+
+.. image:: http://www.quant365.com/static/merlion.png
+
+
+- pysentosa is the Python API for sentosa trading system written by Wu Fuheng
+
+- WebSite: http://www.quant365.com (Quant365 - Trading with Science and Technology)
+
+- OS: Linux Ubuntu 15.10 64bit
+
+- Installation:
+
+ .. code-block:: bash
+
+ GITURL=https://raw.githubusercontent.com/henrywoo/pysentosa/master
+ wget $GITURL/install_nanomsg.sh -O install_nanomsg.sh
+ chmod u+x install_nanomsg.sh
+ ./install_nanomsg.sh
+
+ wget $GITURL/install_yaml_cpp.sh -O install_yaml_cpp.sh
+ chmod u+x install_yaml_cpp.sh
+ ./install_yaml_cpp.sh
+
+ sudo apt-get install -y python-pip libboost-all-dev
+ sudo pip install -U pysentosa pyyaml netifaces websocket-client nanomsg \
+ setproctitle psutil
+
+- Launch your IB TWS.
+
+- Run your strategy to trade
+
+ Run demo:
+
+ .. code-block:: python
+
+ from pysentosa.demo import run_demo
+ run_demo()
+
+ Sample code:
+
+ .. code-block:: python
+
+ from pysentosa import Merlion
+ from ticktype import *
+
+ m = Merlion()
+ target = 'SPY'
+ m.track_symbol([target, 'BITA'])
+ bounds = {target: [220, 250]}
+ while True:
+ symbol, ticktype, value = m.get_mkdata()
+ if symbol == target:
+ if ticktype == ASK_PRICE and value < bounds[symbol][0]:
+ oid = m.buy(symbol, 5)
+ while True:
+ ord_st = m.get_order_status(oid)
+ print ORDSTATUS[ord_st]
+ if ord_st == FILLED:
+ bounds[symbol][0] -= 20
+ break
+ sleep(2)
+ elif ticktype == BID_PRICE and value > bounds[symbol][1]:
+ oid = m.sell(symbol, 100)
+ bounds[symbol][1] += 20
+
+
+.. image:: https://d2weczhvl823v0.cloudfront.net/henrywoo/pysentosa/trend.png
+ :alt: Bitdeli badge
+ :target: https://bitdeli.com/free
+
+%package help
+Summary: Development documents and examples for pysentosa
+Provides: python3-pysentosa-doc
+%description help
+pysentosa - Python API for sentosa trading system
+
+.. image:: http://www.quant365.com/static/merlion.png
+
+
+- pysentosa is the Python API for sentosa trading system written by Wu Fuheng
+
+- WebSite: http://www.quant365.com (Quant365 - Trading with Science and Technology)
+
+- OS: Linux Ubuntu 15.10 64bit
+
+- Installation:
+
+ .. code-block:: bash
+
+ GITURL=https://raw.githubusercontent.com/henrywoo/pysentosa/master
+ wget $GITURL/install_nanomsg.sh -O install_nanomsg.sh
+ chmod u+x install_nanomsg.sh
+ ./install_nanomsg.sh
+
+ wget $GITURL/install_yaml_cpp.sh -O install_yaml_cpp.sh
+ chmod u+x install_yaml_cpp.sh
+ ./install_yaml_cpp.sh
+
+ sudo apt-get install -y python-pip libboost-all-dev
+ sudo pip install -U pysentosa pyyaml netifaces websocket-client nanomsg \
+ setproctitle psutil
+
+- Launch your IB TWS.
+
+- Run your strategy to trade
+
+ Run demo:
+
+ .. code-block:: python
+
+ from pysentosa.demo import run_demo
+ run_demo()
+
+ Sample code:
+
+ .. code-block:: python
+
+ from pysentosa import Merlion
+ from ticktype import *
+
+ m = Merlion()
+ target = 'SPY'
+ m.track_symbol([target, 'BITA'])
+ bounds = {target: [220, 250]}
+ while True:
+ symbol, ticktype, value = m.get_mkdata()
+ if symbol == target:
+ if ticktype == ASK_PRICE and value < bounds[symbol][0]:
+ oid = m.buy(symbol, 5)
+ while True:
+ ord_st = m.get_order_status(oid)
+ print ORDSTATUS[ord_st]
+ if ord_st == FILLED:
+ bounds[symbol][0] -= 20
+ break
+ sleep(2)
+ elif ticktype == BID_PRICE and value > bounds[symbol][1]:
+ oid = m.sell(symbol, 100)
+ bounds[symbol][1] += 20
+
+
+.. image:: https://d2weczhvl823v0.cloudfront.net/henrywoo/pysentosa/trend.png
+ :alt: Bitdeli badge
+ :target: https://bitdeli.com/free
+
+%prep
+%autosetup -n pysentosa-0.1.32
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-pysentosa -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.32-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..6df2a0e
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+f56411a5d1a4f14b407221b4b72aa8b8 pysentosa-0.1.32.tar.gz