Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

pysentosa - Python API for sentosa trading system

Project description

pysentosa - Python API for sentosa trading system
  • pysentosa is the Python API for sentosa trading system written by Wu Fuheng

  • WebSite: (Quant365 - Trading with Science and Technology)

  • OS: Linux Ubuntu 15.10 64bit

  • Installation:

    wget $GITURL/ -O
    chmod u+x
    wget $GITURL/ -O
    chmod u+x
    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

    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 =, 5)
            while True:
                ord_st = m.get_order_status(oid)
                print ORDSTATUS[ord_st]
                if ord_st == FILLED:
                    bounds[symbol][0] -= 20
        elif ticktype == BID_PRICE and value > bounds[symbol][1]:
            oid = m.sell(symbol, 100)
            bounds[symbol][1] += 20
Bitdeli badge

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pysentosa-0.1.32-py2.7.egg (5.1 MB) Copy SHA256 hash SHA256 Egg 2.7
pysentosa-0.1.32.tar.gz (5.0 MB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page