Skip to main content

pysentosa - Python API for sentosa trading system

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:

    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
Bitdeli badge

Release files for pysentosa 0.1.32

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysentosa 0.1.32
File Size Uploaded
pysentosa-0.1.32.tar.gz 5.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for pysentosa 0.1.32
File Interpreter ABI Platform
pysentosa-0.1.32-py2.7.egg Legacy Egg format - - Details

Total release size: 10.1 MB

Release files / pysentosa-0.1.32.tar.gz

Download URL pysentosa-0.1.32.tar.gz
Size 5.0 MB
Tags Source
SHA-256 checksum
How to use checksums
5a626c3b0da08331c422f523e4dad8c0f91d569b4660a17cdd0b27ab01eeb9b2
BLAKE2b-256 checksum
How to use checksums
fbd3184a674d2fcab4dfdc0bd0c231b0a2eb5e7d5e2eedf48f81ccd3ad8b9916
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pysentosa-0.1.32-py2.7.egg

Download URL pysentosa-0.1.32-py2.7.egg
Size 5.1 MB
Tags Egg
SHA-256 checksum
How to use checksums
71e0489beabfe845907cb1547140bc57c64373cde3266c81c974e97b6c492d0d
BLAKE2b-256 checksum
How to use checksums
90b5313179e34e9e64f0639cad1037e14bb0866fab595740d96be0a3b699dacb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.32 This release

2 release files

0.1.31

2 release files

0.1.24

1 release file

0.1.23

1 release file

0.1.22

1 release file

0.1.21

1 release file

0.1.20

1 release file

0.1.19

1 release file

0.1.18

1 release file

0.1.17

1 release file

0.1.16

1 release file

0.1.15

1 release file

0.1.14

1 release file

0.1.13

1 release file

0.1.12

1 release file

0.1.11

1 release file

0.1.10

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page