pysentosa 0.1.32
pip install pysentosa
Latest version
Released:
pysentosa - Python API for sentosa trading system
Navigation
Project description
pysentosa - Python API for sentosa trading system
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:
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:
from pysentosa.demo import run_demo run_demo()
Sample code:
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
Project details
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: GPL
- Author: Wu Fuheng
- Tags sentosa, python
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pysentosa-0.1.32.tar.gz
.
File metadata
- Download URL: pysentosa-0.1.32.tar.gz
- Upload date:
- Size: 5.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a626c3b0da08331c422f523e4dad8c0f91d569b4660a17cdd0b27ab01eeb9b2 |
|
MD5 | f56411a5d1a4f14b407221b4b72aa8b8 |
|
BLAKE2b-256 | fbd3184a674d2fcab4dfdc0bd0c231b0a2eb5e7d5e2eedf48f81ccd3ad8b9916 |
File details
Details for the file pysentosa-0.1.32-py2.7.egg
.
File metadata
- Download URL: pysentosa-0.1.32-py2.7.egg
- Upload date:
- Size: 5.1 MB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71e0489beabfe845907cb1547140bc57c64373cde3266c81c974e97b6c492d0d |
|
MD5 | b39949fc696ef09969485aff7f97c257 |
|
BLAKE2b-256 | 90b5313179e34e9e64f0639cad1037e14bb0866fab595740d96be0a3b699dacb |