Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

HistoricalInvestor trading API

Project Description

Readme for PyHI module

0. Introduction

This is a Python client for HistoricalInvestor.com server, a financial training tool and trading strategy tester application.

1. Using PyHI client

  1. Log in to HI account using a supported browser (manually) and presuming you have some financial instruments bought, click:

Autosys | REST API

This window contains credentials for your HI client:

REST ID: REST Password:

Copy those credentials to your trading automaton configuration.

The window also lists the symbols of available financial instruments you can trade using the client API.

  1. In your program, import the HiData class from “pyhi” module:

from pyhi import HiData, maybe_pretty

  1. Create main instance of the HiData class that will be a HI client, for instance

hd = HiData(restid, restpasswd, ‘AUDJPY’, resolution=’D1’, initialTime=1245803300000, baseurl=’http://historicalinvestor.com’)

The client attempts to open the session to the HI server automatically on creation. It remembers specified parameters like session token, restId and restPassword.

You can call object methods to operate on the virtual market session: getting data, placing orders and closing session.

Example of getting data:

print ‘nnDATA acquired:’, maybe_pretty(hd.get_data(1245803500000, 5))

Placing order for 1 lot of AUDJPY:

print ‘nnOrder:’, maybe_pretty(hd.order(1245803500000, 1))

  1. Transactions

To buy, use positive values (long position) in “volume” parameter.

To sell, use negative values (long position) in “volume” parameter.

  1. close the session with .finish

or else the transactions will not be visible

  1. open executed session in web UI:
  • click Autosys | automaton name (e.g. “MyAutomaton” in “test.py” example) | date and time of the session.
  1. click Results button to view the trade results.

Button Trades turns on buy/sell transaction labels on the main chart.

4. Example

A complete client use example is available in a file “example.py” located in “doc ” subdirectory.

5. Important issues

Remember to close the session with “finish” method of HiData instance - otherwise the session with transactions done will not be shown in web UI!

Release History

Release History

This version
History Node

0.2

History Node

0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pyhi-0.2.tar.gz (3.7 kB) Copy SHA256 Checksum SHA256 Source Apr 29, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting